fdiskを使用したデータスペースの作成

fdiskを使用したデータスペースの作成

私はWindowsのHyper-Vで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起動するたびにインストールするように編集することを忘れないでください。

おすすめ記事