Created
April 20, 2021 15:33
-
-
Save deanet/08292b9671e9621cf7c865c3ce469457 to your computer and use it in GitHub Desktop.
Resizing a logical volume in an LVM filesystem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[root@ecoll-v2-mysql-master-01 ~]# umount /home/ | |
[root@ecoll-v2-mysql-master-01 ~]# df -h | |
Filesystem Size Used Avail Use% Mounted on | |
devtmpfs 12G 0 12G 0% /dev | |
tmpfs 12G 0 12G 0% /dev/shm | |
tmpfs 12G 20M 12G 1% /run | |
tmpfs 12G 0 12G 0% /sys/fs/cgroup | |
/dev/mapper/centos-root 50G 45G 5.6G 89% / | |
/dev/sda1 1014M 181M 834M 18% /boot | |
tmpfs 2.3G 0 2.3G 0% /run/user/0 | |
[root@ecoll-v2-mysql-master-01 ~]# lvs | |
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert | |
home centos -wi-a----- 961.49g | |
root centos -wi-ao---- 50.00g | |
swap centos -wi-ao---- 11.50g | |
[root@ecoll-v2-mysql-master-01 ~]# lvremove /dev/centos/home | |
Do you really want to remove active logical volume centos/home? [y/n]: y | |
Logical volume "home" successfully removed | |
[root@ecoll-v2-mysql-master-01 ~]# lvextend -L+930GB /dev/centos/root | |
Size of logical volume centos/root changed from 50.00 GiB (12800 extents) to 980.00 GiB (250880 extents). | |
Logical volume centos/root successfully resized. | |
[root@ecoll-v2-mysql-master-01 ~]# lvs | |
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert | |
root centos -wi-ao---- 980.00g | |
swap centos -wi-ao---- 11.50g | |
[root@ecoll-v2-mysql-master-01 ~]# df -h | |
Filesystem Size Used Avail Use% Mounted on | |
devtmpfs 12G 0 12G 0% /dev | |
tmpfs 12G 0 12G 0% /dev/shm | |
tmpfs 12G 20M 12G 1% /run | |
tmpfs 12G 0 12G 0% /sys/fs/cgroup | |
/dev/mapper/centos-root 50G 45G 5.6G 89% / | |
/dev/sda1 1014M 181M 834M 18% /boot | |
tmpfs 2.3G 0 2.3G 0% /run/user/0 | |
[root@ecoll-v2-mysql-master-01 ~]# lvs^C | |
[root@ecoll-v2-mysql-master-01 ~]# xfs_growfs /dev/mapper/centos-root | |
meta-data=/dev/mapper/centos-root isize=512 agcount=4, agsize=3276800 blks | |
= sectsz=512 attr=2, projid32bit=1 | |
= crc=1 finobt=0 spinodes=0 | |
data = bsize=4096 blocks=13107200, imaxpct=25 | |
= sunit=0 swidth=0 blks | |
naming =version 2 bsize=4096 ascii-ci=0 ftype=1 | |
log =internal bsize=4096 blocks=6400, version=2 | |
= sectsz=512 sunit=0 blks, lazy-count=1 | |
realtime =none extsz=4096 blocks=0, rtextents=0 | |
data blocks changed from 13107200 to 256901120 | |
[root@ecoll-v2-mysql-master-01 ~]# df -h | |
Filesystem Size Used Avail Use% Mounted on | |
devtmpfs 12G 0 12G 0% /dev | |
tmpfs 12G 0 12G 0% /dev/shm | |
tmpfs 12G 20M 12G 1% /run | |
tmpfs 12G 0 12G 0% /sys/fs/cgroup | |
/dev/mapper/centos-root 980G 45G 936G 5% / | |
/dev/sda1 1014M 181M 834M 18% /boot | |
tmpfs 2.3G 0 2.3G 0% /run/user/0 | |
[root@ecoll-v2-mysql-master-01 ~]# lvcreate lvs | |
No command with matching syntax recognised. Run 'lvcreate --help' for more information. | |
[root@ecoll-v2-mysql-master-01 ~]# lvs | |
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert | |
root centos -wi-ao---- 980.00g | |
swap centos -wi-ao---- 11.50g | |
[root@ecoll-v2-mysql-master-01 ~]# lvcreate -n home -L 20G centos | |
Logical volume "home" created. | |
[root@ecoll-v2-mysql-master-01 ~]# lvs | |
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert | |
home centos -wi-a----- 20.00g | |
root centos -wi-ao---- 980.00g | |
swap centos -wi-ao---- 11.50g | |
[root@ecoll-v2-mysql-master-01 ~]# mkfs.ext /dev/centos/home | |
-bash: mkfs.ext: command not found | |
[root@ecoll-v2-mysql-master-01 ~]# mkfs.ext4 /dev/centos/home | |
mke2fs 1.42.9 (28-Dec-2013) | |
Discarding device blocks: done | |
Filesystem label= | |
OS type: Linux | |
Block size=4096 (log=2) | |
Fragment size=4096 (log=2) | |
Stride=0 blocks, Stripe width=0 blocks | |
1310720 inodes, 5242880 blocks | |
262144 blocks (5.00%) reserved for the super user | |
First data block=0 | |
Maximum filesystem blocks=2153775104 | |
160 block groups | |
32768 blocks per group, 32768 fragments per group | |
8192 inodes per group | |
Superblock backups stored on blocks: | |
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, | |
4096000 | |
Allocating group tables: done | |
Writing inode tables: done | |
Creating journal (32768 blocks): done | |
Writing superblocks and filesystem accounting information: done | |
[root@ecoll-v2-mysql-master-01 ~]# df -h | |
Filesystem Size Used Avail Use% Mounted on | |
devtmpfs 12G 0 12G 0% /dev | |
tmpfs 12G 0 12G 0% /dev/shm | |
tmpfs 12G 20M 12G 1% /run | |
tmpfs 12G 0 12G 0% /sys/fs/cgroup | |
/dev/mapper/centos-root 980G 45G 936G 5% / | |
/dev/sda1 1014M 181M 834M 18% /boot | |
tmpfs 2.3G 0 2.3G 0% /run/user/0 | |
tmpfs 2.3G 0 2.3G 0% /run/user/1004 | |
[root@ecoll-v2-mysql-master-01 ~]# mount /dev/centos/home /home/ | |
[root@ecoll-v2-mysql-master-01 ~]# df -h | |
Filesystem Size Used Avail Use% Mounted on | |
devtmpfs 12G 0 12G 0% /dev | |
tmpfs 12G 0 12G 0% /dev/shm | |
tmpfs 12G 20M 12G 1% /run | |
tmpfs 12G 0 12G 0% /sys/fs/cgroup | |
/dev/mapper/centos-root 980G 45G 936G 5% / | |
/dev/sda1 1014M 181M 834M 18% /boot | |
tmpfs 2.3G 0 2.3G 0% /run/user/0 | |
tmpfs 2.3G 0 2.3G 0% /run/user/1004 | |
/dev/mapper/centos-home 20G 45M 19G 1% /home | |
[root@ecoll-v2-mysql-master-01 ~]# logout | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment