NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.
Forum Discussion
Aluz1
May 27, 2013Aspirant
Guide HOW to restore data from USB for DUO
Here is a short guide how to restore data if something nasty happened to your NAS and you need to restore system default on one of the drives and then restore the data from the other.
Basically the situation when you have two drives where fine and have your data and second is new/reused and you performed system restore/resinstall or fresh install on the new drive.
This guide is expecting that you have ssh enabled on your NAS as well as some Linux knowledge and most of all that you know what you are doing
I tried to make this as much bullet proof as possible but still please caution is advised
After your NAS is completely re-installed on one of your disks and you want to restore the data without copying it between the drives on some PC or sending them thru network you can follow this guide.
1. First backup your LVM conf:
2. Then edit the file
and add this line and comment other filter line by #
This line will help you deactivate the vg with next command
3. Refresh vg
4. Now is the vg C not active and you can rename it to A
5. Nos is vg C renamed to A and you can remove
line:
and insert line :
This will help you recognize the lvm on your drive connected thru the USB
Now execute
and
maybe you will need to restart after this change
6. Now after the restart you can connect your drive with data thru usb
and execture following command
Now you should be able to see two volume groups A and C
A is the target where we want to migrate the data and its already mounted as /c
C is the USB drive
Now we will active the C with following command
7. Now create a directory for the USB drive
8. Mount the usb drive
9. Check if you have all your data
10. Create a restore dire on your A/Target drive
11. And finally rsync all your data - in this step im expecting that your NAS is alrady properly configured and connected to the internet
After you will execute this code the rsync will start from the usb drive to your nas and after this task is completed nas will send you email with timestamp.
If your nas is not connected to the internet you can use this command:
12. After all the data are restored don't forget to disconnect your usb and restore your old lvm configuration from the backup you made at the begging
with this command
13. then restart
And that's its folks
Thanks for this post which helped to make this happen
http://www.readynas.com/forum/viewtopic.php?f=7&t=31137
Hope all this make sense, please excuse the class of this guide after a long day in the office i spend another few hours researching this and making this happen. If anyone from the Jedis wants to edit this and tide this guide or enhance it, you are welcome.
For any questions please post here don't pm me so we can share the knowledge, resolution of the issues and help others.
Going to finish my bottle of vine and take some sleep.
Good night.
Basically the situation when you have two drives where fine and have your data and second is new/reused and you performed system restore/resinstall or fresh install on the new drive.
This guide is expecting that you have ssh enabled on your NAS as well as some Linux knowledge and most of all that you know what you are doing
I tried to make this as much bullet proof as possible but still please caution is advised
After your NAS is completely re-installed on one of your disks and you want to restore the data without copying it between the drives on some PC or sending them thru network you can follow this guide.
1. First backup your LVM conf:
cp -rp /etc/lvm/lvm.conf /etc/lvm/lvm.conf.bak
2. Then edit the file
vi /etc/lvm/lvm.conf
and add this line and comment other filter line by #
filter = [ "a/loop0/", "r/.*/" ]
This line will help you deactivate the vg with next command
3. Refresh vg
vgchange -an
4. Now is the vg C not active and you can rename it to A
vgrename c a
5. Nos is vg C renamed to A and you can remove
line:
filter = [ "a/loop0/", "r/.*/" ]
and insert line :
filter = [ "a|^/dev/hd[cegikmoq][5-9]$|", "a|^/dev/hd[cegikmoq]1[0-5]$|", "a|^/dev/md[2-9]$|", "a|^/dev/sda[0-5]$|", "r|.*|" ]
This will help you recognize the lvm on your drive connected thru the USB
Now execute
vgchange -an
and
mount /dev/a/c /c
maybe you will need to restart after this change
6. Now after the restart you can connect your drive with data thru usb
and execture following command
vgscan --mknodes
Now you should be able to see two volume groups A and C
A is the target where we want to migrate the data and its already mounted as /c
C is the USB drive
Now we will active the C with following command
vgchange -ay c
7. Now create a directory for the USB drive
mkdir /mnt/usb
8. Mount the usb drive
mount /dev/c/c /mnt/usb/
9. Check if you have all your data
ll /mnt/usb
10. Create a restore dire on your A/Target drive
mkdir /c/restore
11. And finally rsync all your data - in this step im expecting that your NAS is alrady properly configured and connected to the internet
nohup rsync -av /mnt/usb/ /c/restore/ && date | mailx -s "rsync done" your@email.com -- -f from@yournas.com &
After you will execute this code the rsync will start from the usb drive to your nas and after this task is completed nas will send you email with timestamp.
If your nas is not connected to the internet you can use this command:
nohup rsync -av /mnt/usb/ /c/restore/ &
12. After all the data are restored don't forget to disconnect your usb and restore your old lvm configuration from the backup you made at the begging
with this command
mv /etc/lvm/lvm.conf.bak /etc/lvm/lvm.conf
13. then restart
shutdown -r now
And that's its folks
Thanks for this post which helped to make this happen
http://www.readynas.com/forum/viewtopic.php?f=7&t=31137
Hope all this make sense, please excuse the class of this guide after a long day in the office i spend another few hours researching this and making this happen. If anyone from the Jedis wants to edit this and tide this guide or enhance it, you are welcome.
For any questions please post here don't pm me so we can share the knowledge, resolution of the issues and help others.
Going to finish my bottle of vine and take some sleep.
Good night.
Replies have been turned off for this discussion
Related Content
NETGEAR Academy
Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology!
Join Us!