RHEL 7 - Extend root filesystem (type xfs)
# fdisk -l
Disk /dev/sdb: 5368 MB, 5368709120 bytes
# fdisk /dev/sdb
Command (m for help): n (new)
Select (default p): p (primary)
Partition number (1-4, default 1): 1 (choose default 1)
Partition 1 of type Linux and of size 5 GiB is set
Command (m for help): t (change type)
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'
Command (m for help): w
The partition table has been altered!
# pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created.
# vgextend rhel /dev/sdb1
Volume group "rhel" successfully extended
# vgdisplay rhel
Free PE / Size 1279 / <5.00 GiB
# pvscan
PV /dev/sda2 VG rhel lvm2 [<7.00 GiB / 0 free]
PV /dev/sdb1 VG rhel lvm2 [<5.00 GiB / <5.00 GiB free]
Total: 2 [11.99 GiB] / in use: 2 [11.99 GiB] / in no VG: 0 [0 ]
# lvextend /dev/rhel/root /dev/sdb1
Size of logical volume rhel/root changed from <6.20 GiB (1586 extents) to 11.19 GiB (2865 extents).
Logical volume rhel/root successfully resized.
# xfs_growfs /dev/rhel/root
data blocks changed from 1624064 to 2933760
# df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rhel-root 12G 5.6G 5.6G 50% /
Disk /dev/sdb: 5368 MB, 5368709120 bytes
# fdisk /dev/sdb
Command (m for help): n (new)
Select (default p): p (primary)
Partition number (1-4, default 1): 1 (choose default 1)
Partition 1 of type Linux and of size 5 GiB is set
Command (m for help): t (change type)
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'
Command (m for help): w
The partition table has been altered!
# pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created.
# vgextend rhel /dev/sdb1
Volume group "rhel" successfully extended
# vgdisplay rhel
Free PE / Size 1279 / <5.00 GiB
# pvscan
PV /dev/sda2 VG rhel lvm2 [<7.00 GiB / 0 free]
PV /dev/sdb1 VG rhel lvm2 [<5.00 GiB / <5.00 GiB free]
Total: 2 [11.99 GiB] / in use: 2 [11.99 GiB] / in no VG: 0 [0 ]
# lvextend /dev/rhel/root /dev/sdb1
Size of logical volume rhel/root changed from <6.20 GiB (1586 extents) to 11.19 GiB (2865 extents).
Logical volume rhel/root successfully resized.
# xfs_growfs /dev/rhel/root
data blocks changed from 1624064 to 2933760
# df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rhel-root 12G 5.6G 5.6G 50% /
1 Comments:
Extend root fs type ext4 with new /dev/sdb 10gb
--
fdisk -l
fdisk /dev/sdb
--new primary partition, type 8e
pvcreate /dev/sdb1
vgextend rhel /dev/sdb1
lvextend /dev/rhel/root /dev/sdb1
resize2fs /dev/mapper/rhel-root
df -h
Post a Comment
<< Home