[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to attach a fully encrypted drive to Stretch



Hi!
I believe, first of all is to check, how youz device is seen at the usb-port.

As root start "tail -f /var/log/syslog" and then plugin your device. Check the 
messages.

When you know the device, check the partionin. Just start "fdisk" and print 
out your partitions. Be careful, not to change anything!

End fdisk, then open your encrypted partition (i.e. sdc3) using 
"cryptsetup luksOpen /dev/sdc3 somename" and enter your correct password.

The term "somename"  can freely be chosen, I personally are using something 
like "usr2" or "home2" whatever.

When your device is opened, you can mount it somewhere, I am using 
either "/mnt" or create a new directory (i.e. /disk1)

So, mount it using "mount /dev/mapper/somename /mnt".

Once it is mounted, you can either copy your files, or better use rsync. With 
rsync rights are kept and symlinks are also transferred. And you have the 
capability to transfer via network. The syntax is "rsync -avz /sourcedir /
targetdir" Note that a missing slash after "/sourcedir" will copy the 
sourcedir, too. If this is not wanted, then add a slash after sourcedir like 
this one: "rsync -avz /sourcedir/ /targetdir".

In our example to copy the whole drive this would be now:
"rsync -avz /mnt/ /path/to/your/backupdirectory"

Hope this helps. Please feel free to ask for more.

Best regards

Hans  
> Which one you mount depends, of course, on where device mapper has
> put the device file. With the cryptsetup above, on my box, the device
> file would appear in /dev/mapper/disk2, for example.
> 
> In most cases, the vgchange happens automagically[1]. For my encrypted
> backups, I do, for example
> 
>   # NOTE change /dev/sdb by whatever device the stick/external drive
>   #      "appears" as:
>   sudo cryptsetup luksOpen /dev/sdb backup
>   sudo mount /dev/mapper/backup /media/backup
>   rsync ... /home /media/backup/myself/home
>   sync
>   sudo umount /media/backup
>   sudo cryptsetup luksClose backup
> 
> (of course, the rsync ... is actually a script and a tad more complicated,
> but you get the idea).
> 
> NOTE: I have there /dev/sdb -- this is an unpartitioned disk with one big
> LUKS volume on it. This is a bit unconventional; in your case you might
> have one partition (e.g. /dev/sdb1).
> 
> Cheers
> 
> [1] I must admit that I don't know *who* is actually doing that for
>     me :-)
> -- tomás



Reply to: