• Linux服务器不关机新增硬盘的方法


    在开机状态下,插入磁盘之后,执行如下命令:

     ls /sys/class/scsi_host/
    host0 host1 host2

    echo "- - -" > /sys/class/scsi_host/host0/scan

    echo "- - -" > /sys/class/scsi_host/host1/scan

    echo "- - -" > /sys/class/scsi_host/host2/scan

    查看步骤1的命令是否生效,可以在/var/log/messages中进行验证
    执行fdisk -l命令看是否能看到新增的磁盘,如果看不到,可以把上面的host0换成host1或者host2等再试一次

    fdisk -l

    Disk /dev/sda: 17.2 GB, 17179869184 bytes
    255 heads, 63 sectors/track, 2088 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x000a3a1a

    Device Boot Start End Blocks Id System
    /dev/sda1 * 1 64 512000 83 Linux
    Partition 1 does not end on cylinder boundary.
    /dev/sda2 64 325 2097152 82 Linux swap / Solaris
    Partition 2 does not end on cylinder boundary.
    /dev/sda3 325 2089 14167040 83 Linux

    Disk /dev/sdb: 1073 MB, 1073741824 bytes
    255 heads, 63 sectors/track, 130 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000

    发现已经看到sdb了

    fdisk /dev/sdb

    mkfs.ext4 /dev/sdb1

  • 相关阅读:
    POJ 3126 Prime Path
    POJ 2429 GCD & LCM Inverse
    POJ 2395 Out of Hay
    【Codeforces 105D】 Bag of mice
    【POJ 3071】 Football
    【POJ 2096】 Collecting Bugs
    【CQOI 2009】 余数之和
    【Codeforces 258E】 Devu and Flowers
    【SDOI 2010】 古代猪文
    【BZOJ 2982】 combination
  • 原文地址:https://www.cnblogs.com/chillax1314/p/9962053.html
Copyright © 2020-2023  润新知