LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 04-04-2017, 12:21 PM   #1
nixanwin
LQ Newbie
 
Registered: Mar 2010
Posts: 24

Rep: Reputation: 0
How to replace failed crypto_luks disk in rhel


Hi All, I inherited a RHEL system with encrypted data disks (JBOD). One of the data disks (not OS) have failed and I am not sure the process to replace it. Do I just umount the current drive, then replacement it? Do I have to re-encrypt the new drive? I have the current password. Any steps would be appreciated.

Kind Regards,
Mike
 
Old 04-04-2017, 12:56 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
How close it needs to look like the previous drive depends on what your backup/restore system expects. If you want it to be as close as possible, you need to recreate partitions, logical volumes, and encrypted areas to match the old drive.
 
Old 04-04-2017, 01:18 PM   #3
nixanwin
LQ Newbie
 
Registered: Mar 2010
Posts: 24

Original Poster
Rep: Reputation: 0
It's just a single formatted drive with no partitions. The entire disk is encrypted. So would I just yank the failed disk and add the new one, then format and re-encrypt it? I wasn't sure if there were some steps to do before pulling the failed disk. Thanks
 
Old 04-04-2017, 07:33 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
JBOD implies, to me at least, multi disk - that means usually RAID and/or LVM (ignoring ZFS and btrfs). As smallpond mentioned you need to understand, and explain to us, your environment better.
If it is a single disk, I see no harm in just yanking it - but I'd want to be real sure I was right before I did. "lsblk" might be a good start.
 
Old 04-05-2017, 08:05 AM   #5
nixanwin
LQ Newbie
 
Registered: Mar 2010
Posts: 24

Original Poster
Rep: Reputation: 0
Yes it is a single disk as I mentioned above. There are 9 "single" basic (not LVM) disks in the server. The only disks with raid is the OS which is not encrypted. I've never dealt with a crypto disk so did not know if there were steps I should take before pulling it. And what is needed when I add it back.

Thanks
 
Old 04-05-2017, 08:45 AM   #6
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
The output from "lsblk -f" would be helpful (adding "-f" to what syg00 suggested). Without that, it's impossible to give accurate advice.

Is this a data recovery situation, or just a "replace disk and restore from backup" scenario?
 
Old 04-05-2017, 09:54 AM   #7
nixanwin
LQ Newbie
 
Registered: Mar 2010
Posts: 24

Original Poster
Rep: Reputation: 0
# lsblk -f
Code:
NAME        FSTYPE      LABEL UUID                                 MOUNTPOINT
sde         crypto_LUKS       a7163f0c-44c9-4670-9707-20c25545ccb9  /data/04
└─04 (dm-3) ext4              908c1a3e-3509-497d-a95d-2e4a46095a99
(there are other mount points but I removed them from the output here). /data/04 is the one in question)

Last edited by nixanwin; 04-05-2017 at 09:55 AM.
 
Old 04-05-2017, 11:25 AM   #8
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
OK, you just need to connect the new disk, run "lsblk" to see which drive it's being seen as, and run (replacing "{X}" with the appropriate letter):
Code:
cryptsetup luksFormat /dev/sd{X}
cryptsetup luksOpen /dev/sd{X} newdisk
mkfs.ext4 /dev/mapper/newdisk
Once you have loaded your data into the new filesystem, you will probably need to adjust the UUIDs in /etc/crypttab and /etc/fstab to reference the new disk. You can get the new values from the output of "lsblk -f" while the new drive is connected and unlocked.
 
Old 04-05-2017, 12:22 PM   #9
nixanwin
LQ Newbie
 
Registered: Mar 2010
Posts: 24

Original Poster
Rep: Reputation: 0
Thank you kindly. I will try that.
 
  


Reply



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
my root partition disk got failed can i replace it?? mohdsuboor23 Linux - Hardware 1 11-14-2010 01:42 AM
Replace failed LVM mirror leg eldo Linux - Server 1 11-20-2009 02:19 AM
Failed to sync one or more sources: Failed to write some configuration data to disk ganeshbatwal Linux - Software 2 11-06-2008 10:05 AM
Debian for production server? Replace RHEL? toben Linux - Enterprise 6 07-19-2008 06:44 AM
A harddrive failed in my raid array, how do I replace it? abefroman Linux - Hardware 2 09-23-2005 04:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 12:06 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