GRUB 레거시가 알 수 없는 파일 시스템에 대해 불평합니까?

GRUB 레거시가 알 수 없는 파일 시스템에 대해 불평합니까?

OpenStack 클러스터(KVM)에 여러 개의 가상 머신이 있고 단일 5GB 파티션이 있는 이미지에서 구축되면 동일한 HDD 구조로 구성됩니다. 실제 OpenStack 호스트에서 크기를 조정하는 몇 가지 방법을 찾았지만 VM 내부에서 크기를 조정하여 해당 방법도 사용할 수 있기를 바랍니다.

한 가지 방법은 fdisk파티션 메타데이터를 삭제한 다음 파티션 메타데이터를 다시 생성하고 기록한 다음 VM으로 다시 부팅한 후 재부팅하고 크기를 조정하는 것입니다. 최근에 이것을 시도했지만 예상대로 작동하지 않았습니다. GRUB 프롬프트에서 가상 머신이 정지됩니다. 이는 CentOS 6.7 VM이므로 부트로더는 GRUB 레거시입니다.

           SS1

이 가상 머신에서 파일 시스템을 얻으려면 어떤 옵션이 있어야 합니까? virtmanager를 사용하여 VM에 액세스한 다음 LiveCD ISO를 노출하여 VM을 "부팅"한 다음 관련 파일 시스템을 가져올 수 있을 것 같지만 액세스를 복원하고 VM을 부팅하는 더 직접적인 방법이 있습니까?

인용하다

답변1

그래서 제 질문은 파티션을 삭제하고 다시 만드는 방법입니다. fdisk표시된 시작 위치가 해당 섹터에 있지 않아서 넘어졌습니다 . 다음과 같이 올바르게 호출 하면 fdisk:

$ sudo fdisk -c -u /dev/vda

Command (m for help): p

Disk /dev/vda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders, total 83886080 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: 0x0004064e

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048    31459327    15728640   83  Linux

분명히 새 파티션을 만들 때 시작 섹터를 정렬하지 않은 것 같습니다.

fdisk 사용 안내서에서:

Options:
 -c                        switch off DOS-compatible mode
 -u <size>                 give sizes in sectors instead of cylinders

그래서 이 부분에 특별히 주의를 기울인 결과, 사용 가능한 HDD 공간을 모두 활용하여 가상 머신의 파티션을 확장하는 과정을 다음과 같이 수행할 수 있었습니다.

크기 조정 프로세스

기존 파티션 삭제:

Command (m for help): d
Selected partition 1

이제 새로운 것을 추가하세요:

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First sector (2048-83886079, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-83886079, default 83886079):
Using default value 83886079

부팅 가능하게 만드세요:

Command (m for help): a
Partition number (1-4): p
Partition number (1-4): 1

이 모든 것을 확인합니다.

Command (m for help): p

Disk /dev/vda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders, total 83886080 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: 0x0004064e

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048    83886079    41942016   83  Linux

하드 드라이브에 커밋합니다.

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

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.

이제 시스템을 재부팅하고 필요에 따라 resize2fs를 수행하십시오.

$ sudo resize2fs /dev/vda1
resize2fs 1.41.12 (17-May-2010)
The filesystem is already 10485504 blocks long.  Nothing to do!

그리고 확인하세요:

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        40G  807M   37G   3% /
tmpfs           1.9G     0  1.9G   0% /dev/shm

관련 정보