1、添加新磁盘
2、fdisk -l查看磁盘被识别的名称
3、如果输入fdisk -l命令没有找到新的磁盘,需要扫描:
root@kali:~# echo "- - -" > /sys/class/scsi_host/host1/scan root@kali:~# echo "- - -" > /sys/class/scsi_host/host2/scan root@kali:~# echo "- - -" > /sys/class/scsi_host/host3/scan
4、创建物理卷
root@kali:~# pvcreate /dev/sdb Physical volume "/dev/sdb" successfully created. root@kali:~# pvs PV VG Fmt Attr PSize PFree /dev/sda5 kali-vg lvm2 a-- <19.76g 0 /dev/sdb lvm2 --- 10.00g 10.00g
5、扩展VG卷组
root@kali:~# vgextend kali-vg /dev/sdb Volume group "kali-vg" successfully extended root@kali:~# vgs VG #PV #LV #SN Attr VSize VFree kali-vg 2 2 0 wz--n- 29.75g <10.00g
6、扩展逻辑卷LVS
root@kali:~# lvextend -L +9G /dev/kali-vg/root Size of logical volume kali-vg/root changed from <19.26 GiB (4930 extents) to <28.26 GiB (7234 extents). Logical volume kali-vg/root successfully resized. root@kali:~# lvs LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert root kali-vg -wi-ao---- <28.26g swap_1 kali-vg -wi-ao---- 512.00m root@kali:~# df -h 文件系统 容量 已用 可用 已用% 挂载点 udev 1.5G 0 1.5G 0% /dev tmpfs 295M 9.0M 286M 4% /run /dev/mapper/kali--vg-root 19G 18G 140M 100% / tmpfs 1.5G 0 1.5G 0% /dev/shm tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs 1.5G 0 1.5G 0% /sys/fs/cgroup /dev/sda1 236M 54M 171M 24% /boot tmpfs 295M 16K 295M 1% /run/user/135 tmpfs 295M 40K 295M 1% /run/user/0 /dev/sr0 56M 56M 0 100% /media/cdrom0
7、同步文件系统
root@kali:~# resize2fs /dev/mapper/kali--vg-root resize2fs 1.44.3 (10-July-2018) Filesystem at /dev/mapper/kali--vg-root is mounted on /; on-line resizing required old_desc_blocks = 3, new_desc_blocks = 4 The filesystem on /dev/mapper/kali--vg-root is now 7407616 (4k) blocks long. root@kali:~# df -h 文件系统 容量 已用 可用 已用% 挂载点 udev 1.5G 0 1.5G 0% /dev tmpfs 295M 9.0M 286M 4% /run /dev/mapper/kali--vg-root 28G 18G 8.7G 68% / tmpfs 1.5G 0 1.5G 0% /dev/shm tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs 1.5G 0 1.5G 0% /sys/fs/cgroup /dev/sda1 236M 54M 171M 24% /boot tmpfs 295M 16K 295M 1% /run/user/135 tmpfs 295M 40K 295M 1% /run/user/0 /dev/sr0 56M 56M 0 100% /media/cdrom0