VMWare Player에서 실행되는 Ubuntu Server의 기본 파티션을 확장하는 방법

VMWare Player에서 실행되는 Ubuntu Server의 기본 파티션을 확장하는 방법

집에서 사용하는 VM에 공간이 부족합니다. Ubuntu 서버를 운영하며 기존 공간은 20G였습니다. 충분한 호흡 공간을 확보하기 위해 100G로 늘리기로 결정했습니다.

그래서 여기 지침을 따랐습니다.http://www.rootusers.com/use-gparted-to-increase-disk-size-of-a-linux-native-partition/

그리고 마지막 단계까지 모든 것이 순조롭게 진행되었습니다. 파티션 크기를 99G로 늘리려는 시도는 /dev/sda1/세 번째 단계에서 실패합니다. '파일 시스템에서 /dev/sda1오류를 확인하고 (가능한 경우) 수정하세요.'

이 단계가 실행을 시도하는 것 같습니다.e2fsck -f -y -v /dev/sda1

다음과 같은 오류가 발생합니다.

슈퍼블록을 읽을 수 없거나 올바른 ext2 파일 시스템을 설명하지 않습니다.

문제의 파티션은 ext3 파티션이지만 그것이 중요한지 확실하지 않습니다.

기본 파티션은 아직 괜찮고 우분투도 아직 부팅하고 있으니 괜찮은 것 같아요. 더 크게 만들기 위해 무엇을 해야 하는지에 대한 아이디어가 있나요?

편집하다 :

fdisk -lgparted 라이브 디스크에서 부팅할 때 의 출력입니다 .

Disk /dev/sda: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16064 * 512 = 9225280 bytes

    Device Boot     Start       End      Blocks    Id  System
/dev/sda1    *          1      2481    19921920    83  Linux
/dev/sda2           12924     13054     1052275+    5 Extended
/dev/sda5           12925     13054     1044225    82 Linux swap / Solaris

편집 2 :

fdisk -l우분투 서버에서 부팅할 때

흥미롭게도 VM을 정상적으로 부팅한 후 실행하면 출력이 다릅니다.

Disk /dev/sda: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders, total 209715200 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 identifier: 0x00044fd6

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048    39845887    19921920   83  Linux
/dev/sda2       207607995   209712509     1052257+   5  Extended
/dev/sda5       207624060   209712509     1044225   82  Linux swap / Solaris

편집 3: 출력mount | grep " / "

/dev/sda1 on / type ext4 (rw,errors=remount-ro)

답변1

fdisk및 출력 에 감사드립니다 mount.

  1. 두 fdisk 출력의 차이는 사용된 단위에 불과하므로 숫자가 다릅니다.
  2. /dev/sda1 파티션은 아직 크기가 조정되지 않았으며 여전히 ~20GB입니다.

먼저 크기를 조정해야 하며 CD에서 부팅할 때 가장 잘 수행됩니다.

~# fdisk /dev/sda
Welcome to fdisk (util-linux 2.23.2).

Command (m for help): p

Device Boot         Start         End      Blocks   Id  System
/dev/sda1            2048    39845887    19921920   83  Linux
/dev/sda2       207607995   209712509     1052257+   5  Extended
/dev/sda5       207611904   209712509     1050303   82  Linux swap / Solaris

이러한 "긴" 숫자의 출력이 표시되지 않으면 fdisk 명령을 사용하여 u단위를 섹터로 변경한 다음 p다시 인쇄하십시오.

이제 삭제 /dev/sda1하고 더 큰 크기로 다시 만드세요. 파티션을 삭제하면 파티션 테이블만 변경되고 데이터는 제거되지 않습니다. 그러나 먼저 VM의 스냅샷을 찍는 것이 좋습니다.

Command (m for help): d
Partition number (1,2,5, default 5): 1
Partition 1 is deleted

이제 새 항목을 만듭니다.

Command (m for help): n
Partition type:
   p   primary (0 primary, 1 extended, 3 free)
   l   logical (numbered from 5)
Select (default p): p
Partition number (1,3,4, default 1): 1
First sector (2048-209715199, default 2048):    <==== This MUST be the same as in the original partition table!
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-207607994, default 207607994):  <== Use the default, will be maximum it can do
Using default value 207607994
Partition 1 of type Linux and of size 99 GiB is set

정상인지 확인합니다.

Command (m for help): p

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048   207607994   103802973+  83  Linux       <=== Note the new size
/dev/sda2       207607995   209712509     1052257+   5  Extended
/dev/sda5       207611904   209712509     1050303   82  Linux swap / Solaris

그리고 디스크에 씁니다.

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

이제 파일 시스템의 일관성을 확인하고 크기를 조정하십시오.

~# e2fsck -f /dev/sda1
e2fsck 1.42.9 (28-Dec-2013)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sda1: 11/1245184 files (0.0% non-contiguous), 122210/4980480 blocks

~# resize2fs /dev/sda1 
resize2fs 1.42.9 (28-Dec-2013)
Resizing the filesystem on /dev/sda1 to 25950743 (4k) blocks.
The filesystem on /dev/sda1 is now 25950743 blocks long.

그러면 효과가 있을 것입니다.

답변2

이전 버전의 GParted Live Disk를 사용하고 있었습니다. 최신 릴리스를 다운로드했는데 링크된 지침에 따라 작동했습니다.

관련 정보