AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / computer / 问题 / 1485185
Accepted
Cubi73
Cubi73
Asked: 2019-09-23 12:59:21 +0800 CST2019-09-23 12:59:21 +0800 CST 2019-09-23 12:59:21 +0800 CST

使用 vgchange 禁用后卷组仍然处于活动状态?

  • 772

我注意到有时vgchange -a n [vgname]似乎没有正确关闭卷组。这种情况最常发生,当我实际准备一个新系统时,我不知道是什么原因造成的。考虑以下磁盘结构(的输出lsblk -o name,fstype)

NAME                   FSTYPE
/dev/sdx
+- /dev/sdx1           crypto_LUKS
|  +- test_luks        LVM2_member
|  |  +- test_lvm-test ext4

当我以正常方式(,等)打开所有这些东西时cryptsetup open ...,vgchange -a y ...做一些事情test_lvm-test,然后用

umount [mountpoint of test_lvm-test]
vgchange -a n test_lvm
cryptsetup close test_luks

test_lvmvgs按预期从输出中消失。但是,如果我刚刚创建了这个结构(见下文重现),第一次安装它,然后以同样的方式关闭它,test_lvm不会从vgs. 相反,vgs抱怨物理卷的设备“没有被过滤器找到或拒绝”。要从vgs我必须重新打开test_luks和删除错误test_lvm,请再次禁用test_lvm并再次关闭test_luks。

为什么会这样?为什么LVM在第一次挂载时保留了test_lvmafter的句柄,但之后没有?vgchange -a n test_lvm; cryptsetup close test_luks


我能够像这样在 VirtualBox 中使用 Arch Linux Live CD“Arch Linux 5.2.5-arch1-1-ARCH”最一致地重现这种行为

# Let /dev/sdx1 be the partition to test this on

#
# Create LVM on LUKS with one ext4 volume
#
cryptsetup luksFormat --cipher aes-xts-plain64 --hash sha256 --label "Test (Encrypted)" /dev/sdx1
cryptsetup open /dev/sdx1 test_luks
pvcreate /dev/mapper/test_luks
vgcreate test_lvm /dev/mapper/test_luks
lvcreate --extents 100%FREE test_lvm --name test
mkfs.ext4 -L Test /dev/test_lvm/test

#
# Mount volume and write to it
#
mount /dev/test_lvm/test /mnt
echo "Hello World" > /mnt/test.txt

#
# Unmount everything
#
umount /mnt
vgchange -a n test_lvm
# -> 0 logical volume(s) in volume group "test_lvm" now active
cryptsetup close test_luks

#
# Check vgs
#
vgs
# -> Warning: Device for PV [uuid] not found or rejected by a filter.
# -> Warning: Device for PV [same uuid] not found or rejected by a filter.
# -> Couldn't find device with uuid [same uuid again].
# -> VG       #PV #LV #SM Attr   VSize   VFree
# -> test_lvm   1   1   0 wz-pn- 492.00m    0

#
# Mount and unmount again
#
cryptsetup open /dev/sdx1 test_luks
vgs
# No error this time
vgchange -a n test_lvm
cryptsetup close test_luks
# test_lvm no longer listed in vgs and no errors.
lvm luks
  • 1 1 个回答
  • 321 Views

1 个回答

  • Voted
  1. Best Answer
    Cubi73
    2020-02-01T06:57:46+08:002020-02-01T06:57:46+08:00

    关闭 LUKS 容器后未找到 PV 的错误消息可以通过简单地运行pvscan --cacheafter来禁用/删除cryptsetup close <device>。但是,我仍然不知道在这种情况下关闭 LUKS 容器是否会对其中存储的数据产生负面影响。如果有人对此有更多了解,请告诉我。

    • 0

相关问题

  • LUKS 模式下 dm-crypt / cryptsetup 的默认加密密钥大小是多少?

  • 我无法通过 SAMBA 查看存储在 LVM 中的数据

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    Windows 照片查看器因为内存不足而无法运行?

    • 5 个回答
  • Marko Smith

    支持结束后如何激活 WindowsXP?

    • 6 个回答
  • Marko Smith

    远程桌面间歇性冻结

    • 7 个回答
  • Marko Smith

    Windows 10 服务称为 AarSvc_70f961。它是什么,我该如何禁用它?

    • 2 个回答
  • Marko Smith

    子网掩码 /32 是什么意思?

    • 6 个回答
  • Marko Smith

    鼠标指针在 Windows 中按下的箭头键上移动?

    • 1 个回答
  • Marko Smith

    VirtualBox 无法以 VERR_NEM_VM_CREATE_FAILED 启动

    • 8 个回答
  • Marko Smith

    应用程序不会出现在 MacBook 的摄像头和麦克风隐私设置中

    • 5 个回答
  • Marko Smith

    ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] 证书验证失败:无法获取本地颁发者证书 (_ssl.c:1056)

    • 4 个回答
  • Marko Smith

    我如何知道 Windows 安装在哪个驱动器上?

    • 6 个回答
  • Martin Hope
    Albin 支持结束后如何激活 WindowsXP? 2019-11-18 03:50:17 +0800 CST
  • Martin Hope
    fixer1234 “HTTPS Everywhere”仍然相关吗? 2019-10-27 18:06:25 +0800 CST
  • Martin Hope
    Kagaratsch Windows 10 删除大量小文件的速度非常慢。有什么办法可以加快速度吗? 2019-09-23 06:05:43 +0800 CST
  • Martin Hope
    andre_ss6 远程桌面间歇性冻结 2019-09-11 12:56:40 +0800 CST
  • Martin Hope
    Riley Carney 为什么在 URL 后面加一个点会删除登录信息? 2019-08-06 10:59:24 +0800 CST
  • Martin Hope
    zdimension 鼠标指针在 Windows 中按下的箭头键上移动? 2019-08-04 06:39:57 +0800 CST
  • Martin Hope
    Inter Sys Ctrl+C 和 Ctrl+V 是如何工作的? 2019-05-15 02:51:21 +0800 CST
  • Martin Hope
    jonsca 我所有的 Firefox 附加组件突然被禁用了,我该如何重新启用它们? 2019-05-04 17:58:52 +0800 CST
  • Martin Hope
    MCK 是否可以使用文本创建二维码? 2019-04-02 06:32:14 +0800 CST
  • Martin Hope
    SoniEx2 更改 git init 默认分支名称 2019-04-01 06:16:56 +0800 CST

热门标签

windows-10 linux windows microsoft-excel networking ubuntu worksheet-function bash command-line hard-drive

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve