首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在错误加密分区收缩后修复LVM PV大小?

如何在错误加密分区收缩后修复LVM PV大小?
EN

Unix & Linux用户
提问于 2021-09-10 16:25:44
回答 1查看 553关注 0票数 2

我今天显然搞砸了。

我必须调整加密的根分区的大小,以便为windows双引导腾出空间。我遵循拱形维基的指示,因为它似乎符合我的需要,即使我使用的是debian。在某种程度上,我不得不使用pvmove,因为在缩小根分区之后,空闲空间位于根分区和交换分区之间。我认为一切都进行得很顺利,但我显然在某个时候搞砸了我的扇区/字节/东西的计算。现在,这台机器是从一个活跃的debian usb键启动的,这是我认为相关的shell命令的输出。

代码语言:javascript
复制
user@debian:~$ sudo lsblk
NAME          MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
loop0           7:0    0   2.3G  1 loop  /usr/lib/live/mount/rootfs/filesystem.s
sda             8:0    0   3.6T  0 disk  
sdb             8:16   1 114.6G  0 disk  
sdc             8:32   1  28.9G  0 disk  
├─sdc1          8:33   1   2.5G  0 part  /usr/lib/live/mount/medium
└─sdc2          8:34   1   2.6M  0 part  
nvme0n1       259:0    0   3.6T  0 disk  
├─nvme0n1p1   259:1    0   512M  0 part  
├─nvme0n1p2   259:2    0   488M  0 part  
└─nvme0n1p3   259:3    0   3.5T  0 part  
  └─cryptdisk 253:0    0   3.5T  0 crypt  # this is where the "fun" happens

所以,我设法释放了100 G的窗口,目前看来还不错。但是..。

代码语言:javascript
复制
user@debian:~$ sudo cryptsetup luksOpen /dev/nvme0n1p3 cryptdisk
Enter passphrase for /dev/nvme0n1p3: 
user@debian:~$ sudo vgchange -a y licorne-vg
  WARNING: Device /dev/mapper/cryptdisk has size of 7602233344 sectors which is smaller than corresponding PV size of 7602235392 sectors. Was device resized?
  WARNING: One or more devices used as PVs in VG licorne-vg have changed sizes.
  device-mapper: reload ioctl on  (253:2) failed: Invalid argument
  1 logical volume(s) in volume group "licorne-vg" now active
user@debian:~$ sudo lsblk
NAME                   MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
loop0                    7:0    0   2.3G  1 loop  /usr/lib/live/mount/rootfs/filesystem.squashfs
sda                      8:0    0   3.6T  0 disk  
sdb                      8:16   1 114.6G  0 disk  
sdc                      8:32   1  28.9G  0 disk  
├─sdc1                   8:33   1   2.5G  0 part  /usr/lib/live/mount/medium
└─sdc2                   8:34   1   2.6M  0 part  
nvme0n1                259:0    0   3.6T  0 disk  
├─nvme0n1p1            259:1    0   512M  0 part  
├─nvme0n1p2            259:2    0   488M  0 part  
└─nvme0n1p3            259:3    0   3.5T  0 part  
  └─cryptdisk          253:0    0   3.5T  0 crypt 
    └─licorne--vg-root 253:1    0   3.5T  0 lvm   

恐慌加剧..。253:2是我加密的交换分区,它是这个加密磁盘的一部分。

代码语言:javascript
复制
user@debian:~$ sudo pvdisplay /dev/mapper/cryptdisk
  WARNING: Device /dev/mapper/cryptdisk has size of 7602233344 sectors which is smaller than corresponding PV size of 7602235392 sectors. Was device resized?
  WARNING: One or more devices used as PVs in VG licorne-vg have changed sizes.
  --- Physical volume ---
  PV Name               /dev/mapper/cryptdisk
  VG Name               licorne-vg
  PV Size               3.54 TiB / not usable 0   
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              928007
  Free PE               0
  Allocated PE          928007
  PV UUID               x5fLwB-qnhM-qc4x-y28f-FdDM-pFGI-9I6SYh
   
user@debian:~$ sudo lvs
  WARNING: Device /dev/mapper/cryptdisk has size of 7602233344 sectors which is smaller than corresponding PV size of 7602235392 sectors. Was device resized?
  WARNING: One or more devices used as PVs in VG licorne-vg have changed sizes.
  LV     VG         Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root   licorne-vg -wi-a-----  <3.54t                                                    
  swap_1 licorne-vg -wi------- 976.00m

user@debian:~$ sudo dmesg | grep device-mapper
[   99.652244] device-mapper: uevent: version 1.0.3
[   99.652317] device-mapper: ioctl: 4.43.0-ioctl (2020-10-01) initialised: dm-devel@redhat.com
[  100.537014] device-mapper: table: 253:2: dm-0 too small for target: start=7600236544, len=1998848, dev_size=7602233344
[  100.537016] device-mapper: core: Cannot calculate initial queue limits
[  100.537027] device-mapper: ioctl: unable to set up device queue for new table.
[ 1451.395603] device-mapper: table: 253:2: dm-0 too small for target: start=7600236544, len=1998848, dev_size=7602233344
[ 1451.395605] device-mapper: core: Cannot calculate initial queue limits
[ 1451.395956] device-mapper: ioctl: unable to set up device queue for new table.

此LVM/LUKS设置是否处于可恢复状态?我认为licorne--vg-root和只有交换分区受到了影响,这是可以的,对吗?我在这里应该遵循什么步骤来解决问题?谢谢你的帮助。

EN

回答 1

Unix & Linux用户

回答已采纳

发布于 2021-09-15 10:35:13

由于@frostchutz,我通过使用parted到2048年扩展/dev/nvme0n1p3来修复这个问题。

票数 0
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/668491

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档