14

For backup purposes, I have "snapshotted" a LVM partition. This partition was crypted so I have opened this Luks partition (snapshot) in order to do my backup.

The problem is that I have forgotten to delete the snapshot, thus it reached 100% usage.

When I try to delete the snapshot:

lvremove /dev/mapper/vgx-LogVolDBSnapshot
/dev/vgx/LogVolDBSnapshot: read failed after 0 of 4096 at 375809572864: Input/output error
/dev/vgx/LogVolDBSnapshot: read failed after 0 of 4096 at 375809630208: Input/output error
/dev/vgx/LogVolDBSnapshot: read failed after 0 of 4096 at 0: Input/output error
/dev/vgx/LogVolDBSnapshot: read failed after 0 of 4096 at 4096: Input/output error
/dev/mapper/SnapshotDecrypted: read failed after 0 of 4096 at 375807475712: Input/output error
/dev/mapper/SnapshotDecrypted: read failed after 0 of 4096 at 375807533056: Input/output error
/dev/mapper/SnapshotDecrypted: read failed after 0 of 4096 at 0: Input/output error
/dev/mapper/SnapshotDecrypted: read failed after 0 of 4096 at 4096: Input/output error
Logical volume vgx/LogVolDBSnapshot is used by another device.

That's quite normal, I have to close my Luks partition in first:

cryptsetup -v luksClose /dev/mapper/SnapshotDecrypted
Cannot read device /dev/mapper/vgx-LogVolDBSnapshot.
Command failed with code 15: Cannot read device /dev/mapper/vgx-LogVolDBSnapshot.

How can I close or delete my Luks partition in order to be able to delete the snapshot ?

Can I use "dmsetup remove /dev/mapper/SnapshotDecrypted" and then "lvremove /dev/vgx/LogVolDBSnapshot" ?

output of dmsetup

dmsetup ls
SnapshotDecrypted (253:17)
vgx-LogVolDBSnapshot (253:14)

dmsetup table
SnapshotDecrypted: 0 733999104 crypt aes-cbc-essiv:sha256 0...0 0 253:14 4096
vgx-LogVolDBSnapshot: 0 734003200 snapshot 253:15 253:16 P 8
Hauke Laging
  • 88,146
  • 18
  • 125
  • 174
Bob Sauvage
  • 311
  • 1
  • 4
  • 13
  • What is the output of `dmsetup ls` and `dmsetup table`? – Hauke Laging Feb 28 '14 at 13:31
  • 1
    Hi @HaukeLaging ! Here is the output of ls: `SnapshotDecrypted (253:17)` & `vgx-LogVolDBSnapshot (253:14)` and table: `SnapshotDecrypted: 0 733999104 crypt aes-cbc-essiv:sha256 0000000000000000000000000000000000000000000000000000000000000000 0 253:14 4096` & `vgx-LogVolDBSnapshot: 0 734003200 snapshot 253:15 253:16 P 8` – Bob Sauvage Feb 28 '14 at 13:38
  • Thanks @StephaneChazelas but I'm not able to remove the snapshot device as sayed in my first post :/ ! `Logical volume vgx/LogVolDBSnapshot is used by another device.` => It is used by the Luks partition :/ – Bob Sauvage Feb 28 '14 at 13:40
  • 7
    Sorry, I meant `dmsetup remove SnapshotDecrypted`. So yes to your last question. That is, don't luksClose it, just remove it (luksClose writes things to it (which it can't do here as the snapshot is full) and them dmsetup removes) – Stéphane Chazelas Feb 28 '14 at 13:46
  • Many thanks for the confirmation @StephaneChazelas ! – Bob Sauvage Feb 28 '14 at 14:34
  • 2
    @StephaneChazelas your comment would make a good answer! – George Udosen Dec 17 '17 at 04:44

1 Answers1

1

One solution to your problem is the following:

  1. Plug in a USB drive or attach physical storage to the system in question.
  2. Expand the VG onto the USB.
  3. You will now have enough space to luksClose
  4. Close your snapshot Remove it
  5. Use vgreduce to remove the temporary device from your volume group.
CJONES
  • 339
  • 1
  • 3