How to extend or grow lvm partition in linux with lvextend command
1.Tambah storage vm
2.resize storage dengan Gparted
3.Mounting storage ke direktori root
Resizing the file system size is an important task of Linux admin’s profile. In Linux , LVM(Logical Volume Manager) provides the facility to increase and reduce the file system size. In this tutorial we will discuss the practical examples of lvextend.
Scenario : Suppose we have a LVM partition(/home) and running out of space, we can increase the size of the file system if volume group has free space. Use the below steps :
Step:1 Type ‘ df -h’ command to list the file system
Step:2 Now check the free available space in the Volume group
# vgdisplay < Volume-Group-Name>
Step:3 Use lvextend command to increase the size.
Above command will extend the file system size by 2GB. You can also specify the size in MB , just replace G with M.
Step:3 Run the resize2fs command
resize2fs utk partisi ext4
xfs_growfs utk partisi xfs
Step:4 Use df command and verify /home size .
Read Also : How to setup thin Provisioned Logical Volumes in CentOS 7 / RHEL 7
------------------------------------------------------------------------------------------------
[root@localhost ~]# vgdisplay
--- Volume group ---
VG Name rhel
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size <99,00 GiB
PE Size 4,00 MiB
Total PE 25343
Alloc PE / Size 4863 / <19,00 GiB
Free PE / Size 20480 / 80,00 GiB
VG UUID hFvtdw-JKCX-0eQc-qBsc-eD53-UGWK-Vc9Qzv
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rhel-root 17G 16G 1,4G 92% /
devtmpfs 1,9G 0 1,9G 0% /dev
tmpfs 1,9G 4,0K 1,9G 1% /dev/shm
tmpfs 1,9G 9,8M 1,9G 1% /run
tmpfs 1,9G 0 1,9G 0% /sys/fs/cgroup
/dev/sda1 1014M 170M 845M 17% /boot
tmpfs 380M 4,0K 380M 1% /run/user/42
tmpfs 380M 36K 379M 1% /run/user/0
[root@localhost ~]# lvextend -L +80G /dev/mapper/rhel-root
Size of logical volume rhel/root changed from <17,00 GiB (4351 extents) to <97,00 GiB (24831 extents).
Logical volume rhel/root successfully resized.
[root@localhost ~]# xfs_growfs /dev/mapper/rhel-root
meta-data=/dev/mapper/rhel-root isize=512 agcount=4, agsize=1113856 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=4455424, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 4455424 to 25426944
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rhel-root 97G 16G 82G 17% /
devtmpfs 1,9G 0 1,9G 0% /dev
tmpfs 1,9G 4,0K 1,9G 1% /dev/shm
tmpfs 1,9G 9,8M 1,9G 1% /run
tmpfs 1,9G 0 1,9G 0% /sys/fs/cgroup
/dev/sda1 1014M 170M 845M 17% /boot
tmpfs 380M 4,0K 380M 1% /run/user/42
tmpfs 380M 40K 379M 1% /run/user/0
[root@localhost ~]#
------------------------------------------------------------------------------------------------
[root@localhost ~]# vgdisplay
--- Volume group ---
VG Name rhel
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size <99,00 GiB
PE Size 4,00 MiB
Total PE 25343
Alloc PE / Size 4863 / <19,00 GiB
Free PE / Size 20480 / 80,00 GiB
VG UUID hFvtdw-JKCX-0eQc-qBsc-eD53-UGWK-Vc9Qzv
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rhel-root 17G 16G 1,4G 92% /
devtmpfs 1,9G 0 1,9G 0% /dev
tmpfs 1,9G 4,0K 1,9G 1% /dev/shm
tmpfs 1,9G 9,8M 1,9G 1% /run
tmpfs 1,9G 0 1,9G 0% /sys/fs/cgroup
/dev/sda1 1014M 170M 845M 17% /boot
tmpfs 380M 4,0K 380M 1% /run/user/42
tmpfs 380M 36K 379M 1% /run/user/0
[root@localhost ~]# lvextend -L +80G /dev/mapper/rhel-root
Size of logical volume rhel/root changed from <17,00 GiB (4351 extents) to <97,00 GiB (24831 extents).
Logical volume rhel/root successfully resized.
[root@localhost ~]# xfs_growfs /dev/mapper/rhel-root
meta-data=/dev/mapper/rhel-root isize=512 agcount=4, agsize=1113856 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=4455424, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 4455424 to 25426944
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rhel-root 97G 16G 82G 17% /
devtmpfs 1,9G 0 1,9G 0% /dev
tmpfs 1,9G 4,0K 1,9G 1% /dev/shm
tmpfs 1,9G 9,8M 1,9G 1% /run
tmpfs 1,9G 0 1,9G 0% /sys/fs/cgroup
/dev/sda1 1014M 170M 845M 17% /boot
tmpfs 380M 4,0K 380M 1% /run/user/42
tmpfs 380M 40K 379M 1% /run/user/0
[root@localhost ~]#
Tidak ada komentar:
Posting Komentar