使用 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

你应该跑步pvresize来延长PV

pvresize /dev/sda5

然后就可以查看VG的新大小

vgs

然后就可以创建新的LV了

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

然后您应该格式化并安装这个新卷。并且不要忘记编辑/etcfstab以在每次启动时安装它

相关内容