Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

During the last installation of Ubuntu I set up full disk encryption using the option on the installer. My disk seems to now have become corrupt, and I'd like to check it for errors.

GNOME Disks on Ubuntu 12.10 doesn't seem to be able to handle encrypted partitions yet (and Nautilus sees the disk also, but fails to mount it), so I'm looking for a way to do it on the command line.

How can I unlock my encrypted partition and check the filesystem within for errors?

share|improve this question
up vote 2 down vote accepted

I first unlocked my encrypted partition with the following command (no elevated privileges required)

udisksctl unlock -b /dev/sdb5

After being prompted, I entered the encryption passphrase na I got the Unlocked /dev/sdb5 as /dev/dm-0 message that indicated success.

And finally, I went on to do the file system check:

sudo fsck /dev/mapper/ubuntu--vg-root

And that was it! :-)

Appendix: disk setup and tips

To give some more context, here's the relevant part of the output of the lsblk /dev/sdb command: I've got a single disk, used exclusively for Ubuntu, and the encrypted partition is on /dev/sdb5. Also notice that:

  • The fdisk command does not seem to support encrypted partitions, so running th traditional sudo fdisk -l command will warn you about invalid partition tables. You can ignore those messages. Or even better:
    • Use the lsblk /dev/sdb command or sudo parted /dev/sdb print to list the partitions for the given disk (in my particular case, the disk is /dev/sdb)

Output from lsblk

$ lsblk /dev/sdb
NAME                                                 MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sdb                                                    8:128  0 111,8G  0 disk  
├─sdb1                                                 8:129  0   243M  0 part  
├─sdb2                                                 8:130  0     1K  0 part  
└─sdb5                                                 8:133  0 111,6G  0 part  
  └─luks-9cf37a83-e84a-4b85-9bba-7bcbaba8058e (dm-0) 252:0    0 111,6G  0 crypt 
    ├─ubuntu-root (dm-1)                             252:1    0 103,7G  0 lvm   
    └─ubuntu-swap_1 (dm-2)                           252:2    0   7,9G  0 lvm  

Output from parted

$ sudo parted /dev/sdi print
Model: ATA OCZ-AGILITY3 (scsi)
Disk /dev/sdi: 120GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End    Size   Type      File system  Flags
 1      1049kB  256MB  255MB  primary   ext2         boot
 2      257MB   120GB  120GB  extended
 5      257MB   120GB  120GB  logical
share|improve this answer

Your Answer


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.