[Ubuntu] Disk 확장

Alexandria·2024년 3월 1일

Ubuntu

목록 보기
7/11
post-thumbnail

1. Disk 확장

현재 디스크 용량을 확인해보면 ubuntu--vg-ubuntu--lv에 19G가 잡혀있다.

# df -h
Filesystem                         Size  Used Avail Use% Mounted on
udev                               1.9G     0  1.9G   0% /dev
tmpfs                              391M  1.5M  389M   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv   19G  9.3G  8.4G  53% /
...

sda의 크기를 늘릴것이다.

# parted /dev/sda
GNU Parted 3.3
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)

파티션을 확인한다.

(parted) print free
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sda: 64.4GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name  Flags
        17.4kB  1049kB  1031kB  Free Space
 1      1049kB  2097kB  1049kB                     bios_grub
 2      2097kB  1076MB  1074MB  ext4
 3      1076MB  21.5GB  20.4GB
        21.5GB  64.4GB  43.0GB  Free Space

확장한 디스크만큼 늘려준다.

(parted) resizepart 3
End?  [21.5GB]? 100%
(parted) print free
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sda: 64.4GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name  Flags
        17.4kB  1049kB  1031kB  Free Space
 1      1049kB  2097kB  1049kB                     bios_grub
 2      2097kB  1076MB  1074MB  ext4
 3      1076MB  64.4GB  63.3GB

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

적용 후 확인해본다.

# pvresize /dev/sda3
  Physical volume "/dev/sda3" changed
  1 physical volume(s) resized or updated / 0 physical volume(s) not resized
# lvextend -r -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
  Size of logical volume ubuntu-vg/ubuntu-lv changed from <19.00 GiB (4863 extents) to <59.00 GiB (15103 extents).
  Logical volume ubuntu-vg/ubuntu-lv successfully resized.
resize2fs 1.45.5 (07-Jan-2020)
Filesystem at /dev/mapper/ubuntu--vg-ubuntu--lv is mounted on /; on-line resizing required
old_desc_blocks = 3, new_desc_blocks = 8
The filesystem on /dev/mapper/ubuntu--vg-ubuntu--lv is now 15465472 (4k) blocks long.

# df -h
Filesystem                         Size  Used Avail Use% Mounted on
udev                               1.9G     0  1.9G   0% /dev
tmpfs                              391M  1.6M  389M   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv   58G  9.6G   46G  18% /
...

ubuntu--vg-ubuntu--lv가 아닐때

# resize2fs /dev/sda2
# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2        79G   27G   49G  36% /
profile
IT 도서관

0개의 댓글