「切り捨てられたイメージから作成されたvdiの場合、ディスクの外側にパーティションがありません!」

「切り捨てられたイメージから作成されたvdiの場合、ディスクの外側にパーティションがありません!」

私はdd割り当てられたスペースのみを含むディスクの部分/切り捨てられたイメージを作成し、それをVirtualBox用のvdiファイルに変換しました。ディスクにインストールされているLinux(Ubuntu)を実行するためにvdiイメージを正常に使用しました。

GPartedを実行してLinuxパーティションの前にあるパーティションを削除したくありません(より小さなイメージを作成できるように)。しかし、GPartedは動作しません。ディスク全体が割り当てられていないことを示します。どうすれば解決できますか?

追加情報:

sudo pared /dev/sda 単位印刷

Error: Can't have a partition outside the disk!                           

sudo fdisk -l -u /dev/sda

Disk /dev/sda: 97.7 GB, 97729379840 bytes
255 heads, 63 sectors/track, 11881 cylinders, total 190877695 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: 0x3c36156a

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     2459647     1228800    7  HPFS/NTFS/exFAT
/dev/sda2         2459648   125339129    61439741    7  HPFS/NTFS/exFAT
/dev/sda3       125339646   190877695    32769025    5  Extended
/dev/sda5       125339648   190877695    32769024   83  Linux

sudo sfdisk -uS -l /dev/sda

Disk /dev/sda: 11881 cylinders, 255 heads, 63 sectors/track
Warning: extended partition does not start at a cylinder boundary.
DOS and Linux will interpret the contents differently.
Units = sectors of 512 bytes, counting from 0

   Device Boot    Start       End   #sectors  Id  System
/dev/sda1   *      2048   2459647    2457600   7  HPFS/NTFS/exFAT
/dev/sda2       2459648 125339129  122879482   7  HPFS/NTFS/exFAT
/dev/sda3     125339646 190877695   65538050   5  Extended
/dev/sda4             0         -          0   0  Empty
/dev/sda5     125339648 190877695   65538048  83  Linux

sudo sfdisk -d /dev/sda

Warning: extended partition does not start at a cylinder boundary.
DOS and Linux will interpret the contents differently.
# partition table of /dev/sda
unit: sectors

/dev/sda1 : start=     2048, size=  2457600, Id= 7, bootable
/dev/sda2 : start=  2459648, size=122879482, Id= 7
/dev/sda3 : start=125339646, size= 65538050, Id= 5
/dev/sda4 : start=        0, size=        0, Id= 0
/dev/sda5 : start=125339648, size= 65538048, Id=83

ベストアンサー1

gpartedおそらく最も簡単な解決策は、再び幸せになるように画像のサイズを増やすことです。これはワンタイム問題である可能性が高いため、画像サイズを数メガバイトだけ増やすだけで十分です。

dd if=/dev/zero of=newimage.raw bs=1M count=102400
qemu-img convert -f vdi oldimage.vdi -O raw oldimage.raw
dd if=oldimage.raw of=newimage.raw count=190877695 conv=notrunc
qemu-img convert -f raw newimage.raw -O vdi newimage.vdi

または簡単に:

cp oldimage.vdi newimage.vdi
VBoxManage modifyhd /path/to/newimage.vdi --resize 102400

gpartedその後、実行を再試行する必要がありますnewimage.vdi。問題が引き続き発生する場合は、十分なスペースがあると仮定して、イメージサイズを元のディスクサイズに増やすことができます。

おすすめ記事