How to recover your Thecus RAID in a PC
Oct 28, 2010 11:02:45 GMT 7
prayogi2k, ilovearctra, and 2 more like this
Post by Arctra on Oct 28, 2010 11:02:45 GMT 7
Hi guys.
Just recently I had my N5200 die on me. I am pretty sure it was the DOM that failed, but whatever it was I could no longer access my data. I couldn't find much info on how to recover the data, just that it was possible thanks to Thecus using Linux on this box. In the end I figured it out and have recovered the data, so thought others might appreciate a little HOWTO.
I am no Linux guru, and cannot say for certain the process I went through will work for you.
First up, I got a new motherboard that would support 6 SATA drives. I went with a Gigabyte GA-965G-DS3, put in 2GB of RAM, and old hard drive and a Core 2 Duo. Using unetbootin I created a bootable USB key with Ubuntu 8.04 on it. When I fired up the machine with the USB key plugged in I had trouble booting from the USB key. The trick with the mobo I was using is to hit F12 just after turning the machine on (so while is it doing it's POST) to bring up the Boot Menu. From there I selected Hard Drive (as counter intuitive as that sounds) and then selected the USB key. It booted to the Ubuntu menu where I selected to Install Ubuntu on the old hard drive. NOTE: The HDD's from my RAID were NOT plugged in at this stage! If they were plugged in Ubuntu threatens to change their partition tables - I don't know if it actually will, but it's not worth taking the chance. Once Ubuntu was installed I updated it using the Update Manager (System->Administration->Update Manager) then installed an App called "Stress" and stress tested the machine overnight using one of the compression benchmarkers.
In the morning the machine was stable so I went about preparing it for the recovery. First up I had to install mdadm and LVM2 with the following commands in a terminal window:
At this point I realised I was going to get tired of using sudo all the time so did a BAD thing and reset the su password so I could just switch user to root and work from there as follows:
Once I had set the su password I was ready to shut the PC down and plug in the hard drives from my Thecus. Once I carefully did that and fired it up again it wouldn't boot. It turns out this was because I had to go into the BIOS and under the Advanced setting change the hard drive boot order so that it wasn't trying to boot from one of the RAID HDD's that didn't have an OS on them. Once I had put my old HDD with Ubuntu on it to the number 1 slot I booted into Ubuntu without incident. I then openned up a terminal window and switched user to do everything as root.
Now we use mdadm to find our RAID array on the hard drives as follows
This should show details of your RAID array and associated devices. Assuming it has managed to find the arrays like it did for me, it's time to assemble the RAID array with the following command
You don't have to use the verbose switch, but I like to know there's something going on. Once you've finished the assmebly it's time to check that it was successful with this command
This should give a readout of the "md" devices which should include your RAID arrays (md0, md1, md2, etc). If your array's show up in the md's then you're half way there! Now it's time to work on the "Volumes" as Thecus/Linux use the LVM2 volumes. First up, we scan for the volumes with this command
Running that command should make Linux recognise that you don't have an LVM config file, so it recovers one from you RAID array and puts it in /etc/lvm/backup for you. Now, thanks to Thecus for not using the default naming scheme for the volumes (which is "VolGroup01", "VolGroup02", etc) we don't have to worry about renaming the volume groups. Thecus name the volume groups "vg0", "vg1", etc. SO we just need to restore the LVM config file from the one backed up for us by vgscan using these commands
This assumes the volume group config file in the /etc/lvm/backup directory is vg0. running the vgscan command again simply verifies that the volume groups have been found. Now we scan for the physical volumes using
This should list the physical volumes along with their size for you. Now we need to Activate the volume, but not before we load the appropriate kernel module in (otherwise you'll hit a brick wall like I did for a while:
With the dm-mod module loaded we can activate the volume with this command
With that you should get a confirmation that the volume is now active. Now we scan for the logical volumes
That should list the active logical volumes along with their sizes etc in the format "lv0", "lv1", etc (again, Thecus don't seem to have used the Linux default logigical volume naming scheme which is "LogVol00", "LogVol01", etc). We can now mount the volumes
And with a bit of luck, you should now be able to access your precious data in the "/mnt" directory.
The only step left now is to install and set up Samba so you can access the data on your network. There are plenty of guides out there for that though, so just Google "Ubuntu Samba" or the like and do it. (I used this one - www.howtogeek.com/howto/ubuntu/install-samba-server-on-ubuntu/)
Now, this is not a permanent solution, but it should allow you to access the data and put it somewhere else while you try and figure out the best way forward. If you want to make it a permanent solution, you'll probably need to find a way of automatically mounting the volumes every time you reboot. I don't know, I haven't rebooted yet. Once I have recovered all my data I may play some more, but for now this will do.
Useful links that helped me in my journey:
Recovery of RAID and LVM2 Volumes - www.linuxjournal.com/article/8874?page=0,0 (contains WAY more info than I needed, but was the main guide I used)
Ubuntu livecd mount LVM2 fs - johnsofteng.wordpress.com/2010/01/28/ubuntu-livecd-mount-lvm2-fs/ (Very good and simple guide that I relied on heavily)
Mounting LVM Disk using Ubuntu livecd - linuxwave.blogspot.com/2007/11/mounting-lvm-disk-using-ubuntu-livecd.html
MDADM man page - linuxmanpages.com/man8/mdadm.8.php
MDADM Raid 5 Repair Help - ubuntuforums.org/showthread.php?t=958369
Install Samba Server on Ubuntu - www.howtogeek.com/howto/ubuntu/install-samba-server-on-ubuntu/
Just recently I had my N5200 die on me. I am pretty sure it was the DOM that failed, but whatever it was I could no longer access my data. I couldn't find much info on how to recover the data, just that it was possible thanks to Thecus using Linux on this box. In the end I figured it out and have recovered the data, so thought others might appreciate a little HOWTO.
I am no Linux guru, and cannot say for certain the process I went through will work for you.
First up, I got a new motherboard that would support 6 SATA drives. I went with a Gigabyte GA-965G-DS3, put in 2GB of RAM, and old hard drive and a Core 2 Duo. Using unetbootin I created a bootable USB key with Ubuntu 8.04 on it. When I fired up the machine with the USB key plugged in I had trouble booting from the USB key. The trick with the mobo I was using is to hit F12 just after turning the machine on (so while is it doing it's POST) to bring up the Boot Menu. From there I selected Hard Drive (as counter intuitive as that sounds) and then selected the USB key. It booted to the Ubuntu menu where I selected to Install Ubuntu on the old hard drive. NOTE: The HDD's from my RAID were NOT plugged in at this stage! If they were plugged in Ubuntu threatens to change their partition tables - I don't know if it actually will, but it's not worth taking the chance. Once Ubuntu was installed I updated it using the Update Manager (System->Administration->Update Manager) then installed an App called "Stress" and stress tested the machine overnight using one of the compression benchmarkers.
In the morning the machine was stable so I went about preparing it for the recovery. First up I had to install mdadm and LVM2 with the following commands in a terminal window:
sudo apt-get install mdadm
sudo apt-get install lvm2
At this point I realised I was going to get tired of using sudo all the time so did a BAD thing and reset the su password so I could just switch user to root and work from there as follows:
sudo su
sudo passwd
Once I had set the su password I was ready to shut the PC down and plug in the hard drives from my Thecus. Once I carefully did that and fired it up again it wouldn't boot. It turns out this was because I had to go into the BIOS and under the Advanced setting change the hard drive boot order so that it wasn't trying to boot from one of the RAID HDD's that didn't have an OS on them. Once I had put my old HDD with Ubuntu on it to the number 1 slot I booted into Ubuntu without incident. I then openned up a terminal window and switched user to do everything as root.
su
Now we use mdadm to find our RAID array on the hard drives as follows
mdadm --examine --scan
This should show details of your RAID array and associated devices. Assuming it has managed to find the arrays like it did for me, it's time to assemble the RAID array with the following command
mdadm --assemble --scan --verbose
You don't have to use the verbose switch, but I like to know there's something going on. Once you've finished the assmebly it's time to check that it was successful with this command
cat /proc/mdstat
This should give a readout of the "md" devices which should include your RAID arrays (md0, md1, md2, etc). If your array's show up in the md's then you're half way there! Now it's time to work on the "Volumes" as Thecus/Linux use the LVM2 volumes. First up, we scan for the volumes with this command
vgscan
Running that command should make Linux recognise that you don't have an LVM config file, so it recovers one from you RAID array and puts it in /etc/lvm/backup for you. Now, thanks to Thecus for not using the default naming scheme for the volumes (which is "VolGroup01", "VolGroup02", etc) we don't have to worry about renaming the volume groups. Thecus name the volume groups "vg0", "vg1", etc. SO we just need to restore the LVM config file from the one backed up for us by vgscan using these commands
cd /etc/lvm/backup
vgcfgrestore -f vg0 vg0
vgscan
This assumes the volume group config file in the /etc/lvm/backup directory is vg0. running the vgscan command again simply verifies that the volume groups have been found. Now we scan for the physical volumes using
pvscan
This should list the physical volumes along with their size for you. Now we need to Activate the volume, but not before we load the appropriate kernel module in (otherwise you'll hit a brick wall like I did for a while:
modprobe dm-mod
With the dm-mod module loaded we can activate the volume with this command
vgchange vg0 -a y
With that you should get a confirmation that the volume is now active. Now we scan for the logical volumes
lvscan
That should list the active logical volumes along with their sizes etc in the format "lv0", "lv1", etc (again, Thecus don't seem to have used the Linux default logigical volume naming scheme which is "LogVol00", "LogVol01", etc). We can now mount the volumes
mount /dev/vg0/lv0 /mnt/
And with a bit of luck, you should now be able to access your precious data in the "/mnt" directory.
The only step left now is to install and set up Samba so you can access the data on your network. There are plenty of guides out there for that though, so just Google "Ubuntu Samba" or the like and do it. (I used this one - www.howtogeek.com/howto/ubuntu/install-samba-server-on-ubuntu/)
Now, this is not a permanent solution, but it should allow you to access the data and put it somewhere else while you try and figure out the best way forward. If you want to make it a permanent solution, you'll probably need to find a way of automatically mounting the volumes every time you reboot. I don't know, I haven't rebooted yet. Once I have recovered all my data I may play some more, but for now this will do.
Useful links that helped me in my journey:
Recovery of RAID and LVM2 Volumes - www.linuxjournal.com/article/8874?page=0,0 (contains WAY more info than I needed, but was the main guide I used)
Ubuntu livecd mount LVM2 fs - johnsofteng.wordpress.com/2010/01/28/ubuntu-livecd-mount-lvm2-fs/ (Very good and simple guide that I relied on heavily)
Mounting LVM Disk using Ubuntu livecd - linuxwave.blogspot.com/2007/11/mounting-lvm-disk-using-ubuntu-livecd.html
MDADM man page - linuxmanpages.com/man8/mdadm.8.php
MDADM Raid 5 Repair Help - ubuntuforums.org/showthread.php?t=958369
Install Samba Server on Ubuntu - www.howtogeek.com/howto/ubuntu/install-samba-server-on-ubuntu/