Blog

  • linux使用 storcli 查询raid卡情况.

    下载storcli

    https://www.broadcom.com/products/storage/raid-controllers/megaraid-9560-8i

    安装storcli

    root@debian:~# dpkg -i storcli_007.3007.0000.0000_all.deb
    
    root@debian:~# dpkg -l | grep -i storcli
    ii  storcli                         007.3007.0000.0000             all          Storage Command Line Tool, manages storage controllers.
    

    查看有哪些控制器

    /opt/MegaRAID/storcli/storcli64 show all
    
    CLI Version = 007.3007.0000.0000 May 16, 2024
    Operating system = Linux 6.1.0-22-amd64
    Status Code = 0
    Status = Success
    Description = None
    
    Number of Controllers = 1
    Host Name = debian
    Operating System  = Linux 6.1.0-22-amd64
    
    System Overview :
    ===============
    
    ------------------------------------------------------------------------------------
    Ctl Model                   Ports PDs DGs DNOpt VDs VNOpt BBU sPR DS  EHS ASOs Hlth
    ------------------------------------------------------------------------------------
      0 AVAGOMegaRAIDSAS9361-8i     8  13   2     0   2     0 Opt On  1&2 Y      3 Opt
    ------------------------------------------------------------------------------------
    
    Ctl=Controller Index|DGs=Drive groups|VDs=Virtual drives|Fld=Failed
    PDs=Physical drives|DNOpt=Array NotOptimal|VNOpt=VD NotOptimal|Opt=Optimal
    Msng=Missing|Dgd=Degraded|NdAtn=Need Attention|Unkwn=Unknown
    sPR=Scheduled Patrol Read|DS=DimmerSwitch|EHS=Emergency Spare Drive
    Y=Yes|N=No|ASOs=Advanced Software Options|BBU=Battery backup unit/CV
    Hlth=Health|Safe=Safe-mode boot|CertProv-Certificate Provision mode
    Chrg=Charging | MsngCbl=Cable Failure
    ...
    

    查看第一个控制器

    /opt/MegaRAID/storcli/storcli64 /c0 show
    

    一些使用storcli的例子

    如何在新的 VxRack 节点上使用 Storcli 配置虚拟磁盘

  • debian12 最小化安装后,配置静态ip

    debian12 最小化安装后,配置静态ip

    配置静态ip

    1. 检查那个网口是配置好线路的.
    2. 给目标网口配置ip
    root@debian:~# cat  /etc/network/interfaces.d/ifcfg-enp59s0f0
    auto enp59s0f0
    iface enp59s0f0 inet static
        address 192.168.11.53
        netmask 255.255.248.0
        gateway 192.168.8.254
    
    1. 重启网络
    systemctl restart networking.service
    
    1. 检查ip
    root@debian:~# ip addr
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
        inet 127.0.0.1/8 scope host lo
           valid_lft forever preferred_lft forever
        inet6 ::1/128 scope host noprefixroute
           valid_lft forever preferred_lft forever
    2: enp63s0f2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
        link/ether 2c:f0:5d:bc:1b:56 brd ff:ff:ff:ff:ff:ff
    3: enp63s0f3: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
        link/ether 2c:f0:5d:bc:1b:57 brd ff:ff:ff:ff:ff:ff
    4: enp59s0f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
        link/ether 58:53:c0:66:03:d0 brd ff:ff:ff:ff:ff:ff
        inet 192.168.11.53/21 brd 192.168.15.255 scope global enp59s0f0
           valid_lft forever preferred_lft forever
        inet6 fe80::5a53:c0ff:fe66:3d0/64 scope link
           valid_lft forever preferred_lft forever
    5: enp59s0f1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
        link/ether 58:53:c0:66:03:d1 brd ff:ff:ff:ff:ff:ff
    
    root@debian:~# ip route
    default via 192.168.8.254 dev enp59s0f0 onlink
    192.168.8.0/21 dev enp59s0f0 proto kernel scope link src 192.168.11.53
    root@debian:~#
    

    配置阿里云镜像源

    root@debian:~# cat /etc/apt/sources.list
    deb http://mirrors.aliyun.com/debian/ bookworm main non-free-firmware contrib
    deb-src http://mirrors.aliyun.com/debian/ bookworm main non-free-firmware contrib
    deb http://mirrors.aliyun.com/debian-security/ bookworm-security main
    deb-src http://mirrors.aliyun.com/debian-security/ bookworm-security main
    deb http://mirrors.aliyun.com/debian/ bookworm-updates main non-free-firmware contrib
    deb-src http://mirrors.aliyun.com/debian/ bookworm-updates main non-free-firmware contrib
    deb http://mirrors.aliyun.com/debian/ bookworm-backports main non-free-firmware contrib
    deb-src http://mirrors.aliyun.com/debian/ bookworm-backports main non-free-firmware contrib
    

    如果新安装的debian 可能没有安装 resolvconf, 无法解析域名.

    这个时候可以先在别的机器测试mirrors.aliyun.com的ip是多少,然后配置到 /etc/hosts

    root@debian:~# grep mirror /etc/hosts
    218.77.200.227 mirrors.aliyun.com
    root@debian:~#
    

    安装resolvconf

    apt update
    apt install resolvconf
    

    配置dns解析

    root@debian:~# cat /etc/resolvconf/resolv.conf.d/base
    nameserver 114.114.114.114
    root@debian:~#
    

    重启resolveconf

    systemctl restart resolvconf
    

    配置zh_CN.utf8

    # 查看可以使用的编码
    root@debian:~# locale -a
    C
    C.utf8
    en_HK.utf8
    POSIX
    root@debian:~#
    
    # 增加zh_CN.utf8 编码
    dpkg-reconfigure locales
    # 选择zh_CN.utf8,然后ok回车.
    
    # 再次查看
    root@debian:~# locale -a
    C
    C.utf8
    en_HK.utf8
    POSIX
    zh_CN.utf8
    
  • vmware esxi 查询命令

    网卡信息查询

    [root@localhost2:~] esxcfg-nics -l
    Name    PCI          Driver      Link Speed      Duplex MAC Address       MTU    Description
    vmnic0  0000:01:00.0 ntg3        Up   1000Mbps   Full   c8:1f:66:f2:25:fc 1500   Broadcom Corporation NetXtreme BCM5720 Gigabit Ethernet
    vmnic1  0000:01:00.1 ntg3        Down 0Mbps      Half   c8:1f:66:f2:25:fd 1500   Broadcom Corporation NetXtreme BCM5720 Gigabit Ethernet
    vmnic2  0000:02:00.0 ntg3        Down 0Mbps      Half   c8:1f:66:f2:25:fe 1500   Broadcom Corporation NetXtreme BCM5720 Gigabit Ethernet
    vmnic3  0000:02:00.1 ntg3        Up   1000Mbps   Full   c8:1f:66:f2:25:ff 1500   Broadcom Corporation NetXtreme BCM5720 Gigabit Ethernet
    vmnic4  0000:04:00.0 ixgben      Down 0Mbps      Half   90:e2:ba:93:9f:58 1500   Intel Corporation 82599EB 10-Gigabit SFI/SFP+ Network Connection
    vmnic5  0000:04:00.1 ixgben      Up   10000Mbps  Full   90:e2:ba:93:9f:5a 1500   Intel Corporation 82599EB 10-Gigabit SFI/SFP+ Network Connection
    

    获取主机总线适配器当前使用得驱动程序类型

    [root@localhost2:~] esxcfg-scsidevs -a
    vmhba0  vmw_ahci          link-n/a  sata.vmhba0                             (0000:00:1f.2) Intel Corporation Patsburg 6 Port SATA AHCI Controller
    vmhba1  lsi_mr3           link-n/a  sas.5c81f660f7636700                    (0000:03:00.0) LSI / Symbios Logic Dell PERC H710 Mini
    vmhba64 iscsi_vmk         online    iscsi.vmhba64                           iSCSI Software Adapter
    

    存储路径查询

    [root@localhost2:~] esxcli storage core path list
    sas.5c81f660f7636700-sas.605c95593ce97768-naa.6c81f660f7636700235c95593ce97768
       UID: sas.5c81f660f7636700-sas.605c95593ce97768-naa.6c81f660f7636700235c95593ce97768
       Runtime Name: vmhba1:C2:T2:L0
       Device: naa.6c81f660f7636700235c95593ce97768
       Device Display Name: Local DELL Disk (naa.6c81f660f7636700235c95593ce97768)
       Adapter: vmhba1
       Channel: 2
       Target: 2
       LUN: 0
       Plugin: NMP
       State: active
       Transport: sas
       Adapter Identifier: sas.5c81f660f7636700
       Target Identifier: sas.605c95593ce97768
       Adapter Transport Details: 5c81f660f7636700
       Target Transport Details: 605c95593ce97768
       Maximum IO Size: 262144
    
    sata.vmhba0-sata.0:4-mpx.vmhba0:C0:T4:L0
       UID: sata.vmhba0-sata.0:4-mpx.vmhba0:C0:T4:L0
    ...
    

    查询WWN号

    esxcli storage san iscsi list
    [root@localhost2:~] esxcli storage san iscsi list
       Adapter: vmhba64
       UID: iscsi.vmhba64
       Driver: iscsi_vmk
       State: online
       Description: iSCSI Software Adapter
    
    [root@localhost2:~] esxcli storage san iscsi list |grep UID
       UID: iscsi.vmhba64
    
    esxcli storage fc iscsi list
    esxcli storage san fc list |grep -E 'Node Name:|Port Name'
    

    query SCSI devices

    #List the devices currently registered with the PSA.
    esxcli storage core device list
    #List the SCSI stats for SCSI Devices in the system
    esxcli storage core device stats get
    
    
    #List all the SCSI paths on the system.
    esxcli storage core path list
    #List the SCSI stats for the SCSI Paths in the system.
    esxcli storage core path stats get
    
  • chrony 同步系统时间

    chrony 配置文件使用腾讯外网ntp

    grep tencent /etc/chrony.conf  -A 2 -B 2
    # Use public servers from the pool.ntp.org project.
    # Please consider joining the pool (http://www.pool.ntp.org/join.html).
    server ntp1.tencent.com iburst
    server ntp2.tencent.com iburst
    server ntp3.tencent.com iburst
    server ntp4.tencent.com iburst
    server ntp5.tencent.com iburst
    
    # Record the rate at which the system clock gains/losses time.
    

    (more…)

  • Http Headers 文档地址

    HTTP 标头(header)允许客户端和服务器通过 HTTP 请求(request)或者响应(response)传递附加信息。

    一个 HTTP 标头由它的名称(不区分大小写)后跟随一个冒号(:),冒号后跟随它具体的值。

    http 请求头 快速查询.