如何调整LV磁盘分区大小

这次新上架一个KT服务器,官方技术还是把根目录只分区了20G,按照普通用户的习惯,所有资料都放根目录,显然空间是不够的。利用lvresize命令,可以调整LV逻辑卷大小,调整完毕后,用resize2fs更新下文件系统大小,就可以了。具体可以参考下面的操作过程。

[root@SAT18-C53-5 /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rootvg-rootlv
20G 2.0G 17G 11% /
tmpfs 1.9G 0 1.9G 0% /dev/shm
/dev/sda1 239M 33M 194M 15% /boot
/dev/mapper/rootvg-tmplv
2.9G 12M 2.8G 1% /tmp
/dev/mapper/rootvg-usrlv
20G 1.2G 18G 7% /usr
/dev/mapper/rootvg-varlv
4.8G 148M 4.5G 4% /var

lvresize -l +13232 /dev/rootvg/rootlv

[root@SAT18-C53-5 /]# lvresize -l +13232 /dev/rootvg/rootlv
Size of logical volume rootvg/rootlv changed from 20.00 GiB (640 extents) to 433.50 GiB (13872 extents).
Logical volume rootlv successfully resized

resize2fs /dev/rootvg/rootlv

[root@SAT18-C53-5 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rootvg-rootlv
427G 2.4G 403G 1% /
tmpfs 1.9G 0 1.9G 0% /dev/shm
/dev/sda1 239M 33M 194M 15% /boot
/dev/mapper/rootvg-tmplv
2.9G 12M 2.8G 1% /tmp
/dev/mapper/rootvg-usrlv
20G 1.2G 18G 7% /usr
/dev/mapper/rootvg-varlv
4.8G 151M 4.4G 4% /var

附上pvdisplay,vgdisplay,lvdispaly信息:

[root@SAT18-C53-5 /]# pvdisplay
— Physical volume —
PV Name /dev/sda2
VG Name rootvg
PV Size 465.52 GiB / not usable 17.00 MiB
Allocatable yes
PE Size 32.00 MiB
Total PE 14896
Free PE 13232
Allocated PE 1664
PV UUID THHXVu-M77Z-aslq-VLcd-Fe8t-OIPK-HDLxeY

[root@SAT18-C53-5 /]# vgdisplay
— Volume group —
VG Name rootvg
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 6
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 5
Open LV 5
Max PV 0
Cur PV 1
Act PV 1
VG Size 465.50 GiB
PE Size 32.00 MiB
Total PE 14896
Alloc PE / Size 1664 / 52.00 GiB
Free PE / Size 13232 / 413.50 GiB
VG UUID 8s501K-JV62-eEQv-mZH8-8Epp-lf88-16D6jZ

[root@SAT18-C53-5 /]# lvdisplay
— Logical volume —
LV Path /dev/rootvg/rootlv
LV Name rootlv
VG Name rootvg
LV UUID FsZy2U-JyWT-1ycw-hT19-Ufz1-kuL6-eWj9Ny
LV Write Access read/write
LV Creation host, time SAT18-C53-5, 2016-06-12 13:39:09 +0800
LV Status available
# open 1
LV Size 20.00 GiB
Current LE 640
Segments 1
Allocation inherit
Read ahead sectors auto
– currently set to 256
Block device 253:0

— Logical volume —
LV Path /dev/rootvg/swaplv
LV Name swaplv
VG Name rootvg
LV UUID j5qMLr-J6al-OQoZ-3zBV-LiWL-BF7Q-6rLfyN
LV Write Access read/write
LV Creation host, time SAT18-C53-5, 2016-06-12 13:39:19 +0800
LV Status available
# open 1
LV Size 4.00 GiB
Current LE 128
Segments 1
Allocation inherit
Read ahead sectors auto
– currently set to 256
Block device 253:1

— Logical volume —
LV Path /dev/rootvg/tmplv
LV Name tmplv
VG Name rootvg
LV UUID lFwGNq-evgw-wRCM-0B6w-y3c1-UNJd-uHJVdZ
LV Write Access read/write
LV Creation host, time SAT18-C53-5, 2016-06-12 13:39:22 +0800
LV Status available
# open 1
LV Size 3.00 GiB
Current LE 96
Segments 1
Allocation inherit
Read ahead sectors auto
– currently set to 256
Block device 253:2

— Logical volume —
LV Path /dev/rootvg/usrlv
LV Name usrlv
VG Name rootvg
LV UUID hXnIp8-rE0K-B11w-QcD6-Kter-Arkq-ATi5Ji
LV Write Access read/write
LV Creation host, time SAT18-C53-5, 2016-06-12 13:39:26 +0800
LV Status available
# open 1
LV Size 20.00 GiB
Current LE 640
Segments 1
Allocation inherit
Read ahead sectors auto
– currently set to 256
Block device 253:3

— Logical volume —
LV Path /dev/rootvg/varlv
LV Name varlv
VG Name rootvg
LV UUID aUhRSe-GTrz-mA6o-3Wz0-s0kW-oVZc-G7g24q
LV Write Access read/write
LV Creation host, time SAT18-C53-5, 2016-06-12 13:39:37 +0800
LV Status available
# open 1
LV Size 5.00 GiB
Current LE 160
Segments 1
Allocation inherit
Read ahead sectors auto
– currently set to 256
Block device 253:4

 

《如何调整LV磁盘分区大小》上有1条评论

发表评论

电子邮件地址不会被公开。 必填项已用*标注