服务器sata-raid混用模式下热插拔磁盘扩容

用的是惠普dl360服务器,增加了几块磁盘后,发现ubuntu中看不到。

新增6块:
2块保留sata模式
4块组成raid6

查看物理磁盘信息

lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0    7:0    0     4K  1 loop /snap/bare/5
loop1    7:1    0  63.4M  1 loop /snap/core20/1974
loop2    7:2    0  63.9M  1 loop /snap/core20/2182
loop3    7:3    0  73.9M  1 loop /snap/core22/858
loop4    7:4    0 237.2M  1 loop /snap/firefox/2987
loop5    7:5    0 349.7M  1 loop /snap/gnome-3-38-2004/143
loop6    7:6    0 485.5M  1 loop /snap/gnome-42-2204/120
loop7    7:7    0   497M  1 loop /snap/gnome-42-2204/141
loop8    7:8    0  91.7M  1 loop /snap/gtk-common-themes/1535
loop9    7:9    0  12.3M  1 loop /snap/snap-store/959
loop10   7:10   0  53.3M  1 loop /snap/snapd/19457
loop11   7:11   0  40.4M  1 loop /snap/snapd/20671
loop12   7:12   0   452K  1 loop /snap/snapd-desktop-integration/83
sda      8:0    0   2.2T  0 disk 
sdb      8:16   0 238.5G  0 disk 
├─sdb1   8:17   0   512M  0 part /boot/efi
└─sdb2   8:18   0   238G  0 part /var/snap/firefox/common/host-hunspell
                                 /
sdc      8:32   0 745.2G  0 disk 
sdd      8:48   0 745.2G  0 disk 
sde      8:64   0   512M  1 disk 
└─sde1   8:65   0 509.8M  1 part /media/zcj/VID

格式化

# 格式化成 Ext4
mkfs.ext4 /dev/vdb1
​
# 格式化为 XFS
apt install xfsprogs
mkfs.xfs /dev/vdb2
​
# 格式化为 Btrfs
apt install btrfs-progs
mkfs.btrfs /dev/vdb3

这里我们选择xfs

sudo mkfs.xfs /dev/sdc
meta-data=/dev/sdc               isize=512    agcount=4, agsize=48838262 blks
         =                       sectsz=4096  attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=1, rmapbt=0
         =                       reflink=1    bigtime=0 inobtcount=0
data     =                       bsize=4096   blocks=195353046, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1
log      =internal log           bsize=4096   blocks=95387, version=2
         =                       sectsz=4096  sunit=1 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
Discarding blocks...Done.

临时挂载

普通单xfs 磁盘

mount -t xfs /dev/sdc /disk2

raid磁盘

sudo mkfs.xfs /dev/sda
mkfs.xfs: /dev/sda appears to contain a partition table (gpt).
mkfs.xfs: Use the -f option to force overwrite.

这里提示无法挂载,有gpt分区表,因为确认是新raid,我们选择强制格式化,加-f参数:
sudo mkfs.xfs -f /dev/sda

df -h 查看挂载结果

永久挂载

vim /etc/fstab

/swapfile                                 none            swap    sw              0       0
/dev/sdc        /disk2          xfs     defaults         0       0
/dev/sdd        /disk3           xfs    defaults          0        0

生效查看:
mount -a