LVM 和 Gparted 不允许我调整分区大小

LVM 和 Gparted 不允许我调整分区大小

我想调整我的 ubuntu 分区 (/dev/sda2) 的大小,并尝试首先通过 lvm 缩小逻辑卷,然后通过 lvm 和 gparted 缩小物理卷。虽然缩小逻辑卷有效,但缩小物理卷无效。

这是在 Ubuntu 18.04 可启动 USB 上。

附件是我的物理卷、逻辑卷和 gparted 的输出,以及我在尝试调整大小时遇到​​的错误。我的理解是分区末尾的交换逻辑卷阻止了这一点。有人能解释一下这有什么用吗,我是否需要它,以及我是否可以将它移动到磁盘上的另一个位置来缩小我的分区?

--- Logical volume ---
  LV Path                /dev/ubuntu-vg/root
  LV Name                root
  VG Name                ubuntu-vg
  LV UUID                YdBCyk-CZ4x-o9MW-r50e-2pPv-AVCM-4UTwLU
  LV Write Access        read/write
  LV Creation host, time ubuntu, 2018-06-23 23:36:52 -0400
  LV Status              available
  # open                 1
  LV Size                359.30 GiB
  Current LE             91981
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

  --- Logical volume ---
  LV Path                /dev/ubuntu-vg/swap_1
  LV Name                swap_1
  VG Name                ubuntu-vg
  LV UUID                oXl52b-jhwl-5YVm-LDux-Od0N-7uXs-Y1FpyE
  LV Write Access        read/write
  LV Creation host, time ubuntu, 2018-06-23 23:36:52 -0400
  LV Status              available
  # open                 2
  LV Size                980.00 MiB
  Current LE             245
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               ubuntu-vg
  PV Size               <465.26 GiB / not usable 2.00 MiB
  Allocatable           yes 
  PE Size               4.00 MiB
  Total PE              119106
  Free PE               26880
  Allocated PE          92226
  PV UUID               85nOEc-rewk-yNNR-tQms-Pk4W-ax4X-5fLYmX

#

  sudo lvm pvresize -v --setphysicalvolumesize 387361792K /dev/sda2

    Wiping internal VG cache
    Wiping cache of LVM-capable devices
    Archiving volume group "ubuntu-vg" metadata (seqno 7).

/dev/sda2: Requested size <369.42 GiB is less than real size 465.26 GiB. Proceed?  [y/n]: y
    Accepted input: [y]
  WARNING: /dev/sda2: Pretending size is 774723584 not 975722496 sectors.
    Resizing volume "/dev/sda2" to 774723584 sectors.
    Resizing physical volume /dev/sda2 from 119106 to 94570 extents.
  /dev/sda2: cannot resize to 94570 extents as later ones are allocated.
  0 physical volume(s) resized / 1 physical volume(s) not resized

感谢您的帮助。

相关内容