LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 09-20-2018, 03:00 AM   #1
Delcaran
Member
 
Registered: Dec 2013
Location: ud.fvg.it
Distribution: Slackware64 14.2
Posts: 44

Rep: Reputation: 27
Question Use secondary encrypted hard drive


Hi everyone!
Yesterday I bought an SSD to give some fresh air to my old laptop, so now I have a spare HDD to use. Since my laptop has two SATA slots, I want to double it's memory using both drives on it.

The main one, the SSD, is encrypted with LUKS+LVM as described in the official docs. I want to encrypt the HDD, create one big partition on it (this disk will contain only "static", seldom-accessed files, like photos, videos, music, backups and archives, with folders symlinked to my /home on the other drive) and mount it at boot WITHOUT asking for another password.

The optimal solution could be encrypting the drive with a password, save that password on a file in the encrypted SSD (which is mounted first), and mount the HDD reading the encryption password from that file on the SSD, which at this point is already accessible.
A less optimal solution could be using a keyfile, but with this approach I couldn't be able to mount the HDD without the SSD...

So, how can I do that?
And also, is the single partition with simlinked folders a good solution? Do you have better suggestions? I'm open minded!

Thanks in advance!
 
Old 09-20-2018, 03:28 AM   #2
Melke
Member
 
Registered: Sep 2009
Location: Graz, Austria
Distribution: Slackware Current
Posts: 106

Rep: Reputation: 45
Hi!

You can achieve this by using a keyfile. I used this tutorial when I did this the first time:
https://tutorials.technology/tutoria...to-fedora.html

Its for fedora but works just as well on slackware.

Kr
Melke
 
Old 09-20-2018, 03:47 AM   #3
gildbg
Member
 
Registered: Aug 2017
Distribution: Slackware, OpenBSD
Posts: 156

Rep: Reputation: Disabled
It's good howto. You need to ask your self did you really want it. I read on some sites and one of the problems that ppl point is: If bad sector appear after a while on the sectors where is your LUKS technical data and keys, you will unable to mount your partitions ever, but don't know if that is the true.

Last edited by gildbg; 09-20-2018 at 03:49 AM.
 
Old 09-20-2018, 03:51 AM   #4
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
Quote:
Originally Posted by gildbg View Post
It's good howto. You need to ask your self did you really want it. I read on some sites and one of the problems that ppl point is: If bad sector appear after a while on the sectors where is your LUKS technical data and keys, you will unable to mount your partitions ever, but don't know if that is the true.
When your disk develops bad sectors there's a risk of data loss always, not just with a LUKS encrypted disk. A LUKS disk which you can no longer decrypt is 100% data loss at once of course, but if you do not have a backup strategy and hope that your hard disk will live forever, you will eventually have a big problem.
The stuff you can not afford to lose, make sure you back it up regularly.
 
1 members found this post helpful.
Old 09-20-2018, 03:56 AM   #5
gildbg
Member
 
Registered: Aug 2017
Distribution: Slackware, OpenBSD
Posts: 156

Rep: Reputation: Disabled
Yes,
you just point with a little more words what I trying to say. It's will lose all data not only one picture.
 
Old 09-20-2018, 04:21 AM   #6
lougavulin
Member
 
Registered: Jul 2018
Distribution: Slackware,x86_64,current
Posts: 279

Rep: Reputation: 100Reputation: 100
In your backup strategy, save LUKS headers. That should help to not lose all LUKS data.
 
2 members found this post helpful.
Old 09-24-2018, 02:42 AM   #7
Delcaran
Member
 
Registered: Dec 2013
Location: ud.fvg.it
Distribution: Slackware64 14.2
Posts: 44

Original Poster
Rep: Reputation: 27
I did it using /etc/crypttab to decrypt the drive and /etc/fstab to mount the mapped partition.

Security-wise, the LUKS volume is encrypted with a password stored plain-text in the /etc/crypttab file, which resides in my primary encrypted drive. This way I can mount the secondary drive wherever I need, and the key is still safe when the primary drive is not mounted. Of course I must assume the root drive is not compromised...

As for backup, all the data I care for has at least two replicas across my "hot" drives and one extra in a "cold" drive updated every 3 months. Plus, I'm looking forward to an online backup service (like Backblaze B2) to encrypt and upload my data with rclone.

I think my setup works fine for my kind of situation...
 
Old 09-24-2018, 06:19 PM   #8
drgibbon
Senior Member
 
Registered: Nov 2014
Distribution: Slackware64 15.0
Posts: 1,220

Rep: Reputation: 942Reputation: 942Reputation: 942Reputation: 942Reputation: 942Reputation: 942Reputation: 942Reputation: 942
Quote:
Originally Posted by lougavulin View Post
In your backup strategy, save LUKS headers. That should help to not lose all LUKS data.
Yep, you definitely want to backup the LUKS headers, check out "luksHeaderBackup" in the cryptsetup man page. If the header becomes corrupted (without a backup) then all encrypted data is irretrievable.
 
  


Reply

Tags
boot, encryption, luks, lvm



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mount point of encrypted secondary hard drive EStyles Linux - General 7 10-15-2015 01:28 PM
Booting Windows on secondary hard drive with Grub on primary drive mpmackenna Linux - General 1 11-09-2008 06:16 PM
Ubuntu - Secondary Hard Drive 200mg Linux - Newbie 2 02-22-2008 08:47 AM
Adding New Hard Drive as Secondary Master derek8128 Linux - Newbie 4 10-24-2005 08:46 AM
formatting a secondary hard drive Bronzzy Linux - Newbie 2 03-27-2004 11:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 07:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration