1단계 : virtualbox에서 볼륨 확장
2단계 : lsblk 용량확인
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 101G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 79G 0 part
├─cl-linux-root 253:0 0 75G 0 lvm /
└─cl-linux-swap 253:1 0 4G 0 lvm [SWAP]
sr0 11:0 1 1024M 0 rom
3단계 : fdisk
$ fdisk /dev/sda
Welcome to fdisk (util-linux 2.32.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): n
Partition type
p primary (2 primary, 0 extended, 2 free)
e extended (container for logical partitions)
Select (default p):
Using default response p.
Partition number (3,4, default 3): 4
First sector (167772160-211739903, default 167772160):
Last sector, +sectors or +size{K,M,G,T,P} (167772160-211739903, default 211739903):
Created a new partition 4 of type 'Linux' and of size 21 GiB.
Command (m for help): w
The partition table has been altered.
Syncing disks.
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 101G 0 disk
├─sda1 8:1 0 1G 0 part /boot
├─sda2 8:2 0 79G 0 part
│ ├─cl_uptrio--linux-root 253:0 0 75G 0 lvm /
│ └─cl_uptrio--linux-swap 253:1 0 4G 0 lvm [SWAP]
└─sda4 8:4 0 21G 0 part
sr0 11:0 1 1024M 0 rom
4단계: pvscan & pv create
$ pvscan
PV /dev/sda2 VG cl-linux lvm2 [<79.00 GiB / 0 free]
Total: 1 [<79.00 GiB] / in use: 1 [<79.00 GiB] / in no VG: 0 [0 ]
$ pvcreate /dev/sda4
Physical volume "/dev/sda4" successfully created.
$ pvscan
PV /dev/sda2 VG cl-linux lvm2 [<79.00 GiB / 0 free]
PV /dev/sda4 lvm2 [<20.97 GiB]
Total: 2 [99.96 GiB] / in use: 1 [<79.00 GiB] / in no VG: 1 [<20.97 GiB]
5.단계: vgdisplay
$ vgdisplay cl-linux | grep 'VG Size'
VG Size <79.00 GiB
6.단계 : vgextend
$ vgextend cl-linux /dev/sda4
Volume group "cl-linux" successfully extended
$ pvscan
PV /dev/sda2 VG cl-linux lvm2 [<79.00 GiB / 0 free]
PV /dev/sda4 VG cl-linux lvm2 [20.96 GiB / 20.96 GiB free]
Total: 2 [<99.96 GiB] / in use: 2 [<99.96 GiB] / in no VG: 0 [0 ]
$ vgdisplay cl-linux | grep 'VG Size'
VG Size <99.96 GiB
7. lv 확장
$ lvscan
ACTIVE '/dev/cl-linux/root' [<75.04 GiB] inherit
ACTIVE '/dev/cl-linux/swap' [3.96 GiB] inherit
$ lvextend -l +100%FREE -n /dev/cl-linux/root
Size of logical volume cl-linux/root changed from <75.04 GiB (19209 extents) to <96.00 GiB (24575 extents).
Logical volume cl-linux/root successfully resized.
$ lvscan
ACTIVE '/dev/cl-linux/root' [<96.00 GiB] inherit
ACTIVE '/dev/cl-linux/swap' [3.96 GiB] inherit
8. xfs_growfs
$ df | grep linux-root
/dev/mapper/cl--linux-root 78641648 57616276 21025372 74% /
$ xfs_growfs /dev/cl-linux/root
meta-data=/dev/mapper/cl--linux-root isize=512 agcount=4, agsize=4917504 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=1, sparse=1, rmapbt=0
= reflink=1
data = bsize=4096 blocks=19670016, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0, ftype=1
log =internal log bsize=4096 blocks=9604, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 19670016 to 25164800
$ df | grep linux-root
/dev/mapper/cl--linux-root 100620784 57769664 42851120 58% /
728x90
댓글