Tech/Linux

Linux Filesystem resize

항상초보 2021. 3. 2. 10:24
반응형

다음은 리눅스 filesystem을 변경하는 절차입니다.

  • KVM 에 설치된 VM을 기준으로 작성
  • CentOS Linux release 7.8.2003 (Core)

1) 디스크 용량 리사이즈

qemu-img resize vmdisk.img +10G

2) 파티션 번호 확인

sudo parted /dev/vda 'print'
[root@monitoring ~]# sudo parted /dev/vda 'print'
Model: Virtio Block Device (virtblk)
Disk /dev/vda: 322GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  1075MB  1074MB  primary  xfs          boot
 2      1075MB  322GB   321GB   primary  xfs

3) growpart로 해당 파티션 설정

#growpart /dev/vda 2
[root@monitoring ~]# growpart /dev/vda 2
CHANGED: partition=2 start=2099200 old: size=417331200 end=419430400 new: size=627046367 end=629145567

4) 파티션에 용량 설정 추가

#xfs_growfs /dev/vda2
[root@monitoring ~]# xfs_growfs /dev/vda2
meta-data=/dev/vda2              isize=512    agcount=4, agsize=13041600 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=52166400, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=25471, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 52166400 to 78380795

5) 반영됐는지 확인

#df -h
[root@monitoring ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        7.8G     0  7.8G   0% /dev
tmpfs           7.8G     0  7.8G   0% /dev/shm
tmpfs           7.8G  8.6M  7.8G   1% /run
tmpfs           7.8G     0  7.8G   0% /sys/fs/cgroup
/dev/vda2       299G  190G  110G  64% /
/dev/vda1      1014M  142M  873M  14% /boot
tmpfs           1.6G     0  1.6G   0% /run/user/0
반응형

'Tech > Linux' 카테고리의 다른 글

ubuntu 20.04 한영변환  (0) 2022.03.08
ubuntu 20.04 ip address setting  (0) 2022.03.07
Install Chrome on Ubuntu 20.04  (0) 2022.03.04
Ubuntu network 이름 수정  (0) 2021.03.11