Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
83 views

Resize Disk Linux

The document shows commands used to extend an LVM volume group and logical volume on a Linux system. It starts by creating a physical volume on /dev/sda3, extends the existing volume group centos to include it, and then extends the logical volume centos/root into the new space. It resizes the filesystem on centos/root to use the entire extended logical volume size.
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
83 views

Resize Disk Linux

The document shows commands used to extend an LVM volume group and logical volume on a Linux system. It starts by creating a physical volume on /dev/sda3, extends the existing volume group centos to include it, and then extends the logical volume centos/root into the new space. It resizes the filesystem on centos/root to use the entire extended logical volume size.
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

[root@localhost ~]# pvcreate /dev/sda3

Physical volume "/dev/sda3" successfully created.


[root@localhost ~]# vgdisplay
--- Volume group ---
VG Name centos
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
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 <15.51 GiB
PE Size 4.00 MiB
Total PE 3970
Alloc PE / Size 3970 / <15.51 GiB
Free PE / Size 0 / 0
VG UUID i334Gl-5cET-mc05-keyv-ydKo-0xeg-eZJCaU

[root@localhost ~]# vgextend centos /dev/sda3


Volume group "centos" successfully extended
[root@localhost ~]# pvscan
PV /dev/sda2 VG centos lvm2 [<15.51 GiB / 0 free]
PV /dev/sda3 VG centos lvm2 [<44.00 GiB / <44.00 GiB free]
Total: 2 [59.50 GiB] / in use: 2 [59.50 GiB] / in no VG: 0 [0 ]
[root@localhost ~]# lvdisplay
--- Logical volume ---
LV Path /dev/centos/swap
LV Name swap
VG Name centos
LV UUID Y9GeJo-p7dp-k3z5-12UP-8F6c-i34W-zFJX9C
LV Write Access read/write
LV Creation host, time localhost, 2020-11-18 16:45:05 +0700
LV Status available
# open 2
LV Size <3.91 GiB
Current LE 1000
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:1

--- Logical volume ---


LV Path /dev/centos/root
LV Name root
VG Name centos
LV UUID sJrdq8-uGfL-OsD0-9nFb-irx0-APLT-k2SBUB
LV Write Access read/write
LV Creation host, time localhost, 2020-11-18 16:45:06 +0700
LV Status available
# open 1
LV Size 11.60 GiB
Current LE 2970
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0

[root@localhost ~]# lvextend /dev/centos/root /dev/sda3


Size of logical volume centos/root changed from 11.60 GiB (2970 extents) to <5
5.60 GiB (14233 extents).
Logical volume centos/root successfully resized.
[root@localhost ~]# resize2fs /dev/centos/root
resize2fs 1.42.9 (28-Dec-2013)
resize2fs: Bad magic number in super-block while trying to open /dev/centos/root
Couldn't find valid filesystem superblock.
[root@localhost ~]# xfs_growfs /dev/centos/root
meta-data=/dev/mapper/centos-root isize=512 agcount=4, agsize=760320 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=3041280, 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 3041280 to 14574592
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 2.9G 0 2.9G 0% /dev
tmpfs 2.9G 0 2.9G 0% /dev/shm
tmpfs 2.9G 8.9M 2.9G 1% /run
tmpfs 2.9G 0 2.9G 0% /sys/fs/cgroup
/dev/mapper/centos-root 56G 5.8G 50G 11% /
/dev/sda1 497M 179M 318M 37% /boot
tmpfs 581M 0 581M 0% /run/user/1000

You might also like