Linux

[Linux] 디스크 용량 변경 parted

plastic2113 2023. 10. 17. 10:08
728x90
반응형

1. 디스크 확인

# parted or parted /dev/sda

root@compute:~# parted
GNU Parted 3.3
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p                                                        
Model: ATA QEMU HARDDISK (scsi)
Disk /dev/sda: 107GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name  Flags
14      1049kB  5243kB  4194kB                     bios_grub
15      5243kB  116MB   111MB   fat32              boot, esp
 1      116MB   26.8GB  26.7GB  ext4
반응형

2. 디스크 용량 재설정

(parted) resizepart : 디스크 용량 재설정
partition number? [1] : 파티션 번호 지정
Yes/No? yes : 확인
End? [107GB] : 재설정할 디스크 용량 입력
(parted) p : 확인

(parted) resizepart 
Partition number? 1                                                       
Warning: Partition /dev/sda1 is being used. Are you sure you want to continue?
Yes/No? yes                                                               
End?  [26.8GB]? 107GB                                                     
(parted) p                                                                
Model: ATA QEMU HARDDISK (scsi)
Disk /dev/sda: 107GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name  Flags
14      1049kB  5243kB  4194kB                     bios_grub
15      5243kB  116MB   111MB   fat32              boot, esp
 1      116MB   107GB   107GB   ext4

(parted) q                                                                
Information: You may need to update /etc/fstab.

But, 바로 적용되지 않음! (확인해 보면.. 용량이 그대로)

root@compute:~# df -Th
Filesystem     Type      Size  Used Avail Use% Mounted on
/dev/root      ext4       25G  1.5G   23G   7% /
/dev/sda15     vfat      105M  3.9M  101M   4% /boot/efi
728x90

3. 파일시스템 용량 재설정 resize2fs

resize2fs /dev/sda1 : 용량 재설정할 파티션 지정
df -Th : 재확인 시 적용완료

root@compute:~# resize2fs /dev/sda1
resize2fs 1.45.5 (07-Jan-2020)
Filesystem at /dev/sda1 is mounted on /; on-line resizing required
old_desc_blocks = 4, new_desc_blocks = 13
The filesystem on /dev/sda1 is now 26094631 (4k) blocks long.

root@compute:~# df -Th
Filesystem     Type      Size  Used Avail Use% Mounted on
/dev/root      ext4       97G  1.5G   95G   2% /
/dev/sda15     vfat      105M  3.9M  101M   4% /boot/efi

 

728x90
반응형