更换磁盘后无法扩展 LVM 上的逻辑卷

更换磁盘后无法扩展 LVM 上的逻辑卷

我们有一台采用 Raid 1 配置的 Dell PowerEdge R920(Perc H730P:raid 控制器)。我成功将 raid 卷从 2x 300Gb 磁盘升级到 2x 600Gb 磁盘。

现在,我需要在 CentOS 上的 LVM 上扩展逻辑卷,但我无法创建任何分区:没有可用的空闲扇区。但是磁盘在 fdisk 上被识别,我可以在 gparted 上看到未分配的空间。

fdisk -l

Disk /dev/loop0: 0 MB, 81920 bytes
255 heads, 63 sectors/track, 0 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/loop1: 0 MB, 81920 bytes
255 heads, 63 sectors/track, 0 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn                't support GPT. Use GNU Parted.


Disk /dev/sda: 599.6 GB, 599550590976 bytes
255 heads, 63 sectors/track, 72891 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1       36405   292421631+  ee  GPT
/dev/sda2           36405       72891   293075325+  8e  Linux LVM

Disk /dev/sdb: 999.7 GB, 999653638144 bytes
255 heads, 63 sectors/track, 121534 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/VolGroup-lv_root: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/VolGroup-lv_swap: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/VolGroup2-lv_temp: 998.6 GB, 998579896320 bytes
255 heads, 63 sectors/track, 121403 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/VolGroup-lv_home: 240.7 GB, 240719495168 bytes
255 heads, 63 sectors/track, 29265 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
pvdisplay
  --- Physical volume ---
  PV Name               /dev/sdb
  VG Name               VolGroup2
  PV Size               931.00 GiB / not usable 4.00 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              238335
  Free PE               255
  Allocated PE          238080
  PV UUID               7nFg5f-4wnd-Irql-YCte-40Wb-zOP4-F63rWr

  --- Physical volume ---
  PV Name               /dev/sda3
  VG Name               VolGroup
  PV Size               278.19 GiB / not usable 0
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              71216
  Free PE               0
  Allocated PE          71216
  PV UUID               rPeEHH-b0gs-TYVV-TaY9-LDel-YrS1-ILb1JW

我需要延长 LV/dev/VolGroup/lv_root


 lvdisplay
  --- Logical volume ---
  LV Path                /dev/VolGroup2/lv_temp
  LV Name                lv_temp
  VG Name                VolGroup2
  LV UUID                7T5NcE-CGjM-2hth-4efT-g8UL-Zpdo-kBeH2K
  LV Write Access        read/write
  LV Creation host, time PLANCK, 2018-07-24 11:28:49 +0200
  LV Status              available
  # open                 1
  LV Size                930.00 GiB
  Current LE             238080
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2

  --- Logical volume ---
  LV Path                /dev/VolGroup/lv_root
  LV Name                lv_root
  VG Name                VolGroup
  LV UUID                vH52dR-6uXW-fXKx-PzeV-lHY6-zcDQ-JcCPZW
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2015-01-27 15:15:28 +0100
  LV Status              available
  # open                 1
  LV Size                50.00 GiB
  Current LE             12800
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

  --- Logical volume ---
  LV Path                /dev/VolGroup/lv_home
  LV Name                lv_home
  VG Name                VolGroup
  LV UUID                FXeqOZ-b7W3-cbpv-NOJn-dduD-XWPn-E4Ri1E
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2015-01-27 15:15:29 +0100
  LV Status              available
  # open                 1
  LV Size                224.19 GiB
  Current LE             57392
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:3

  --- Logical volume ---
  LV Path                /dev/VolGroup/lv_swap
  LV Name                lv_swap
  VG Name                VolGroup
  LV UUID                kImWNb-sLgc-SNDe-Nc87-Bbz1-VAOI-sUUGSJ
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2015-01-27 15:15:53 +0100
  LV Status              available
  # open                 1
  LV Size                4.00 GiB
  Current LE             1024
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

但我无法创建任何分区:


fdisk /dev/sda

WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.


WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 3
No free sectors available

gparted 截图: 图像

lsblk
NAME                        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0                         7:0    0    80K  0 loop /var/hasplm/smfs/.4d464731
loop1                         7:1    0    80K  0 loop /var/hasplm/smfs/.53464731
sda                           8:0    0 558.4G  0 disk
├─sda1                        8:1    0   200M  0 part /boot/efi
├─sda2                        8:2    0   500M  0 part /boot
└─sda3                        8:3    0 278.2G  0 part
  ├─VolGroup-lv_root (dm-0) 253:0    0    50G  0 lvm  /
  ├─VolGroup-lv_swap (dm-1) 253:1    0     4G  0 lvm  [SWAP]
  └─VolGroup-lv_home (dm-3) 253:3    0 224.2G  0 lvm  /home
sdb                           8:16   0   931G  0 disk
└─VolGroup2-lv_temp (dm-2)  253:2    0   930G  0 lvm  /tmp
sr0                          11:0    1  1024M  0 rom

我无法停用 gparted 上的分区Logical volume VolGroup/lv_root contains a filesystem in use. Can't deactivate volume group "VolGroup" with 3 open logical volume(s)

有人有什么想法吗?谢谢

答案1

您正在尝试使用 fdisk 在 GPT 标签上创建分区。它报告说,这不起作用。请尝试使用支持 GPT 的分区工具,例如 parted。

您可以在这里找到描述:https://www.thegeekdiary.com/how-to-create-a-partition-using-parted-command/

相关内容