LVM을 사용하지 않고 파티션 크기 조정

LVM을 사용하지 않고 파티션 크기 조정

원격 서버에 Ubuntu 16.04를 설치했고 20GB내 파티션에 다른 파티션(현재 20GB) 을 요청했기 /dev/vda2때문에 총 크기는 40GB.vda2

이제 이 작업을 수행할 수 있는 방법을 찾았지만 내 구성이 LVM구성되지 않았거나 적어도 구성되어 있지 않은 것으로 나타났습니다. 예를 들어 실행하면 vgdisplay아무 일도 일어나지 않기 때문입니다. 그런 다음 시도해 보았지만 vgscan그게 Reading volume groups from cache.전부입니다.

이 튜토리얼을 따라해 보았습니다.https://www.linuxtechi.com/extend-lvm-partitions/하지만 뛰지 못해서

# vgdisplay < Volume-Group-Name>

나는 내 것을 모르기 때문에 volume-group-name갇혀 있습니다.

어떡해? 나는 두 개의 데이터베이스가 실행되고 있고 모든 데이터가 백업되어 있지만 실제로 다시 설정하고 싶지 않기 때문에 가장 안전한 방법과 가장 쉬운 방법을 찾고 있습니다.

참고로 내가 실행하면 fdisk -l다음을 얻습니다.

여기에 이미지 설명을 입력하세요.

편집하다:

제가 아래에 답변한 내용은 다음과 같습니다.

여기에 이미지 설명을 입력하세요.

여기에 이미지 설명을 입력하세요.

여기에 이미지 설명을 입력하세요.

label: gpt
label-id: 88501878-0C4F-486D-B09A-1AD0A6C81982
device: /dev/vda
unit: sectors
first-lba: 34
last-lba: 41943006

/dev/vda1 : start=        2048, size=        2048, type=21686148-6449-6E6F-744E-656564454649, uuid=6FA9DDEF-760F-4276-9DF0-B8A62F9C51BD
/dev/vda2 : start=        4096, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=E0912389-7C07-41F7-A21E-B8B131F2C491

답변1

sfdisk두 번째 파티션의 크기 조정을 사용하면 됩니다 .

# write the current partition table into a machine readable text file 
sfdisk --dump /dev/vda > /var/tmp/vda.old
cp /var/tmp/vda.old /var/tmp/vda.new
# also copy vda.old to another machine to have a safe backup

# edit the dump to set the new size for partion 2
# (you may remove the size parameter ", size= 1234" and the
# whole line "last-lba: 1234" to get the max possible size)
vim /var/tmp/vda.new

# now apply the edited partition table to the harddisk
sfdisk --no-reread /dev/vda </var/tmp/vda.new

# check if it looks good, otherwise repair/try again
fdisk -l /dev/vda


# after reboot, resize the filesystem too, for example in case of ext{2,3,4}
resize2fs /dev/vda2

크기를 조정할 파티션 바로 다음에는 하드 드라이브에 여유 공간이 있으므로 LVM을 사용하지 않고도 이 작업을 수행할 수 있습니다. LVM을 사용하면 재부팅할 필요가 없으며 전체 크기 조정 단계가 덜 위험해 보입니다. 그래서 일반적으로 서버 설치 시 처음부터 LVM을 사용하는 것을 권장합니다. 하지만 여러분에게는 LVM 없이도 작동할 것입니다.

관련 정보