ubuntu 磁盘扩容
系统版本
root@sgj-jhdsj-elkserver3:~# cat /proc/version
Linux version 5.4.0-67-generic (buildd@lcy01-amd64-025) (gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)) #75-Ubuntu SMP Fri Feb 19 18:03:38 UTC 2021
扩容
root@sgj-jhdsj-elkserver3:~# df -hT
Filesystem Type Size Used Avail Use% Mounted on
udev devtmpfs 32G 0 32G 0% /dev
tmpfs tmpfs 6.3G 1.2M 6.3G 1% /run
/dev/vda2 ext4 79G 9.0G 66G 12% /
tmpfs tmpfs 32G 17M 32G 1% /dev/shm
tmpfs tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs tmpfs 32G 0 32G 0% /sys/fs/cgroup
/dev/mapper/vg1-lv1 ext4 492G 421G 46G 91% /inspur
tmpfs tmpfs 6.3G 0 6.3G 0% /run/user/0
root@sgj-jhdsj-elkserver3:~#
root@sgj-jhdsj-elkserver3:~#
root@sgj-jhdsj-elkserver3:~#
root@sgj-jhdsj-elkserver3:~#
root@sgj-jhdsj-elkserver3:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 378K 0 rom
vda 252:0 0 80G 0 disk
├─vda1 252:1 0 1M 0 part
└─vda2 252:2 0 80G 0 part /
vdb 252:16 0 500G 0 disk
└─vg1-lv1 253:0 0 500G 0 lvm /inspur
vdc 252:32 0 500G 0 disk
root@sgj-jhdsj-elkserver3:~# pvcreate /dev/vdc
Physical volume "/dev/vdc" successfully created.
root@sgj-jhdsj-elkserver3:~# vgextend vg1 /dev/vdc
Volume group "vg1" successfully extended
root@sgj-jhdsj-elkserver3:~# lvextend -L 490G -n lv1 vg1
Please specify a logical volume path.
Run `lvextend --help' for more information.
root@sgj-jhdsj-elkserver3:~# lvextend -l +100%FREE /dev/vg1/lv1
Size of logical volume vg1/lv1 changed from <500.00 GiB (127999 extents) to 999.99 GiB (255998 extents).
Logical volume vg1/lv1 successfully resized.
root@sgj-jhdsj-elkserver3:~#
root@sgj-jhdsj-elkserver3:~# resize2fs /dev/mapper/vg1-lv1
resize2fs 1.45.5 (07-Jan-2020)
Filesystem at /dev/mapper/vg1-lv1 is mounted on /inspur; on-line resizing required
old_desc_blocks = 63, new_desc_blocks = 125
The filesystem on /dev/mapper/vg1-lv1 is now 262141952 (4k) blocks long.
root@sgj-jhdsj-elkserver3:~# df -h
Filesystem Size Used Avail Use% Mounted on
udev 32G 0 32G 0% /dev
tmpfs 6.3G 1.2M 6.3G 1% /run
/dev/vda2 79G 9.0G 66G 12% /
tmpfs 32G 17M 32G 1% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 32G 0 32G 0% /sys/fs/cgroup
/dev/mapper/vg1-lv1 984G 421G 518G 45% /inspur
tmpfs 6.3G 0 6.3G 0% /run/user/0