Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

My Ubuntu 11.04 machine uses LUKS encryption for root, swap and home. A routine fsck -n revealed a set of errors I need to repair. fsck requires to unmount the partitions. Before luks I would simply boot from a USB stick and fix run fsck from there. What are the steps to do that for LUKS encrypted partitions?

share|improve this question

2 Answers 2

up vote 6 down vote accepted

The exact method depends on how you have setup luks, and if you have LVM on top of luks or if you just have a filesystem within the luks volume.

If you don't have LVM in addition to luks then you would probably do something like this.

cryptsetup luksOpen /dev/rawdevice somename
fsck /dev/mapper/somename

# or

cryptsetup luksOpen /dev/sda2 _dev_sda2
fsck /dev/mapper/_dev_sda2

If you used the LVM on LUKS option providied by the Debian/Ubuntu installer, then you'll need to start up LVM. So vgchange -aly after opening the encrypted volume, then run fsck against the /dev/mapper/lvname.

share|improve this answer
    
For whatever reason cryptsetup luksOpen /dev/rawdevice somename wasn't working out to give me something to run fsck on, although it was showing up with vgscan just fine after vgchange -ay as 'active'... I had to create the raw devices manually with vgscan --mknodes and then fsck on the logical volume showing up in vgscan with fsck /dev/cryptVG/root - Hope this helps someone else out there –  Dmitri DB Nov 2 at 18:30

You need to open the LUKS volume first.

cryptsetup luksOpen /dev/(whatever) someName

This'll ask you for the password, then create /dev/mapper/someName, which is the plaintext device that you can run fsck on. When you're done,

cryptsetup luksClose someName

will remove the /dev/mapper/someName plaintext device, .

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.