VM/Linux。後でディスクから起動できるように、大きなパーティションを削除して作成します。

VM/Linux。後でディスクから起動できるように、大きなパーティションを削除して作成します。

vmwareでLinuxのルートディスクをより大きくしたいです。 vmwareで「物理」ディスクを拡張し、fdiskで空き容量を確認できます。

パーティションはext4です。

未使用のスワップパーティションを削除したため、空き領域はルートパーティションの次の領域になります。

私はこれをしたい:https://askubuntu.com/questions/24027/how-can-i-resize-an-ext-root-partition-at-runtime パーティションを削除し、同じ場所から始めて、より大きなパーティションを再作成します。ただし、古いパーティションは63で始まり、新しいパーティションは2048で始まります。新しいパーティションを保存しません**ありません**。

編集:ディスクが8 GBから20 GBに拡張されました。最初のパーティションが始まる場所に影響しますか?

~# fdisk /dev/sda

Welcome to fdisk (util-linux 2.29.2).
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: 20 GiB, 21474836480 bytes, 41943040 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
Disklabel type: dos
Disk identifier: 0x000a5f05

Device     Boot Start      End  Sectors  Size Id Type
/dev/sda1  *       63 15952544 15952482  7.6G 83 Linux

Command (m for help): d
Selected partition 1
Partition 1 has been deleted.

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p):

Using default response p.
Partition number (1-4, default 1):
First sector (2048-41943039, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-41943039, default 41943039):

Created a new partition 1 of type 'Linux' and of size 20 GiB.

Command (m for help): p
Disk /dev/sda: 20 GiB, 21474836480 bytes, 41943040 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
Disklabel type: dos
Disk identifier: 0x000a5f05

Device     Boot Start      End  Sectors Size Id Type
/dev/sda1        2048 41943039 41940992  20G 83 Linux

Command (m for help): q

新しいパーティションが古いパーティションと同じ場所で開始されるようにできないのはなぜですか?他のオプション?大きなディスクを作成してすべてを追加し、古いディスクの代わりに新しいルートディスクをマウントしますか?

ベストアンサー1

元のパーティションは、fdisk以前のバージョンまたはデフォルトでDOS互換パーティションを作成する他のパーティションツールを使用して作成された可能性があります。

新しいfdiskパーティションは、現在推奨されているパーティションソートを使用します。つまり、ディスクの最初のパーティションをセクタ2048で起動すると、ディスクの先頭から正確に1MiBになります。これにより、構造が何であれ、基盤となるストレージシステムの構造とパーティションのデータを並べ替えるのに役立ちます。

  • 最新のマルチテラバイトHDDの4,000ブロック
  • SSDのブロックをクリア
  • RAIDセットのストライピング
  • 強力なエンタープライズSANストレージシステムのキャッシュブロック
  • など。

これ照合パフォーマンス上の理由から、SSDの摩耗を最小限に抑えるのに役立ちます。ただし、以前と同じ起動セクタでパーティションを作成するには、コマンドライン-c=dosにこのオプションを追加しますfdisk

fdisk -c=dos /dev/sda

これにより、パーティションの最初のセクタがブロック2048より小さくなり、以前のパーティションと同じようにブロック63に設定できます。

おすすめ記事