You are not logged in.

#1 2018-02-08 11:38:32

smoneck
Member
Registered: 2014-05-14
Posts: 105

[SOLVED] Can't close LVM

Hi!

I have a LVM on LUKS on a RAID1 array I can't close

~ $ cryptsetup luksOpen /dev/md0 raid
~ $ cryptsetup luksClose /dev/mapper/raid
Command failed with code -5 (device already exists or device is busy).
Device /dev/mapper/raid is still in use.

Any ideas? hmm

~ $ vgscan
  Found volume group "vg_raid" using metadata type lvm2
~ $ lsblk -f
NAME     FSTYPE LABEL   UUID                                   MOUNTPOINT
sdb                                                            
└─sdb1   linux_ computername:0
                        f3fb52fb-652a-a001-d15f-8312d2a5c63e   
  └─md0  crypto         2747c137-bc5f-4c92-95ed-3c4e9b56cf3b   
    └─raid
         LVM2_m         LcWNL6-Dgv1-W4FO-Ujvf-4gaI-KpRE-Naj49g 
      ├─vg_raid-lv00_personal
      │  ext4           3d1b71ca-4666-4b63-8c8b-9465ffb94d6a   
      └─vg_raid-lv01_public
         ext4           d0971bdd-07ff-499d-9582-55093d2c88ba   
sdc                                                            
└─sdc1   linux_ computername:0
                        f3fb52fb-652a-a001-d15f-8312d2a5c63e   
  └─md0  crypto         2747c137-bc5f-4c92-95ed-3c4e9b56cf3b   
    └─raid
         LVM2_m         LcWNL6-Dgv1-W4FO-Ujvf-4gaI-KpRE-Naj49g 
      ├─vg_raid-lv00_personal
      │  ext4           3d1b71ca-4666-4b63-8c8b-9465ffb94d6a   
      └─vg_raid-lv01_public
         ext4           d0971bdd-07ff-499d-9582-55093d2c88ba

Last edited by smoneck (2018-02-08 13:04:41)

Offline

#2 2018-02-08 12:06:32

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

Re: [SOLVED] Can't close LVM

So - can you close it after a `vgchange -a n`?

Why is LVM enabled in the first place? If you haven't done it yourself, well, with udev unfortunately there are magic events happening in the background. They activate and sometimes even mount stuff without you knowing. So raid may magically assemble itself, lvm activate itself, filesystems mount themselves, ...

It's possible to disable some of these - but other programs may depend on them to work.

For example I don't like /lib/udev/rules.d/64-md-raid-assembly.rules so I disabled them by creating empty file /etc/udev/rules.d/64-md-raid-assembly.rules - but doing such things isn't recommended unless you know what these rules do and what might expect them to work and break if they don't.

Offline

#3 2018-02-08 13:04:24

smoneck
Member
Registered: 2014-05-14
Posts: 105

Re: [SOLVED] Can't close LVM

frostschutz wrote:

So - can you close it after a `vgchange -a n`?

All right!

vgchange -a n vg_raid

did it! I knew there was some magical command I couldn't remember (and couldn't dig up).

frostschutz wrote:

Why is LVM enabled in the first place?

Yes, this must be udev-magic. Thanks for the tip but I just use vgchange then. I spend the last full three days fiddling around with fiddly software that tends to break in unforeseen circumstances -- Das udev-Fass lass ich zu. wink

Offline

Board footer

Powered by FluxBB