零碎的垃圾箱

作者: 拖鞋花短裤 | 来源:发表于2018-08-07 15:23 被阅读0次

    Load NTFS hard drive to Linux

    如何装在NTFS的磁盘到Linux系统上(比如向一个Linux的物理服务器上上传私有文件,文件预先拷贝在移动硬盘中)

    Ubuntu系统:

    # wget http://tuxera.com/opensource/ntfs-3g_ntfsprogs-2013.1.13.tgz

    # tar -zxvf ntfs-3g_ntfsprogs-2013.1.13.tgz

    # cd ntfs-3g_ntfsprogs-2013.1.13

    # apt-get install gcc

    #./configure (or ./configure--prefix=/usr/local/ntf3g)

    # make&&make install

    # fdisk -l (check hard drive name,/dev/sdb1 for example)

    # mkdir /mnt/usb1

    # mount -t ntfs-3g /dev/sdb1/mnt/usb1

    # ls /mnt/usb1

    CentOS系统:

    #wget -O /etc/yum.repos.d/epel.repohttp://mirrors.aliyun.com/repo/epel-7.repo

    #yum update;yum install ntfs-3g

    #yum install ntfs-3g


    为启动的虚机添加密码

    默认ubuntu或者centos的云版本都删减了用户自定义密码部分,登录时通过密钥。有些情况下,我们需要通过想桌面系统一样通过密码登录,以下是一些方法。

    脚本

    OpenStack中向虚机中注入的脚本,设置虚机用户和密码为ubuntu/ubuntu

    #!/bin/sh

    passwdubuntu<

    ubuntu

    ubuntu

    EOF

    工具

    #apt-get install libguestfs-tools

    # update-guestfs-appliance

    # guestfish --rw -a ubuntu-16.04-server-cloudimg-amd64-disk1.img

    >run

    >list-filesystems

    /dev/sda1:ext4

    >mount /dev/sda1 /

    >edit /etc/cloud/cloud.cfg

    system_info:

      default_user:

        name: ubuntu

        lock_passwd: false

        plain_text_passwd:  '<your own password>'

    ><fs>exit


    查看系统的硬件信息

    DMI

    以下斜体部分摘自http://man.linuxde.net/dmidecode

    dmidecode命令可以让你在Linux系统下获取有关硬件方面的信息。dmidecode的作用是将DMI数据库中的信息解码,以可读的文本方式显示。由于DMI信息可以人为修改,因此里面的信息不一定是系统准确的信息。dmidecode遵循SMBIOS/DMI标准,其输出的信息包括BIOS、系统、主板、处理器、内存、缓存等等。

    DMI(Desktop Management Interface,DMI)就是帮助收集电脑系统信息的管理系统,DMI信息的收集必须在严格遵照SMBIOS规范的前提下进行。SMBIOS(System Management BIOS)是主板或系统制造者以标准格式显示产品管理信息所需遵循的统一规范。SMBIOS和DMI是由行业指导机构Desktop Management Task Force(DMTF)起草的开放性的技术标准,其中DMI设计适用于任何的平台和操作系统。

    DMI充当了管理工具和系统层之间接口的角色。它建立了标准的可管理系统更加方便了电脑厂商和用户对系统的了解。DMI的主要组成部分是Management Information Format(MIF)数据库。这个数据库包括了所有有关电脑系统和配件的信息。通过DMI,用户可以获取序列号、电脑厂商、串口信息以及其它系统配件信息。

    -d:(default:/dev/mem)从设备文件读取信息,输出内容与不加参数标准输出相同。

    -h:显示帮助信息。

    -s:只显示指定DMI字符串的信息。(string)

    -t:只显示指定条目的信息。(type)

    -u:显示未解码的原始条目内容。

    --dump-bin file:将DMI数据转储到一个二进制文件中。

    --from-dump FILE:从一个二进制文件读取DMI数据。

    -V:显示版本信息。

    # dmidecode --dump-bin _smbios.bin

    # dmidecode -t 4

    # dmidecode 3.0

    Getting SMBIOS data from sysfs.

    SMBIOS 3.0 present.

    Handle 0x003C, DMI type 4, 42 bytes

    Processor Information

           Socket Designation: CPU1

           Type: Central Processor

           Family: Xeon

           Manufacturer: Intel

            ID:F1 06 04 00 FF FB EB BF

           Signature: Type 0, Family 6, Model 79, Stepping 1

           Flags:

                    FPU (Floating-point unit on-chip)

                   VME (Virtual mode extension)

                   DE (Debugging extension)

                   PSE (Page size extension)

                   TSC (Time stamp counter)

                   MSR (Model specific registers)

                    PAE (Physical address extension)

                   MCE (Machine check exception)

                   CX8 (CMPXCHG8 instruction supported)

                   APIC (On-chip APIC hardware supported)

                   SEP (Fast system call)

                   MTRR (Memory type rangeregisters)

                   PGE (Page global enable)

                   MCA (Machine check architecture)

                   CMOV (Conditional move instruction supported)

                   PAT (Page attribute table)

                   PSE-36 (36-bit page size extension)

                   CLFSH (CLFLUSH instruction supported)

                   DS (Debug store)

                   ACPI (ACPI supported)

                   MMX (MMX technology supported)

                   FXSR (FXSAVE and FXSTOR instructions supported)

                   SSE (Streaming SIMD extensions)

                   SSE2 (Streaming SIMD extensions 2)

                   SS (Self-snoop)

                   HTT (Multi-threading)

                   TM (Thermal monitor supported)

                   PBE (Pending break enabled)

           Version: Intel(R) Xeon(R) CPU E5-2620 v4 @ 2.10GHz

           Voltage: 1.8 V

           External Clock: 100 MHz

            MaxSpeed: 4000 MHz

           Current Speed: 2100 MHz

           Status: Populated, Enabled

           Upgrade: Socket LGA2011-3

            L1Cache Handle: 0x0039

            L2Cache Handle: 0x003A

            L3Cache Handle: 0x003B

           Serial Number: Not Specified

           Asset Tag: Not Specified

           Part Number: Not Specified

           Core Count: 8

           Core Enabled: 8

            Thread Count: 16

           Characteristics:

                   64-bit capable

                   Multi-Core

                   Hardware Thread

                   Execute Protection

                   Enhanced Virtualization

                   Power/Performance Control

    BMC

    BMC(baseboard management controller)作为IPMI即智能平台管理系统的重要组件,为IPMI命令提供系统各传感器数据及日志事件等功能。

    在监测端和被监测端我们安装相应的组件模块:

    # apt install ipmitool

    # modprobe ipmi_devintf

    # modprobe ipmi_si

    或者将模块(ipmi_devintf,ipmi_si)写入/etc/modules实现开机自动加载

    被监测节点上配置:

    # ipmitool -I open channel info 0x1

    Channel 0x1 info:

     Channel Medium Type   : 802.3 LAN

     Channel Protocol Type : IPMB-1.0

     Session Support       :multi-session

     Active Session Count  : 0

     Protocol Vendor ID    : 7154

     Volatile(active) Settings

       Alerting            : enabled

       Per-message Auth    : enabled

       User Level Auth     : enabled

       Access Mode         : alwaysavailable

     Non-Volatile Settings

       Alerting            : enabled

       Per-message Auth    : enabled

       User Level Auth     : enabled

       Access Mode         : alwaysavailable

    # ipmitool -I open lan print 0x1

    Set in Progress         : Set Complete

    Auth Type Support       : NONE MD2 MD5 PASSWORD

    Auth Type Enable        : Callback : MD2 MD5 PASSWORD

                            : User     : MD2 MD5 PASSWORD

                            : Operator : MD2 MD5PASSWORD

                            : Admin    : MD2 MD5 PASSWORD

                            : OEM      : MD2 MD5 PASSWORD

    IP Address Source       : DHCP Address

    IP Address             : 10.109.17.234

    Subnet Mask             : 255.255.255.0

    MAC Address             : ac:1f:6b:4a:29:08

    SNMP Community String   : public

    IP Header               : TTL=0x00 Flags=0x00Precedence=0x00 TOS=0x00

    BMC ARP Control         : ARP Responses Enabled, GratuitousARP Disabled

    Default Gateway IP      : 10.109.17.1

    Default Gateway MAC     : 10:0e:7e:b7:7c:40

    Backup Gateway IP       : 0.0.0.0

    Backup Gateway MAC      : 00:00:00:00:00:00

    802.1q VLAN ID          : Disabled

    802.1q VLAN Priority    : 0

    RMCP+ Cipher Suites     : 1,2,3,6,7,8,11,12

    Cipher Suite Priv Max   : XaaaXXaaaXXaaXX

                            :     X=Cipher Suite Unused

                            :     c=CALLBACK

                            :     u=USER

                            :     o=OPERATOR

                            :     a=ADMIN

                            :     O=OEM

    Optional:

    User authorized to use KCS channel

    # ipmitool user list

    ID Name             Callin  Link Auth IPMI Msg   Channel Priv Limit

    1                    true    false     false      Unknown (0x00)

    2  ADMIN            true    false     false      Unknown (0x00)

    3                    true    false     false     Unknown (0x00)

    4                    true    false     false      Unknown (0x00)

    5                    true    false     false      Unknown (0x00)

    6                    true    false     false      Unknown (0x00)

    7                    true    false     false      Unknown (0x00)

    8                    true    false     false      Unknown (0x00)

    9                    true    false     false      Unknown (0x00)

    10                   true    false     false      Unknown (0x00)

    Lan channel user info

    # ipmitool user list 1

    ID Name             Callin  Link Auth IPMI Msg   Channel Priv Limit

    1                    true    false     false      Unknown (0x00)

    2  ADMIN            false   false     true       ADMINISTRATOR

    3                    true    false     false      Unknown (0x00)

    4                    true    false     false      Unknown (0x00)

    5                    true    false     false      Unknown (0x00)

    6                    true    false     false      Unknown (0x00)

    7                    true   false      false      Unknown (0x00)

    8                    true    false     false      Unknown (0x00)

    9                    true    false     false      Unknown (0x00)

    10                   true    false     false      Unknown (0x00)

    # ipmitool user enable 2

    # ipmitool user priv 2 4 1

    # ipmitool user set name ADMIN

    # ipmitool user set password 2 ADMIN

    监测节点上执行命令获取相应的sdr,mc,fru,sel信息:

    # ipmitool -H 10.109.17.234 -U ADMIN -P ADMIN -I lanplus power status

    Chassis Power is on

    mc(Management Controller status and global enables)

    # ipmitool -H 10.109.17.234 -U ADMIN -P ADMIN -I lanplus mc info

    Device ID                : 32

    Device Revision          : 1

    Firmware Revision        : 3.50

    IPMI Version             : 2.0

    Manufacturer ID          : 10876

    Manufacturer Name        : Supermicro

    Product ID               : 2100 (0x0834)

    Product Name             : Unknown (0x834)

    Device Available         : yes

    Provides Device SDRs     : no

    Additional Device Support :

        Sensor Device

        SDR RepositoryDevice

        SEL Device

        FRU InventoryDevice

        IPMB EventReceiver

        IPMB EventGenerator

        Chassis Device

    Aux Firmware Rev Info    :

        0x00

        0x00

        0x00

        0x00

    sdr(Print Sensor Data Repository entries and readings)

    # ipmitool -H 10.109.17.234 -U ADMIN -P ADMIN -I lanplus sdr

    CPU Temp         |30 degrees C      | ok

    PCH Temp         |37 degrees C      | ok

    System Temp      |23 degrees C      | ok

    Peripheral Temp  |30 degrees C      | ok

    VcpuVRM Temp     |42 degrees C      | ok

    VmemABVRM Temp   |31 degrees C      | ok

    VmemCDVRM Temp   |26 degrees C      | ok

    DIMMA1 Temp      |26 degrees C      | ok

    DIMMA2 Temp      |no reading        | ns

    DIMMB1 Temp      |26 degrees C      | ok

    DIMMB2 Temp      |no reading        | ns

    DIMMC1 Temp      |26 degrees C      | ok

    DIMMC2 Temp      |no reading        | ns

    DIMMD1 Temp      |26 degrees C      | ok

    DIMMD2 Temp      |no reading        | ns

    FAN1             |4900 RPM          | ok

    FAN2             |4700 RPM          | ok

    FAN3             |4600 RPM          | ok

    FAN4             |4400 RPM          | ok

    FAN5             |no reading        | ns

    FANA             |4800 RPM          | ok

    12V              |11.94 Volts       | ok

    5VCC             |5.03 Volts        | ok

    3.3VCC           |3.28 Volts        | ok

    VBAT             |3.08 Volts        | ok

    Vcpu             |1.81 Volts        | ok

    VDIMMAB          |1.20 Volts        | ok

    VDIMMCD          |1.20 Volts        | ok

    5VSB             |5 Volts           | ok

    3.3VSB           |3.30 Volts        | ok

    1.5V PCH         |1.51 Volts        | ok

    1.2V BMC         |1.22 Volts        | ok

    1.05V PCH        |1.05 Volts        | ok

    Chassis Intru    |0x01              | ok

    fru(Print built-in FRU and scan SDR for FRU locators)

    # ipmitool -H 10.109.17.234 -U ADMIN -P ADMIN -I lanplus fru

    FRU Device Description : Builtin FRU Device (ID 0)

     Board MfgDate        : Sun Dec 31 16:00:00 1995

     Board Mfg             : Supermicro

     Board Serial          :

     ProductSerial        :

    sel(Print System Event Log (SEL))

    # ipmitool -H 10.109.17.234 -U ADMIN -P ADMIN -I lanplus sel list

       1 | 10/27/2017| 03:42:43 | Physical Security #0xaa | General Chassis intrusion () | Asserted

       2 | 10/27/2017| 03:47:56 | OS Boot | C: boot completed () | Asserted

       3 | 10/27/2017| 04:26:44 | OS Stop/Shutdown | OS graceful shutdown () | Asserted

       4 | 03/08/2018| 18:07:05 | Physical Security #0xaa | General Chassis intrusion () | Asserted

       5 | 03/28/2018| 19:14:46 | Unknown #0xff |  | Asserted

    # ipmitool -H 10.109.17.234 -U ADMIN -P ADMIN -I lanplus sel get 1

    SEL Record ID         : 0001

     Record Type           : 02

     Timestamp             : 10/27/2017 03:42:43

     Generator ID          : 0020

     EvM Revision          : 04

     Sensor Type           : Physical Security

     SensorNumber         : aa

     Event Type            : Sensor-specific Discrete

     EventDirection       : Assertion Event

     Event Data(RAW)      : f0ffff

     EventInterpretation  : Missing

     Description           : General Chassis intrusion ()

    Sensor ID             : Chassis Intru (0xaa)

     Entity ID             : 23.1

     Sensor Type(Discrete): Physical Security

     StatesAsserted       : Physical Security

                            [General Chassis intrusion]

    IPMI更多的介绍参考:

    https://www.ibm.com/developerworks/cn/linux/l-ipmi/index.html

    相关文章

      网友评论

        本文标题:零碎的垃圾箱

        本文链接:https://www.haomeiwen.com/subject/gemgvftx.html