루트 파티션에 새 논리 볼륨을 생성할 수 없습니다.

루트 파티션에 새 논리 볼륨을 생성할 수 없습니다.

문제는 다음과 같습니다

다음 시스템에서 새로운 3GB 논리 볼륨이나 파티션을 어떻게 생성합니까?

여러번 시도했지만 성공하지 못했습니다...

시험용이므로 라이브 CD는 제공되지 않습니다.

/dev/sda2에 3GB 파티션을 만들려고 여러 번 시도했지만 동일한 오류가 발생했습니다.

재부팅하는 동안 오류 메시지를 보여주는 로그와 스크린샷이 있습니다.

[root@resize2 ~]# lsblk


NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 30G 0 disk
├─sda1 8:1 0 500M 0 part /boot
└─sda2 8:2 0 29.5G 0 part
├─vggroup-swap 253:0 0 2G 0 lvm [SWAP]
├─vggroup-root 253:1 0 22.7G 0 lvm /
└─vggroup-home 253:2 0 4.9G 0 lvm /home
sr0 11:0 1 6.6G 0 rom /run/media/marc/CentOS 7 x86_64
[root@resize2 ~]#
[root@resize2 ~]# df -Th


Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/vggroup-root ext4 23G 3.3G 18G 16% /
devtmpfs devtmpfs 912M 0 912M 0% /dev
tmpfs tmpfs 921M 84K 921M 1% /dev/shm
tmpfs tmpfs 921M 8.7M 912M 1% /run
tmpfs tmpfs 921M 0 921M 0% /sys/fs/cgroup
/dev/sda1 ext4 477M 95M 353M 22% /boot
/dev/mapper/vggroup-home ext4 4.7G 51M 4.4G 2% /home
/dev/sr0 iso9660 6.6G 6.6G 0 100% /run/media/marc/CentOS 7 x86_64
[root@resize2 ~]#
[root@resize2 ~]# pvdisplay


--- Physical volume ---
PV Name /dev/sda2
VG Name vggroup
PV Size 29.50 GiB / not usable 3.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 7550
Free PE 0
Allocated PE 7550
PV UUID fbhnuB-wTks-mkMy-9nfX-7ISJ-3MOi-E3IPhV

[root@resize2 ~]#
[root@resize2 ~]# vgdisplay


--- Volume group ---
VG Name vggroup
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 3
Open LV 3
Max PV 0
Cur PV 1
Act PV 1
VG Size 29.49 GiB
PE Size 4.00 MiB
Total PE 7550
Alloc PE / Size 7550 / 29.49 GiB
Free PE / Size 0 / 0
VG UUID ajso7W-2IyX-fE0A-16Jf-buut-O6x4-S4ySY3

[root@resize2 ~]#
[root@resize2 ~]# lvdisplay


--- Logical volume ---
LV Path /dev/vggroup/root
LV Name root
VG Name vggroup
LV UUID eUA7Mk-zekT-LNx4-0GTX-LaKk-0TxC-fCbZ0S
LV Write Access read/write
LV Creation host, time localhost, 2017-12-28 12:33:13 +0000
LV Status available
# open 1
LV Size 22.66 GiB
Current LE 5800
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1

--- Logical volume ---
LV Path /dev/vggroup/swap
LV Name swap
VG Name vggroup
LV UUID xoQkXQ-csCo-0MWt-poDC-pwQk-NcWe-fZDwVH
LV Write Access read/write
LV Creation host, time localhost, 2017-12-28 12:33:16 +0000
LV Status available
# open 2
LV Size 1.95 GiB
Current LE 500
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0

--- Logical volume ---
LV Path /dev/vggroup/home
LV Name home
VG Name vggroup
LV UUID 7UAzWG-i8CH-ywMV-4MMq-tsiJ-rUeI-Conb3u
LV Write Access read/write
LV Creation host, time localhost, 2017-12-28 12:33:17 +0000
LV Status available
# open 1
LV Size 4.88 GiB
Current LE 1250
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2

[root@resize2 ~]#
[root@resize2 ~]#
[root@resize2 ~]# parted /dev/sda print free


Model: ATA QEMU HARDDISK (scsi)
Disk /dev/sda: 32.2GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number Start End Size Type File system Flags
32.3kB 1049kB 1016kB Free Space
1 1049kB 525MB 524MB primary ext4 boot
2 525MB 32.2GB 31.7GB primary lvm
32.2GB 32.2GB 16.8MB Free Space

[root@resize2 ~]#
[root@resize2 ~]#
[root@resize2 ~]# fdisk -l

Disk /dev/sda: 32.2 GB, 32212254720 bytes, 62914560 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: 0x0009cecd

Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 62881791 30927872 8e Linux LVM

Disk /dev/mapper/vggroup-swap: 2097 MB, 2097152000 bytes, 4096000 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 /dev/mapper/vggroup-root: 24.3 GB, 24326963200 bytes, 47513600 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 /dev/mapper/vggroup-home: 5242 MB, 5242880000 bytes, 10240000 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

[root@resize2 ~]#
[root@resize2 ~]# fdisk /dev/sda2
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 0xc924a0b7.

Command (m for help): p

Disk /dev/sda2: 31.7 GB, 31670140928 bytes, 61855744 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: 0xc924a0b7

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):
Using default response p
Partition number (1-4, default 1):
First sector (2048-61855743, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-61855743, default 61855743): +3G
Partition 1 of type Linux and of size 3 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.

WARNING: Re-reading the partition table failed with error 22: Invalid argument.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
[root@resize2 ~]#
[root@resize2 ~]# partprobe
Warning: Unable to open /dev/sr0 read-write (Read-only file system). /dev/sr0 has been opened read-only.
Warning: Unable to open /dev/sr0 read-write (Read-only file system). /dev/sr0 has been opened read-only.
Warning: Unable to open /dev/sr0 read-write (Read-only file system). /dev/sr0 has been opened read-only.
[root@resize2 ~]#
[root@resize2 ~]#
[root@resize2 ~]# systemctl reboot

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

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

이 오류가 발생하는 이유와 이 시스템에서 3GB 파티션 또는 3GB 논리 볼륨을 생성하기 위해 이를 수정하는 방법을 아는 사람이 있습니까?

당신의 도움을 주셔서 감사합니다

업데이트 #1

이전에 fdisk /dev/sda를 사용해 보았지만 3GB 파티션을 생성하려고 할 때 "값이 범위를 벗어났습니다"라는 오류가 발생했습니다.

[root@resize2 ~]# lsblk
NAME             MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda                8:0    0   30G  0 disk
├─sda1             8:1    0  500M  0 part /boot
└─sda2             8:2    0 29.5G  0 part
  ├─vggroup-swap 253:0    0    2G  0 lvm  [SWAP]
  ├─vggroup-root 253:1    0 22.7G  0 lvm  /
  └─vggroup-home 253:2    0  4.9G  0 lvm  /home
sr0               11:0    1  6.6G  0 rom  /run/media/marc/CentOS 7 x86_64
[root@resize2 ~]# fdisk /dev/sda
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.


Command (m for help): p

Disk /dev/sda: 32.2 GB, 32212254720 bytes, 62914560 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: 0x0009cecd

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048    62881791    30927872   8e  Linux LVM

Command (m for help): n
Partition type:
   p   primary (2 primary, 0 extended, 2 free)
   e   extended
Select (default p):
Using default response p
Partition number (3,4, default 3):
First sector (62881792-62914559, default 62881792):
Using default value 62881792
Last sector, +sectors or +size{K,M,G} (62881792-62914559, default 62914559): +3G
Value out of range.
Last sector, +sectors or +size{K,M,G} (62881792-62914559, default 62914559):

실제로는 3GB 파티션이 필요하지 않고 3GB 논리 볼륨이 필요합니다.

여유 공간이 부족하면 볼륨 그룹에 3GB 논리 볼륨을 어떻게 생성합니까?

답변1

첫째, 다음 줄이 잘못되었습니다.

fdisk /dev/sda2 

/dev/sda2는 전체 디스크가 아닌 파티션입니다. /dev/sda를 fdisk에 대한 입력으로 전달한 다음 fdisk의 기본 파티션 2에서 작업해야 합니다.

sda2는 29.5G이고 여기에 포함된 논리 파티션의 총 개수는 2+22.7+4.9 =~ 29.5G이므로 sda2가 가득 찬 것처럼 보입니다. 3GB 파티션을 추가하려면 HD에서 할당되지 않은 공간을 사용하거나 sda2 크기를 조정해야 합니다(이 작업은 fdisk를 사용하여 수행할 수 없음).

답변2

lvcreate대신 새 LV를 만들어야 합니다 fdisk. 하지만 물론 현재 VG에 없는 여유 공간이 필요합니다.

LVM에 필요한 모듈이 포함되지 않은 initrd로 인해 부팅 문제가 발생할 수 있습니다.

관련 정보