luks分区移动硬盘意外掉线,无法重新进入

声卡/显卡/打印机/USB设备等硬件问题(网卡问题请发上面的网卡板块)
回复
wickytam
帖子: 22
注册时间: 2008-11-15 0:58
送出感谢: 0
接收感谢: 0

luks分区移动硬盘意外掉线,无法重新进入

#1

帖子 wickytam » 2020-11-10 7:58

一个移动硬盘中存在一个luks分区,插入后会自动挂载。但是由于各种原因移动硬盘异常掉线重新连接后,luks分区无法重新挂载,查看了一下表面原因为/dev/mapper里面存在了原来的luks设备,硬盘重新链接后,无法重新覆盖这个luks设备,导致无法挂载分区。

sudo udevadm info /dev/dm-0命令结果:
P: /devices/virtual/block/dm-0
N: dm-0
L: 0
S: disk/by-id/dm-name-luks-fdd092dc-ff51-48aa-aa09-83fd0891b288
S: disk/by-id/dm-uuid-CRYPT-LUKS1-fdd092dcff5148aaaa0983fd0891b288-luks-fdd092dc-ff51-48aa-aa09-83fd0891b288
S: mapper/luks-fdd092dc-ff51-48aa-aa09-83fd0891b288
E: DEVPATH=/devices/virtual/block/dm-0
E: DEVNAME=/dev/dm-0
E: DEVTYPE=disk
E: MAJOR=253
E: MINOR=0
E: SUBSYSTEM=block
E: USEC_INITIALIZED=144466974
E: DM_UDEV_DISABLE_LIBRARY_FALLBACK_FLAG=1
E: DM_UDEV_PRIMARY_SOURCE_FLAG=1
E: DM_UDEV_RULES=1
E: DM_UDEV_RULES_VSN=2
E: DM_NAME=luks-fdd092dc-ff51-48aa-aa09-83fd0891b288
E: DM_UUID=CRYPT-LUKS1-fdd092dcff5148aaaa0983fd0891b288-luks-fdd092dc-ff51-48aa-aa09-83fd0891b288
E: DM_SUSPENDED=0
E: SYSTEMD_READY=0
E: DEVLINKS=/dev/disk/by-id/dm-name-luks-fdd092dc-ff51-48aa-aa09-83fd0891b288 /dev/disk/by-id/dm-uuid-CRYPT-LUKS1-fdd092dcff5148aaaa0983fd0891b288-luks-fdd092dc-ff51-48aa-aa09-83fd0891b288 /dev/mapper/luks-fdd092dc-ff51-48aa-aa09-83fd0891b288
E: TAGS=:systemd:


sudo cryptsetup status luks-fdd092dc-ff51-48aa-aa09-83fd0891b288的结果:
/dev/mapper/luks-fdd092dc-ff51-48aa-aa09-83fd0891b288 is active and is in use.
type: n/a
cipher: aes-xts-plain64
keysize: 256 bits
key location: dm-crypt
device: (null)
sector size: 512
offset: 4097 sectors
size: 3516407398 sectors
mode: read/write

除了重启以外,还有什么办法能把luks分区重新挂载?
wickytam
帖子: 22
注册时间: 2008-11-15 0:58
送出感谢: 0
接收感谢: 0

问题解决!Re: luks分区移动硬盘意外掉线,无法重新进入

#2

帖子 wickytam » 2020-11-17 21:37

一条命令即可:
sudo cryptsetup close luks-fdd092dc-ff51-48aa-aa09-83fd0891b288
之前试过这条命令,但是最后的参数写的是/dev/dm-0,导致无法执行。
回复

回到 “常用硬件支持”