自宅で使用している VM の容量が不足しました。Ubuntu サーバーを実行しており、既存の容量は 20G でした。十分な余裕を確保するために、100G に増やすことにしました。
そこで私はここにある指示に従いました:http://www.rootusers.com/use-gparted-to-increase-disk-size-of-a-linux-native-partition/
最後のステップまではすべて順調でした。/dev/sda1/
パーティション サイズを 99G に拡張しようとすると、3 番目のステップ「ファイルシステムの/dev/sda1
エラーをチェックし、(可能な場合は) 修正します。」で失敗します。
このステップを実行しようとしているようです:e2fsck -f -y -v /dev/sda1
次のようなエラーが発生します:
スーパーブロックを読み取ることができなかったか、正しい ext2 ファイルシステムを記述していません。
問題のパーティションは ext3 パーティションですが、それが重要かどうかはわかりません。
プライマリ パーティションはまだ正常で、Ubuntu も起動するので、問題ないと思います。パーティションを大きくするにはどうすればいいでしょうか?
編集 :
fdisk -l
gparted ライブ ディスクから起動したときの出力。
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
Ubuntuサーバーで起動したとき
興味深いことに、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
。
- 2 つの fdisk 出力の違いは使用される単位だけなので、数値が異なります。
- /dev/sda1 パーティションのサイズはまだ変更されておらず、まだ約 20 GB のままです。
まずサイズを変更する必要がありますが、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 の古いバージョンを使用していました。最新リリースをダウンロードしたところ、リンク先の指示どおりに動作しました。