1,多块硬盘配置LVM,挂载到一个目录
apt install lvm2 -y
- 格式化磁盘
# mkfs.ext4 /dev/sdb
pvcreate
# pvcreate /dev/sda /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf
WARNING: ext4 signature detected on /dev/sda at offset 1080. Wipe it? [y/n]: y
Wiping ext4 signature on /dev/sda.
WARNING: ext4 signature detected on /dev/sdb at offset 1080. Wipe it? [y/n]: y
Wiping ext4 signature on /dev/sdb.
WARNING: ext4 signature detected on /dev/sdc at offset 1080. Wipe it? [y/n]: y
Wiping ext4 signature on /dev/sdc.
WARNING: ext4 signature detected on /dev/sdd at offset 1080. Wipe it? [y/n]: y
Wiping ext4 signature on /dev/sdd.
WARNING: ext4 signature detected on /dev/sde at offset 1080. Wipe it? [y/n]: u^Hy
WARNING: Invalid input 'uy'.
WARNING: ext4 signature detected on /dev/sde at offset 1080. Wipe it? [y/n]: y
Wiping ext4 signature on /dev/sde.
WARNING: ext4 signature detected on /dev/sdf at offset 1080. Wipe it? [y/n]: y
Wiping ext4 signature on /dev/sdf.
Physical volume "/dev/sda" successfully created.
Physical volume "/dev/sdb" successfully created.
Physical volume "/dev/sdc" successfully created.
Physical volume "/dev/sdd" successfully created.
Physical volume "/dev/sde" successfully created.
Physical volume "/dev/sdf" successfully created.
# lvmdiskscan | grep LVM
/dev/sda [ <2.73 TiB] LVM physical volume
/dev/sdb [ <2.73 TiB] LVM physical volume
/dev/sdc [ <2.73 TiB] LVM physical volume
/dev/sdd [ <2.73 TiB] LVM physical volume
/dev/sde [ <2.73 TiB] LVM physical volume
/dev/sdf [ <2.73 TiB] LVM physical volume
6 LVM physical volume whole disks
0 LVM physical volumes
vgcreate
# vgcreate lvm_01 /dev/sda /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf
Volume group "lvm_01" successfully created
# vgs
VG #PV #LV #SN Attr VSize VFree
lvm_01 6 0 0 wz--n- 16.37t 16.37t
vcreate
# lvcreate -L 16T -n lv01 lvm_01
Logical volume "lv01" created.
# vgs
VG #PV #LV #SN Attr VSize VFree
lvm_01 6 1 0 wz--n- 16.37t 383.09g
# lvdisplay
--- Logical volume ---
LV Path /dev/lvm_01/lv01
LV Name lv01
VG Name lvm_01
LV UUID nQbqTL-CQqk-fhHJ-77Bm-a1ap-aGbM-66LkF6
LV Write Access read/write
LV Creation host, time 049, 2019-11-05 21:34:06 +0800
LV Status available
# open 0
LV Size 16.00 TiB
Current LE 4194304
Segments 6
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
- 格式化
mkfs.ext4 /dev/lvm_01/lv01
- 挂载目录
# mkdir /storage
# mount /dev/lvm_01/lv01 /storage/
2,重启,无法正常启动
- 报错
you are in emergency mode. after logging in type
- 可以登陆root,修改
vim /etc/fstab
,把除了系统硬盘,外接的硬盘自动挂载都注释掉,重启启动成功。
3,开机挂载LVM目录
# cat /etc/fstab
/dev/lvm_01/lv01 /storage ext4 defaults 0 0
参考:
1.Linux: lvm使用笔记(开机自动挂载)