Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm having trouble mounting my LUKS-encrypted backup partition which resides in /dev/sdb1

When I boot my PC, the mapper prompts for the key and mounts a /dev/mapper/backupdrive which I can mount/umount and write to, no problem there.

When I unmount and close this mapping (cryptsetup luksClose), I can no longer open a new mapping (in other words, I am unable to access the data on that partition). Both luksOpen and luksDump give the following response:

$ sudo cryptsetup -v luksDump /dev/sdb1
Device /dev/sdb1 is not a valid LUKS device.

$ sudo cryptsetup -v luksOpen /dev/sdb1 backupdrive
Device /dev/sdb1 is not a valid LUKS device.

When I try to mount the /dev/sdb1 directly without dm mapping, no valid file system is recognized, so I assume the partition is indeed encrypted as should. (When I reboot the PC, I can again mount the auto-generated /dev/mapper/backupdrive, so I suppose no disk corruption is in the game)

The output of fdisk -l is the following:

$ sudo fdisk -l
Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xa8a8a8a8

 Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1        5384    43246948+   7  HPFS/NTFS
/dev/sda2            5385       14594    73972737    5  Extended
/dev/sda5   *        5385       14477    73031680   83  Linux
/dev/sda6           14477       14594      940032   82  Linux swap / Solaris

Disk /dev/sdb: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x07620762

Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1        9729    78148161    7  HPFS/NTFS

Any hints on what the problem might be?

EDIT:

As requested, the output of blkid:

$sudo blkid
/dev/sda1: UUID="5230B51530B50151" TYPE="ntfs" 
/dev/sda5: UUID="636e1d51-d19e-42ee-8061-97a47b1137c4" TYPE="ext3" 
/dev/sda6: UUID="ad99fca0-db32-4339-b4c0-99f9deda3145" TYPE="swap" 

(sda1 is my windows installation, sda5 my linux installation and sda6 is the swap).

I'm pretty sure /dev/sdb1 is where the luks-encrypted drive should be, as this is the drive that is mapped according to crypttab:

# <target name> <source device>     <key file>  <options>
backupcrypt     /dev/sdb1           none        none

EDIT 2: as requested, I added the full output of "fdisk -l"

EDIT 3: When I boot the PC and mount the /dev/mapper/backupcrypt that was created during the boot process, I get the following output for sudo blkid:

$ sudo blkid
/dev/sda1: UUID="5230B51530B50151" TYPE="ntfs" 
/dev/sda5: UUID="636e1d51-d19e-42ee-8061-97a47b1137c4" TYPE="ext3" 
/dev/sda6: UUID="ad99fca0-db32-4339-b4c0-99f9deda3145" TYPE="swap" 
/dev/mapper/backupcrypt: UUID="eb684a3d-2cfc-4a89-bf8e-0bf7e3e01868" TYPE="ext3" 

and dmesg indicates the encrypted partition was properly mounted:

$ dmesg | tail
[   90.565150] kjournald starting.  Commit interval 5 seconds
[   90.568469] EXT3 FS on dm-0, internal journal
[   90.568479] EXT3-fs: mounted filesystem with ordered data mode.

When I umount and luksClose the mapping, I get no additional dmesg output. When I then try to luksOpen it again, I get the "not a valid LUKS device" error again, but no additional dmesg output.

share|improve this question
1  
Welcome to Ask Ubuntu! Are you sure sdb is the drive you want to access? It appears to have an NTFS partition instead! Please note that the naming of the drives change if you have other drives present at other times. Therefore, always use UUIDs. Please provide the output of sudo blkid in your question to identify all the volumes on your system as well as a guess on what kind of volume it is. –  gertvdijk Jul 3 '13 at 18:43
    
Post the output of fdisk -l –  bodhi.zazen Jul 3 '13 at 18:48
    
Thanks for the response! Is it normal the /dev/sdb1 is not showing up in the /dev/disk/by-uuid or blkid ? –  FrancoisG Jul 3 '13 at 18:57
    
Are you really sure that you included the full output of sudo blkid? It omits the sdb1 partition there... I don't see any partition that appears to be a LUKS volume here, I'm afraid. If you just assigned the wrong partition type identifier then sudo cryptsetup -v luksDump /dev/sdb1 should just work anyway. Are you really sure your drive is recognized by the system and is it working properly? Check your kernel logs (dmesg) for SATA bus errors and the SMART diagnostics for your drive. –  gertvdijk Jul 3 '13 at 18:58
    
It is indeed the full output of sudo blkid. I am not fully sure how fdisk determines the type is NTFS ? I am sure the drive is working properly: I can mount the /dev/mapper/backupcrypt when booted, and copy data from/to it. –  FrancoisG Jul 3 '13 at 19:29
show 1 more comment

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.