How to automaticaly mount luks-partition only when disk is plugged in

Posted by Frederick Roth on Super User See other posts from Super User or by Frederick Roth
Published on 2012-09-25T07:08:53Z Indexed on 2012/09/25 9:39 UTC
Read the original article Hit count: 338

Filed under:
|
|
|

I have the following scenario:

I want to automatically backup some data from my Laptop(Fedora Core 17) to a external encrypted(luks) hard disk. The disk can be opened by a key file, which lies on the also encrypted root partition of my laptop. The hard disk is attached to my docking station and therefore only "present" when I am at home (which is approximately 1/2 of the time the Laptop runs)

I have everything set up the way I want it with one exception.

I don't get a decent way to mount the hard disk automatically at boot if and only if it is present.

If I add it to crypttab and fstab without noauto it tries to mount it at boot and takes a lot(!) of time and error messages when it is not present. If I add noauto, well it does not mount automatically ;)

Is there a way to configure luks/crypttab to do the following:

  • check whether the disk is present
  • if yes: decrypt/mount
  • if no: just don't

© Super User or respective owner

Related posts about linux

Related posts about backup