OpenStack 프로젝트에서 새로운 가상 머신을 생성합니다.
그 후 가상 머신에 여유 공간의 크기를 추가하고 싶습니다.
새 볼륨을 추가하고 가상 머신에 연결했습니다.
가상 머신을 시작한 후 하드 디스크 상태를 확인해 보았습니다.
fdisk -l
Disk /dev/vda: 5368 MB, 5368709120 bytes, 10485760 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000ad846
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 10485759 5241856 83 Linux
Disk /dev/vdb: 155.7 GB, 155692564480 bytes, 304087040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
lsblk-f
NAME FSTYPE LABEL UUID MOUNTPOINT
vda
└─vda1 xfs b22f809d-38b7-43fd-8eda-22acb001877f /
vdb
df-h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 7.7G 0 7.7G 0% /dev
tmpfs 7.8G 0 7.8G 0% /dev/shm
tmpfs 7.8G 17M 7.7G 1% /run
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/vda1 5.0G 2.4G 2.6G 48% /
tmpfs 1.6G 0 1.6G 0% /run/user/20226
새 기본 파티션을 생성하려고 시도한 후
fdisk /dev/vdb
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xa9dbcbca.
Command (m for help): p
Disk /dev/vdb: 155.7 GB, 155692564480 bytes, 304087040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0xa9dbcbca
Device Boot Start End Blocks Id System
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-304087039, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-304087039, default 304087039):
Using default value 304087039
Partition 1 of type Linux and of size 145 GiB is set
Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
fdisk -l
Disk /dev/vda: 5368 MB, 5368709120 bytes, 10485760 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000ad846
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 10485759 5241856 83 Linux
Disk /dev/vdb: 155.7 GB, 155692564480 bytes, 304087040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0xa9dbcbca
Device Boot Start End Blocks Id System
/dev/vdb1 2048 304087039 152042496 8e Linux LVM
뿌리 볼륨을 확대하는 방법 /dev/vda1 5.0G 2.4G 2.6G 48% / 새 볼륨 /dev/vdb1 ?
답변1
한 하드 드라이브를 다른 하드 드라이브로 확장할 수 없다고 생각합니다. vda를 vdb에 복사한 다음 vdb를 "/" 하드 드라이브로 사용할 수 있습니다. dd 또는 다른 볼륨 복사 도구를 사용해 보십시오. 복사가 완료되면 파티션을 원하는 크기로 확장할 수 있습니다.