You are not logged in.

#1 2023-11-10 19:40:21

goldmund
Member
Registered: 2021-02-15
Posts: 73

LUKS on LVM – how to manage suspend/resume on external hdd?

Hi!

I've just successfully set up LUKS on top of LVM on my external hdd. After having configured the hdd, I saw this on the wiki:

In order for LVM to work properly with removable media – like an external USB drive – the volume group of the external drive needs to be deactivated before suspend. If this is not done, you may get buffer I/O errors on the dm device (after resume).

Source – Arch Wiki: Suspend/resume with LVM and removable media

Okay, that's certainly an issue for me as this external hdd is attached to a server and I often leave the hdd for hours without accessing its data.

I also found this comment:

The provided solution LVM#Suspend/resume_with_LVM_and_removable_media for deactivating VG on sleep will not work in more complex setups like LUKS on LVM. -- Pmartycz (talk) 15:00, 5 January 2020 (UTC)

Source – Talk: LVM

Do you have any ideas how to solve this problem?

Offline

#2 2023-11-10 20:58:09

frostschutz
Member
Registered: 2013-11-15
Posts: 1,647

Re: LUKS on LVM – how to manage suspend/resume on external hdd?

Can you reproduce the problem? dmesg of a failed resume? Is persist set for the relevant usb devices? https://www.kernel.org/doc/html/latest/ … rsist.html

Maybe interesting: https://bbs.archlinux.org/viewtopic.php?id=253584

cryptsetup itself has luksSuspend / luksResume but that won't help you if the USB device itself is not connected properly on resume

Last edited by frostschutz (2023-11-10 21:05:37)

Offline

#3 2023-11-10 22:03:32

goldmund
Member
Registered: 2021-02-15
Posts: 73

Re: LUKS on LVM – how to manage suspend/resume on external hdd?

frostschutz wrote:

Can you reproduce the problem? dmesg of a failed resume?

Yes! Here is the dmesg output. I can access the hdd though. (just to clarify – it's actually two hdds configured with LUKS on LVM)

frostschutz wrote:

Is persist set for the relevant usb devices? https://www.kernel.org/doc/html/latest/ … rsist.html

No, I don't think so. Well, do correct me if I am looking in the wrong place:

$ cat /sys/bus/usb/devices/2-0:1.0/power/persist
cat: '/sys/bus/usb/devices/2-0:1.0/power/persist': No such file or directory

Should I turn "persist" on then? I am not sure whether I understand the article. I like the fact that the drive stops spinning after a while and would like to keep it that way.

EDIT: Additional question: is this really bad? Does it damage the drive?

Last edited by goldmund (2023-11-10 22:05:14)

Offline

Board footer

Powered by FluxBB