[SOLVED] LUKS data recovery

General support questions
Post Reply
crimson30
Posts: 3
Joined: 2015/07/04 23:34:30

[SOLVED] LUKS data recovery

Post by crimson30 » 2015/07/05 00:02:46

Using a RAID 1 setup (hardware RAID, Adeptec 6405E), my server booted fine, but I noticed the RAID array was degraded, so I went into the RAID controller setup and ran Verify Disk Media to get it back to optimal (lesson learned: back everything up first next time).

Now it shows optimal for the RAID array, but when it boots, it first prompts me with the password for LUKS, but then it drops into emergency mode, with:

end_request: critical target error, dev sda. sector 3795020672
Buffer I/O error on device dm-2, logical block 16

It shows that a number of times with the same sector and then "Failed to mount /sysroot"

So, then I pulled the 2 SAS drives and booted to a Gnome LiveCD (7.0, same as installation).

I get some warnings "Could not boot.", "/dev/disk/by-label/CentOD-7-livecd-GNOME-x86_64 does not exist", "/dev/mapper/live-rw does not exist" and the liveCD also drops into emergency mode.

Is there a good boot disk I could use to maybe retrieve at least some of my recent files? Unfortunately, I haven't backed up since last October.
Last edited by crimson30 on 2015/07/05 13:07:25, edited 4 times in total.

User avatar
TrevorH
Site Admin
Posts: 33220
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Newbie - emergency mode

Post by TrevorH » 2015/07/05 00:05:23

Please check the md5sum of your downloaded iso image matches the one in the text files on the download site. If you burnt that to a real DVD then check that it burnt correctly, if you used a USB stick then try a different one.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

crimson30
Posts: 3
Joined: 2015/07/04 23:34:30

Re: Newbie - emergency mode

Post by crimson30 » 2015/07/05 00:19:52

Downloaded image from riken. MD5 check was good.

Verified after burning (using ImgBurn).

I get that same error booting to this second liveCD ("Could not boot.", "/dev/disk/by-label/CentOD-7-livecd-GNOME-x86_64 does not exist", "/dev/mapper/live-rw does not exist").

Is there something maybe a little better suited for recovery?
Last edited by crimson30 on 2015/07/05 02:38:53, edited 1 time in total.

crimson30
Posts: 3
Joined: 2015/07/04 23:34:30

Re: Newbie - emergency mode

Post by crimson30 » 2015/07/05 02:30:50

Downloaded and burned the latest rescue CD from sysresccd.org. It boots without issue.

Problem is, I only know command line basics (cd, ls, cat, grep, chmod and the like). I'm not sure where to start for messing with disks.

I started using instructions at: https://alvinabad.wordpress.com/2012/09 ... pted-disk/

For parted -l (somewhat summarize since I'm typing it)

Code: Select all

Disk /dev/sda: 1997GB
Sector size: 512B/512B
Partition Table: msdos
Disk Flags:

Number   Start     End    Size Type     File system Flags
1       1049kB   525MB   524MB primary  xfs         boot
2        525MB  1997GB  1997GB primary
For fdisk -l /dev/sda

Code: Select all

Disk /dev/sda: 1.8 TiB, 1997149306800 bytes, 3900682240 sectors
Units: sectors of 1*512 = 512 bytes
Sector size: 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00004bc7

Device     Boot Start    End        Sectors     Size    Id   Type
/dev/sda1  *    2048     1026047    1024000     500M    83   Linux
/dev/sda2       1026048  3900682239 3899656192  1.8T    83   Linux
EDIT:

I successfully mounted the volume using the following commands:

Code: Select all

cryptsetup -v luksOpen /dev/sda2 sda2_crypt
lvdisplay    <--- showed /dev/centos/home, which is the volume of interest
vgchange -a y centos
cd /
mkdir /tmp/disk
mount /dev/centos/home /tmp/disk
Next, I went to /dev and ran ls. Then I plugged in a Seagate goflex drive and ran ls again, noticing that it added sdb/sdb1.

I was able to mount that as well and copy the data over:

Code: Select all

mkdir /tmp/goflex
mount /dev/sdb1 /tmp/goflex
mkdir /tmp/goflex/2015
cp -r /tmp/disk/blahblahblah /tmp/goflex/2015 
Thanks for the sounding board!

Post Reply