51

How do I check if a partition is encrypted? In particular I would like to know how I check if /home and swap is encrypted.

3 Answers 3

41

Regarding the standard home encryption provided by Ubuntu, you can

sudo ls -lA /home/username/

and if you get something like

totale 0
lrwxrwxrwx 1 username username 56 2011-05-08 18:12 Access-Your-Private-Data.desktop -> /usr/share/ecryptfs-utils/ecryptfs-mount-private.desktop
lrwxrwxrwx 1 username username 38 2011-05-08 18:12 .ecryptfs -> /home/.ecryptfs/username/.ecryptfs
lrwxrwxrwx 1 username username 37 2011-05-08 18:12 .Private -> /home/.ecryptfs/username/.Private
lrwxrwxrwx 1 username username 52 2011-05-08 18:12 README.txt -> /usr/share/ecryptfs-utils/ecryptfs-mount-private.txt

then the username's home directory is encrypted. This works when username is not logged in, so the partition is not mounted. Otherwise you can look at mount output.

About the swap, do

sudo blkid | grep swap

and should check for an output similar to

/dev/mapper/cryptswap1: UUID="95f3d64d-6c46-411f-92f7-867e92991fd0" TYPE="swap" 
6
  • 5
    So if I get /dev/sda4: UUID="6ba2ce7b-a355-41ea-8739-2ac5d6880bac" TYPE="swap" the swap is not encrypted?
    – N.N.
    Jul 15, 2011 at 19:30
  • I suppose you're right, but my limited knowledge cannot exclude there are other swap encryption methods.
    – enzotib
    Jul 15, 2011 at 19:45
  • If you get that, your swap is definitely NOT encrypted.
    – David
    Jul 16, 2011 at 1:47
  • 5
    @ChristopherStansbury (Yes, yes, I'm more than two years late; this is for anyone that stumbles on the question in future) au contraire, the "/dev/mapper/cryptswap" implies that your swap is encrypted.
    – Darael
    Dec 2, 2013 at 15:26
  • 1
    There is no need to execute sudo ls -lA /home/username/ as root, so it should be ls -lA /home/username/
    – Akronix
    Jul 31, 2017 at 16:10
36

In addition to the answer provided by enzotib, there's the possibility of full disk encryption as provided by the alternate installer. (Also called LUKS-crypt.)

You can use sudo dmsetup status to check if there are any LUKS-encrypted partitions. The output should look something like:

ubuntu-home: 0 195305472 linear 
ubuntu-swap_1: 0 8364032 linear 
sda5_crypt: 0 624637944 crypt 
ubuntu-root: 0 48824320 linear

The line marked "crypt" shows that sda5 has been encrypted. You can see which filesystems are on that via the lvm tools.

In the case of LUKS encryption, the Disk Utility in Ubuntu will also show the encryption layer and the configuration in a graphical manner.

1
  • 20
    what about if I get No devices found ?
    – Akronix
    Nov 19, 2015 at 11:48
15

To check the encrypted swap status and cipher details, use this cmd:

$ sudo cryptsetup status /dev/mapper/cryptswap1
/dev/mapper/cryptswap1 is active and is in use.
  type:    PLAIN
  cipher:  aes-cbc-essiv:sha256
  keysize: 256 bits
  device:  /dev/sda2
  offset:  0 sectors
  size:    8388608 sectors
  mode:    read/write

Your swap device name may be different, you can check the proper name by:

$ swapon -s
Filename                Type        Size    Used    Priority
/dev/mapper/cryptswap1  partition   4194300 0       -1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .