Extend Linux root partition
This article lead you How to Extend Linux root Partition [root@62 ~]# parted /dev/sda GNU Parted 3.1 Using /dev/sda Welcome to GNU Parted! Type ‘help’ to view a list of commands. (parted) print Model: QEMU QEMU HARDDISK (scsi) Disk /dev/sda: 215GB Sector size (logical/physical): 512B/512B Partition Table: msdos Disk Flags: Number Start End Size Type File system Flags1 1049kB 1075MB 1074MB primary xfs boot2 1075MB 107GB 106GB primary lvm resizepart 2 100% print (parted) resizepart 2 100% (parted) print Model: QEMU QEMU HARDDISK (scsi) Disk /dev/sda: 215GB Sector size (logical/physical): 512B/512B Partition Table: msdos Disk Flags: Number Start End Size Type File system Flags1 1049kB 1075MB 1074MB primary xfs boot2 1075MB 215GB 214GB primary lvm (parted) quitInformation: You may need to update /etc/fstab. Show current disk at VM [root@62 ~]# df -h Filesystem Size Used Avail Use% Mounted ondevtmpfs 2.8G 0 2.8G 0% /devtmpfs 2.8G 0 2.8G 0% /dev/shmtmpfs 2.8G 273M 2.6G 10% /runtmpfs 2.8G 0 2.8G 0% /sys/fs/cgroup/dev/mapper/centos-root 93G 7.1G 86G 8% //dev/sda1 1014M 150M 865M 15% /boot/dev/loop0 3.9G 8.4M 3.7G 1% /tmptmpfs 571M 0 571M 0% /run/user/0 show current Phisycal Volume [root@62 ~]# pvdisplay — Physical volume — PV Name /dev/sda2 VG Name centos PV Size <98.76 GiB / not usable 3.00 MiB Allocatable yes PE Size 4.00 MiB Total PE 25281 Free PE 1 Allocated PE 25280 PV UUID lQWYWH-bMEf-QHpS-xEej-B9G0-su0v-Vj8as7 Resize Phisycal Volume [root@62 ~]# pvresize /dev/sda2 Physical volume “/dev/sda2” changed 1 physical volume(s) resized or updated / 0 physical volume(s) not resized [root@62 ~]# pvdisplay — Physical volume — PV Name /dev/sda2 VG Name centos PV Size <199.00 GiB / not usable 2.00 MiB Allocatable yes PE Size 4.00 MiB Total PE 50943 Free PE 25663 Allocated PE 25280 PV UUID lQWYWH-bMEf-QHpS-xEej-B9G0-su0v-Vj8as7 Resize Logical Volume [root@62 ~]# lvresize –extents +100%FREE –resizefs /dev/centos/root Size of logical volume centos/root changed from 93.00 GiB (23808 extents) to <193.25 GiB (49471 extents). Logical volume centos/root successfully resized. meta-data=/dev/mapper/centos-root isize=512 agcount=4, agsize=6094848 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=0 spinodes=0 data = bsize=4096 blocks=24379392, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 ftype=1 log =internal bsize=4096 blocks=11904, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 data blocks changed from 24379392 to 50658304 Now check the updated extended disk space using this command.show current disk [root@62 ~]# df -Th Filesystem Type Size Used Avail Use% Mounted on devtmpfs devtmpfs 2.8G 0 2.8G 0% /dev tmpfs tmpfs 2.8G 0 2.8G 0% /dev/shm tmpfs tmpfs 2.8G 273M 2.6G 10% /run tmpfs tmpfs 2.8G 0 2.8G 0% /sys/fs/cgroup /dev/mapper/centos-root xfs 194G 7.1G 187G 4% / /dev/sda1 xfs 1014M 150M 865M 15% /boot /dev/loop0 ext4 3.9G 8.4M 3.7G 1% /tmp tmpfs tmpfs 571M 0 571M 0% /run/user/0 disk partition centos-root mapper now changed from 400 GB to 800 GB !!! Yahoo! You can watch this video tutorial for better understand.
Extend Linux root partition Read More »