OS 환경 : Oracle Linux 9.6 (64bit)
방법 : Oracle Linux 9 온라인 디스크 증설 방법
본문에서는 vm과 같은 가상화 환경의 리눅스9에서 디스크를 온라인으로 증설하는 방법에 대해 설명함
/(root) 영역을 기존 92gb에서 추가 100gb를 증가시킬 예정임, 현재 89% 사용중임
참고로 growpart라는 패키지를 사용해서 진행함
테스트
growpart 패키지 설치
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# dnf install -y cloud-utils-growpart
Last metadata expiration check: 0:04:25 ago on Sun 10 May 2026 01:53:21 PM KST.
Dependencies resolved.
===========================================================================================================================================================
Package Architecture Version Repository Size
===========================================================================================================================================================
Installing:
cloud-utils-growpart x86_64 0.33-1.el9 ol9_appstream 38 k
Transaction Summary
===========================================================================================================================================================
Install 1 Package
Total download size: 38 k
Installed size: 75 k
Downloading Packages:
cloud-utils-growpart-0.33-1.el9.x86_64.rpm 58 kB/s | 38 kB 00:00
-----------------------------------------------------------------------------------------------------------------------------------------------------------
Total 58 kB/s | 38 kB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : cloud-utils-growpart-0.33-1.el9.x86_64 1/1
Running scriptlet: cloud-utils-growpart-0.33-1.el9.x86_64 1/1
Verifying : cloud-utils-growpart-0.33-1.el9.x86_64 1/1
Installed:
cloud-utils-growpart-0.33-1.el9.x86_64
Complete!
|
설치됨
디스크 기존 용량 확인
|
1
2
3
4
5
6
7
8
9
|
# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 4.0M 0 4.0M 0% /dev
tmpfs 10G 1.1M 10G 1% /dev/shm
tmpfs 2.4G 9.3M 2.4G 1% /run
/dev/mapper/ol-root 92G 82G 11G 89% /
/dev/sda1 448M 404M 44M 91% /boot
tmpfs 1.2G 52K 1.2G 1% /run/user/42
tmpfs 1.2G 36K 1.2G 1% /run/user/0
|
/(root) 영역을 기존 92gb에서 추가 100gb를 증가시킬 예정임, 현재 89% 사용중임
vm 설정에서 디스크 크기를 100gb에서 200gb로 변경 후 확인
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# fdisk -l
Disk /dev/sda: 100 GiB, 107374182400 bytes, 209715200 sectors
Disk model: Virtual disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x95bec2cc
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 1050623 1048576 512M 83 Linux
/dev/sda2 1050624 209715199 208664576 99.5G 8e Linux LVM
Disk /dev/mapper/ol-root: 91.5 GiB, 98243182592 bytes, 191881216 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/ol-swap: 8 GiB, 8589934592 bytes, 16777216 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
|
아직까지 os가 200gb로 변경된것을 인지 못하고 있음
커널에 디스크 크기 변경 재인식 시킨 후 재확인(sda, sdb 확인 후 수행)
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# echo 1 > /sys/class/block/sda/device/rescan
# fdisk -l
Disk /dev/sda: 200 GiB, 214748364800 bytes, 419430400 sectors
Disk model: Virtual disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x95bec2cc
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 1050623 1048576 512M 83 Linux
/dev/sda2 1050624 209715199 208664576 99.5G 8e Linux LVM <<---!!
Disk /dev/mapper/ol-root: 91.5 GiB, 98243182592 bytes, 191881216 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/ol-swap: 8 GiB, 8589934592 bytes, 16777216 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
|
정상적으로 /dev/sda가 200gib가 됨
파티션 확장
(/dev/sda 디스크의 두번째 파티션인 /dev/sda2를 확장시키기 위해 아래와 같이 입력함)
|
1
2
|
# growpart /dev/sda 2
CHANGED: partition=2 start=1050624 old: size=208664576 end=209715199 new: size=418379743 end=419430366
|
변경됨
참고로 /dev/sda2 다음에 /dev/sda3가 존재하는 경우에는 /dev/sda2의 End 부분을 더 늘릴수 없기 때문에 증설이 불가함
fdisk 재확인
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# fdisk -l
Disk /dev/sda: 200 GiB, 214748364800 bytes, 419430400 sectors
Disk model: Virtual disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x95bec2cc
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 1050623 1048576 512M 83 Linux
/dev/sda2 1050624 419430366 418379743 199.5G 8e Linux LVM <<---!!
Disk /dev/mapper/ol-root: 91.5 GiB, 98243182592 bytes, 191881216 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/ol-swap: 8 GiB, 8589934592 bytes, 16777216 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
|
이제 /dev/sda2가 200gb(199.5g)로 보임
LVM 물리 볼륨(PV) 확장
|
1
2
3
|
# pvresize /dev/sda2
Physical volume "/dev/sda2" changed
1 physical volume(s) resized or updated / 0 physical volume(s) not resized
|
논리 볼륨(LV) 및 파일 시스템 확장
실제로 사용하는 /dev/mapper/ol-root 공간을 늘려줌
참고로 -r 옵션을 쓰면 파일 시스템 확장(xfs_growfs 등)까지 한 번에 처리됨
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# lvextend -r -l +100%FREE /dev/mapper/ol-root
File system xfs found on ol/root mounted at /.
Size of logical volume ol/root changed from <91.50 GiB (23423 extents) to <191.50 GiB (49023 extents).
Extending file system xfs to <191.50 GiB (205617364992 bytes) on ol/root...
xfs_growfs /dev/ol/root
meta-data=/dev/mapper/ol-root isize=512 agcount=4, agsize=5996288 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=1, sparse=1, rmapbt=0
= reflink=1 bigtime=1 inobtcount=1 nrext64=0
data = bsize=4096 blocks=23985152, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0, ftype=1
log =internal log bsize=4096 blocks=16384, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 23985152 to 50199552
xfs_growfs done
Extended file system xfs on ol/root.
Logical volume ol/root successfully resized.
|
df 명령어로 재확인
|
1
2
3
4
5
6
7
8
9
|
# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 4.0M 0 4.0M 0% /dev
tmpfs 10G 1.1M 10G 1% /dev/shm
tmpfs 2.4G 9.3M 2.4G 1% /run
/dev/mapper/ol-root 192G 91G 101G 48% /
/dev/sda1 448M 404M 44M 91% /boot
tmpfs 1.2G 52K 1.2G 1% /run/user/42
tmpfs 1.2G 36K 1.2G 1% /run/user/0
|
정상적으로 92gb에서 192gb로 증설됨, 사용량은 48%로 내려감
결론 :
growpart 패키지를 이용해 vm 환경의 리눅스에서 디스크를 온라인으로 증설할 수 있음
물리 환경도 가능은 하다고 하지만 해보진 않음(multipathd resize map <맵이름> 명령 등)
참조 :
'Linux, Unix > Tip' 카테고리의 다른 글
| Oracle Linux 8 grep 또는 find 명령 특정 단어 들어간 파일 찾기 (0) | 2026.06.11 |
|---|---|
| Oracle Linux 9 oracle asmlib v3 구성 가이드 (0) | 2026.01.09 |
| 리눅스 쉘로 크리스마스 트리 만들기 (0) | 2025.12.24 |
| IBM AIX 7.2 gui xclock 사용 (0) | 2025.11.09 |
| 오라클 리눅스 8 tmux(Terminal Multiplexer) 사용 가이드 (0) | 2025.10.24 |
