fdisk로 데이터 공간 만들기

fdisk로 데이터 공간 만들기

저는 Hyper-V의 Windows에서 Debian 서버를 실행하고 있으며 Hyper-V 파티션을 2T로 확장했습니다. 이제 새로운 공간을 사용하기 위해 Debian 파티션을 확장하고 싶습니다. 새 공간은 비디오를 위한 것이므로 가장 쉬운 방법은 새 파티션을 만들고 이를 마운트한 다음 해당 파티션에 비디오를 저장하는 것입니다. cmd 라인에서 실행 중이므로 파티션을 생성하는 데 도움이 필요합니다. 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부팅할 때마다 마운트하도록 편집하는 것을 잊지 마세요.

관련 정보