fdisk でデータ用のスペースを作成する

fdisk でデータ用のスペースを作成する

Hyper-V の Windows で Debian サーバーを実行しています。Hyper-V パーティションを 2T に拡張しました。次に、その新しいスペースを使用するために Debian パーティションを拡張したいと思います。新しいスペースはビデオ用なので、最も簡単なのは、新しいパーティションを作成してマウントし、そのパーティションにビデオを保存することだと思います。コマンド ラインから実行しているので、パーティションの作成には支援が必要です。fdisk と parted の両方をインストールしています。現在の状態は次のとおりです。

Disk /dev/sda: 2 TiB, 2199023255552 bytes, 4294967296 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x8427e4f2

Device     Boot  Start       End   Sectors   Size Id Type
/dev/sda1  *      2048    499711    497664   243M 83 Linux
/dev/sda2       501758 266336255 265834498 126.8G  5 Extended
/dev/sda5       501760 266336255 265834496 126.8G 8e Linux LVM

Partition 2 does not start on physical sector boundary.



Disk /dev/mapper/UniFiServer--vg-root: 124.8 GiB, 133957681152 bytes, 261636096 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/mapper/UniFiServer--vg-swap_1: 2 GiB, 2147483648 bytes, 4194304 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

少し進歩しました。parted を使用して /dev/sda2 と /dev/sda5 を実際に拡張することに成功したようです。また、Romeo の助けを借りて、pvresize を使用して 2T を表示するように拡張しました。次に必要なのは、実際に使用できるものを作成するための支援だけです。lvcreate コマンドが機能しません。

Disk /dev/sda: 2 TiB, 2199023255552 bytes, 4294967296 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x8427e4f2

Device     Boot  Start        End    Sectors  Size Id Type
/dev/sda1  *      2048     499711     497664  243M 83 Linux
/dev/sda2       501758 4294921875 4294420118    2T  5 Extended
/dev/sda5       501760 4294921875 4294420116    2T 8e Linux LVM

Partition 2 does not start on physical sector boundary.




Disk /dev/mapper/UniFiServer--vg-root: 124.8 GiB, 133957681152 bytes, 261636096 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/mapper/UniFiServer--vg-swap_1: 2 GiB, 2147483648 bytes, 4194304 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

$ sudo vgs
VG             #PV #LV #SN Attr   VSize VFree
UniFiServer-vg   1   2   0 wz--n- 2.00t 1.88t

$ sudo lvcreate -L 1.88t --name videodata UniFiServer--vg
  Volume group "UniFiServer--vg" not found
  Cannot process volume group UniFiServer--vg

答え1

pvresizePVを伸ばすために走るべきだ

pvresize /dev/sda5

その後、VGの新しいサイズを確認できます

vgs

その後、新しいLVを作成できます

lvcreate -L <size of the new volume> --name <name of volume> UniFiServer-vg

/etcfstab次に、この新しいボリュームをフォーマットしてマウントします。そして、毎回の起動時にマウントするように編集することを忘れないでください。

関連情報