Linux VM 내부의 크기 조정 가능한 디스크 파티션

Linux VM 내부의 크기 조정 가능한 디스크 파티션

내 가상 머신 Ubuntu 내부의 디스크 크기를 늘리려고 합니다. 나는 다음과 같은 일련의 명령을 사용했습니다.

echo 1 > /sys/block/sda/device/rescan
fdisk /dev/sda
Command (m for help): d
Partition number (1,2, default 2): 2
Command (m for help): n
Select (default p): p

이제 다음 내용이 표시됩니다.

root@proj:~# parted
GNU Parted 3.2
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
Model: Msft Virtual Disk (scsi)
Disk /dev/sda: 85,9GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name  Flags
 1      1049kB  2097kB  1049kB                     bios_grub
 2      2097kB  85,9GB  85,9GB  ext4

(parted)

fdisk

root@proj:~# fdisk /dev/sda

Welcome to fdisk (util-linux 2.31.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/sda: 80 GiB, 85899345920 bytes, 167772160 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 615AE39E-D8BF-41FC-823C-99CDF4CBAEDF

Device     Start       End   Sectors Size Type
/dev/sda1   2048      4095      2048   1M BIOS boot
/dev/sda2   4096 167772126 167768031  80G Linux filesystem

Command (m for help):

Webmin을 사용하여 서버를 관리하고 재부팅한 후에도 계속해서 다음과 같이 말합니다.

Mounted As     Type     Free            Total       Device ID
 /              ext4    41% (15.70 GB)  38.37 GB    UUID=1f76306d-c5e9-45d8-ae14-923bb1114c16


Local disk space 22.67 GB used / 15.70 GB free / 38.37 GB total

저는 이러한 문제를 처음 접했습니다. 이해하도록 도와주세요. 제 실수가 무엇입니까?

답변1

파티션을 더 크게 만드는 것은 운영 체제에서 사용할 수 있는 공간을 만드는 데 필요한 단계이지만 충분하지는 않습니다. 또한 파티션의 원시 공간을 파일, 디렉터리, 권한 등을 저장하는 데 사용할 수 있게 만드는 알고리즘인 파일 시스템의 메타데이터를 수정해야 합니다.

제공된 세부 정보를 고려할 때 실행해야 할 가능성이 가장 높은 명령은 다음과 같습니다.

resize2fs /dev/sda2

관련 정보