LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 07-07-2009, 07:47 AM   #1
rholme
Member
 
Registered: May 2008
Posts: 47

Rep: Reputation: 15
restoring a backup


I currently do a full backup periodically to an external disk drive.

I would like to know how to restore from that drive in the event of failure.

Years ago using Sun OS, I was able to boot up to something called mini-unix (a totally memory resident version of the OS) and from there I could use the following sequence to restore the system.
a) make new file systems (2 using "newfs" - one with the "install boot option")
b) mount the file systems on two newly made directories (e.g. /a and /b)
c) go to each of the directories and issue the "restore" command
(I used a tape OR piped the output from dump on another machine over the net)
d) sync, sync
AND VOILA

I believe most of this is do-able now but am scared to try (I only have one box right now). I don't know how to stop the installation and mount my external disk drive to get the backup DUMP file. I am also unsure if the intermediated running fedora kernel is memory resident or depends on the DVD (suspect latter), as I could copy the dump file to a DVD and restore from there as an alternative.

This seems like one of the most important things that one needs to know as an administrator. I am really scared of having to rebuild all the software installed on this box. Things fail and it is really nice to know you can get it all back.

Thanks for suggestions, clues, ..
 
Old 07-07-2009, 09:27 AM   #2
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 331Reputation: 331Reputation: 331Reputation: 331
I agree with you that maintaining good backups is an important part of being a GOOD system administrator.

I applaud you for being proactive and wanting to test your backups before you have a disaster that requires you to rebuild your server (hopefully from backups).

It sounds like we have a lot in common.

You didn't mention what type of hardware you are using or if your 'one box' is a test machine or if you are doing this on a server in work or at home. You also didn't mention how you perform a backup. I'm going to guess that since you are coming from a UNIX background you either use dd or tar to backup the entire spindle at once via a disk partition that spans all of the other disk partitions. (I never liked that method.)

If possible get a second disk. This will be great to use for testing your system rebuild procedure. Disks today are really affordable. Even SCSI disks are becoming reasonably priced as better performing disks in the ATA class are invented.

Since there are so many unanswered questions I'm going to stop here. At a minimum you should try to get a spare disk to experiment on.
 
Old 07-07-2009, 03:42 PM   #3
rholme
Member
 
Registered: May 2008
Posts: 47

Original Poster
Rep: Reputation: 15
Terribly sorry, I thought that I said I used "dump" to make a full backup and planned to use "restore" to get it back (tar is great but not for special files, dump does it all). Secondly I do have a second disk - it is an external drive (WD passport to be particular). I am able to keep several backups on this drive with the option to go back to any of them and yes I have used them to get files I have lost. I could get another hard drive, but that seems to be overkill.

So assuming I bring up fedora from the installation dvd, I would plan to stop the installation and get to single user mode (how - not sure yet, but I knew how to do this with Unix and Sun OS). Then I would mount the external disk; make the partitions needed on the hard drive; mount them; cd to them individually - there are two; and restore.

I am looking for advice on how to
a) get to single user mode
b) mount the external hard disk
c) make sure /boot has a boot blocks

As an alternate plan, I could put my restore set on a DVD and restore from that, but fear that the running Linux kernel will be needing the installation DVD in place.

Note: I used to do this using a tape drive OR a combination of "rsh dump" from an alternate system (neither is an option on this box). I could copy the dump file to an old Sun and use the local net, but that seems a crazy waste.

Thanks for your thoughts. I only have one box here, but elsewhere there are many boxes that could benefit from this strategy. In the alternate world with many boxes, all of the machines are backed up to the same external disk, making restore of any easy and one movable backup that can be put in a fire proof box.
 
Old 07-07-2009, 05:08 PM   #4
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 331Reputation: 331Reputation: 331Reputation: 331
Quote:
Originally Posted by rholme View Post
Terribly sorry, I thought that I said I used "dump" to make a full backup and planned to use "restore" to get it back (tar is great but not for special files, dump does it all).
My mistake. You did say that.

Quote:
Originally Posted by rholme View Post
Secondly I do have a second disk - it is an external drive (WD passport to be particular). I am able to keep several backups on this drive with the option to go back to any of them and yes I have used them to get files I have lost. I could get another hard drive, but that seems to be overkill.
I meant another disk to use as the target of the restore. A good experiment requires that you disconnect the production disk and replace it with a test disk. That way you can see if all of the software works on the new disk. I am essentially suggesting a "fire drill" where the production disk is not used, just as if it had broken and were being replaced.

You still didn't mention what hardware architecture you are using. There may be some specific differences in a good procedure on different hardware platforms.

Quote:
Originally Posted by rholme View Post
So assuming I bring up fedora from the installation dvd, I would plan to stop the installation and get to single user mode (how - not sure yet, but I knew how to do this with Unix and Sun OS). Then I would mount the external disk; make the partitions needed on the hard drive; mount them; cd to them individually - there are two; and restore.
I just looked the the Fedora Core v11 installation page. It says that it comes on a live CD. That means that you can boot a fully functional Fedora Linux from the CD. Maybe the DVD isn't a live version; I don't know. There's a limit to how much I'm willing to research to answer a question.

Okay. You need two new disks to perform the fire drill.


Quote:
Originally Posted by rholme View Post
I am looking for advice on how to
a) get to single user mode
b) mount the external hard disk
c) make sure /boot has a boot blocks
a) boot a live CD.
b) don't you want to make partitions first?
c) if you are using an Intel machine then you should have backed up your disk MBR as part of your backup process. Then you can restore the MBR boot code onto a new disk. There are other threads here that have details. I know because I wrote them. Use the LQ search for MBR.

Quote:
Originally Posted by rholme View Post
As an alternate plan, I could put my restore set on a DVD and restore from that, but fear that the running Linux kernel will be needing the installation DVD in place.
The external WD disk is fine. You can restore directly from that.

Quote:
Originally Posted by rholme View Post
Note: I used to do this using a tape drive OR a combination of "rsh dump" from an alternate system (neither is an option on this box). I could copy the dump file to an old Sun and use the local net, but that seems a crazy waste.
Let's try to keep it simple. You'll be glad you did if you are restoring from a real disaster late on a Sunday night.

Lastly, what exactly is your dump command?
Code:
dump -A dump-file /
???

I haven't used dump since 2003 on Sun O/S.

Last edited by stress_junkie; 07-07-2009 at 05:27 PM.
 
Old 07-07-2009, 05:31 PM   #5
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,036

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
stress_junkie's advice is good.

You really need to get yourself a new HDD, remove your current one, install a blank, unformatted one and then see if you can restore from your "backup".

You need to test that you can restore from a completely "dead" system. If you haven't tested this properly, it may not work when you need it. I speak from experience - it once took me a whole weekend to do a restore from tape, because I made the "backups" stupidly. It should have taken me 40mins (most of would have been disk-writes, but I had to reset paths and whatnot, thanks cpio, but I managed it (just) and learnt a lot).

The failsafe strategy is to make a backup, shut down the PC, install an empty HDD in place of the running one, and then attempt a "restore".

Does it work?

If not, your strategy needs adjusting.
 
Old 07-08-2009, 09:06 AM   #6
rholme
Member
 
Registered: May 2008
Posts: 47

Original Poster
Rep: Reputation: 15
Thanks for your comments.
1) you are quite right - I did not mention making partitions and yes they need to me made.
and I don't remember if you install the boot blocks as a separate command or part of creation of the
file system after making the partition
2) I am running on Fedora 8 now and about to upgrade to 10, so I have a "window" in which to try things
without buying another hard drive. Hardware is a Dell Inspiration AMD64 - twin cpus. one hard drive, one DVD/CD drive ...
- the second site has 5 or 6 boxes that can be played with (3 identical to mine) - and yes that is where I would have
like to try this (but that takes a plane ride or trusting someone else's fingers - the latter scares me :=<] )
BTW - the person at the other site has failed to find out how to do this with with my original thoughts
and I don't think it is going to be that bad ( I could even get him to pay for the lessons )
3) I am a newbie to this forum so I will need to learn to dig -
"Use the LQ search for MBR" will take some fun learning, but I will do my best and I see on this page - other references
4) I left Sun in '90 so your experience was later - I could be wrong - but dump is safer than tar for full backups
of the root partition (does block+char specials correctly; tar did not and I would assume doesn't)
- I could be wrong, but doubt that has changed and YES tar would be fine for other partitions (both compress NOW)
5) here is the command for the root backup that I am using (after doing a CD to the mounted external drive)
dump -u0 -A root.toc -f root.dmp -L root -z2 /dev/mapper/VolGroup00-LogVol00
(not sure why I bothered with "-A root.toc" as I think the TOC is in the dump file too - unsure if TOC file used
but I have restored files often enough and it works fine - programmer over-zealous-clean damage :=] )
6) you can boot fine from the install DVD (just takes less of them to do the job- :=])
7) KISS is my middle name - I did what I had to do before CDs and DVDs and before external drives could be plugged in
this should be much easier with the mountable WD disk

Now to try it - I really want to get my ducks lined up pretty solid, so I have minimum down time. My intention to to restore the fedora 8 image and then to upgrade to 10 - being down for more than a few days will hurt badly. I need to do my homework on (I have not done this for a LONG time)
a) partitioning (2- I believe)
b) mounting the WD device when running the DVD kernel
c) making file systems on the two partitions and making sure the first one (/boot) has the critical hidden boot blocks
d) mounting the newly made file systems

e) doing the restore is a cake walk then and the final sync(s) are superstition, but I need to do these now when I do the dumps so maybe not just folklore
 
Old 07-08-2009, 02:15 PM   #7
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 331Reputation: 331Reputation: 331Reputation: 331
You are doing really well. I wish more people were as responsible as you are. Okay, ... we are.

Quote:
Originally Posted by rholme View Post
Thanks for your comments.
1) you are quite right - I did not mention making partitions and yes they need to me made.
Now we're on the same page.

Quote:
Originally Posted by rholme View Post
and I don't remember if you install the boot blocks as a separate command or part of creation of the
file system after making the partition
Separate on Intel machines.

Quote:
Originally Posted by rholme View Post
2) I am running on Fedora 8 now and about to upgrade to 10, so I have a "window" in which to try things
without buying another hard drive. Hardware is a Dell Inspiration AMD64 - twin cpus. one hard drive, one DVD/CD drive ...
Okay that's good news. I haven't worked with other architectures in several years so I wouldn't be very helpful on anything but Intel boxes.

Quote:
Originally Posted by rholme View Post
- the second site has 5 or 6 boxes that can be played with (3 identical to mine) - and yes that is where I would have
like to try this (but that takes a plane ride or trusting someone else's fingers - the latter scares me :=<] )
That's unfortunate. Your manager will probably appreciate this effort as long as it doesn't interfere with your availability at your principal work site AND if it doesn't cost the business any money. Otherwise s/he will probably not want to see you off site or spending money on disaster recovery validation. (Nice phrase, eh? Disaster recovery validation? I just made that up. )

Quote:
Originally Posted by rholme View Post
BTW - the person at the other site has failed to find out how to do this with with my original thoughts
and I don't think it is going to be that bad ( I could even get him to pay for the lessons )
Can we get you to pay for your lessons?

Quote:
Originally Posted by rholme View Post
3) I am a newbie to this forum so I will need to learn to dig -
"Use the LQ search for MBR" will take some fun learning, but I will do my best and I see on this page - other references
On the menu bar near the top of the page is a link named Search. Click on that. It will open a search form. In the box labeled Search by keyword(s) enter "backup mbr". In the box labeled Search by user name enter stress_junkie since I said that I had written about this. Near the bottom of the page click on the button labeled Search Now.

Okay so now I'd be a jerk if I insisted that you do that. Here is my last post on the subject. The section labeled Code is the part with the commands.

http://www.linuxquestions.org/questi...7/#post3591535

Quote:
Originally Posted by rholme View Post
4) I left Sun in '90 so your experience was later - I could be wrong - but dump is safer than tar for full backups
of the root partition (does block+char specials correctly; tar did not and I would assume doesn't)
- I could be wrong, but doubt that has changed and YES tar would be fine for other partitions (both compress NOW)
I don't doubt you. I have lots to learn too.

Quote:
Originally Posted by rholme View Post
5) here is the command for the root backup that I am using (after doing a CD to the mounted external drive)
dump -u0 -A root.toc -f root.dmp -L root -z2 /dev/mapper/VolGroup00-LogVol00
(not sure why I bothered with "-A root.toc" as I think the TOC is in the dump file too - unsure if TOC file used
but I have restored files often enough and it works fine - programmer over-zealous-clean damage :=] )
Come to think of it I never used the dump utility in a production environment. My Sun/Solaris machine used Veritas Backup Datacenter software. So I'm completely ignorant of dump.

Quote:
Originally Posted by rholme View Post
6) you can boot fine from the install DVD (just takes less of them to do the job- :=])
Okay. Good. So the main idea is that you have a fully functioning Linux system to work with when you are restoring from backup. That's good.

Quote:
Originally Posted by rholme View Post
7) KISS is my middle name - I did what I had to do before CDs and DVDs and before external drives could be plugged in
this should be much easier with the mountable WD disk
Right on. Things have gotten much more reasonable with regards to low level system administration in the last 10 years. Thank goodness.

Quote:
Originally Posted by rholme View Post
Now to try it - I really want to get my ducks lined up pretty solid, so I have minimum down time. My intention to to restore the fedora 8 image and then to upgrade to 10 - being down for more than a few days will hurt badly. I need to do my homework on (I have not done this for a LONG time)
a) partitioning (2- I believe)
b) mounting the WD device when running the DVD kernel
c) making file systems on the two partitions and making sure the first one (/boot) has the critical hidden boot blocks
d) mounting the newly made file systems

e) doing the restore is a cake walk then and the final sync(s) are superstition, but I need to do these now when I do the dumps so maybe not just folklore
Belt and suspenders. A few syncs here and there won't hurt.

On Intel machines the MBR of a disk contains both the boot code and the partition table in the first 512 byte block. My procedure to save the MBR will save both the boot code and the partition table.

When you want to restore the boot code but not change an existing partition table you restore the first 446 bytes. That will leave the partition table intact.
Code:
dd if=/mnt/mbr.bin of=/dev/sda bs=446 count=1 conv=notrunc,noerror
http://en.wikipedia.org/wiki/Master_boot_record

Another thing to keep in mind is how your boot loader recognizes its target drive. If you are using GRUB then you may have to do two things after the restore. You may have to edit the /boot/grub/menu.lst to tell GRUB what disk and partition it should boot from, and you may need to run grub-install from a chrooted environment (chrooted to your restored partition). More on that if it becomes necessary. It is possible to write a book about what could happen. That's why a fire drill is so important before a disaster actually happens.

Last edited by stress_junkie; 07-08-2009 at 02:30 PM.
 
Old 07-08-2009, 06:43 PM   #8
Smokey_Mtn Ron
LQ Newbie
 
Registered: May 2009
Location: American living in Philippines
Distribution: Mint (7)
Posts: 12

Rep: Reputation: 0
That was my question too when I started using Linux. I wanted to put it on a new hard drive with all the programs I already had Installed.
Answer? remastersys!!
Go to this link, http://forums.linuxmint.com/viewtopic.php?f=90&t=27426 and read the second post. You can burn a iso live dvd with all your stuff on it and if something happens to your drive you just plop in the live dvd and install just like a fresh install but with all your data and programs that you have already installed already loaded. Perfect way to back up your whole system for the cost of a blank dvd every month or so.
 
Old 07-08-2009, 07:41 PM   #9
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.6, Centos 5.10
Posts: 16,324

Rep: Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041
BTW, the std recommendation, at least for Fedora (& RHEL/Centos) is to do a fresh install when moving to a new major version.
Some people have claimed to be able to upgrade Fedora in-place, but it doesn't always seem to be stable in the long run.
Your choice.
FWIW, the tech docs for RHEL say upgrades across major versions eg 4 -> 5 are theoretically possible, but NOT supported.
Only minor upgrade eg 5.2 -> 5.3 are.
http://www.redhat.com/docs/en-US/Red...ted_Notes.html
 
Old 07-08-2009, 08:29 PM   #10
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 331Reputation: 331Reputation: 331Reputation: 331
Quote:
Originally Posted by chrism01 View Post
BTW, the std recommendation, at least for Fedora (& RHEL/Centos) is to do a fresh install when moving to a new major version.
Some people have claimed to be able to upgrade Fedora in-place, but it doesn't always seem to be stable in the long run.
Your choice.
FWIW, the tech docs for RHEL say upgrades across major versions eg 4 -> 5 are theoretically possible, but NOT supported.
Only minor upgrade eg 5.2 -> 5.3 are.
http://www.redhat.com/docs/en-US/Red...ted_Notes.html
Fresh installs for version upgrades are my preference too.
I didn't mention it because the O.P. may have a very very complex system from a software configuration point of view and we were concentrating on the restore. But I officially hate trying to upgrade. Too many loose ends and gotchas waiting to surface at the worst possible time. Paychecks not printing because the printer is acting up after the upgrade, SQL database not authenticating during working hours because the old PAM module doesn't work with the new distro version; upgrades are very risky. At least with a fresh install you know what needs to be done before you start and you (should) have the old distro in place to roll back to. Fresh install on a different partition to keep the old version intact and ready to run.

Now back to restoring from backup!!!

Last edited by stress_junkie; 07-08-2009 at 08:38 PM.
 
Old 07-09-2009, 02:07 PM   #11
rholme
Member
 
Registered: May 2008
Posts: 47

Original Poster
Rep: Reputation: 15
To all other than Stress Monkey:

Thanks for the advice on upgrading. I intended to do that anyway (full fedora 10 install and then add software). I NEVER trust upgrades in place (Thank Solaris for the lesson and the burn several years ago - ouch).

Stress Monkey:

I don't know how to be fancy with the neat little quote boxes, but will use the classical mail method to answer:

>You are doing really well. I wish more people were as responsible as you are. Okay, ... we are.
Perhaps several years as a system administrator helps me be cautious. I am only working on sweat equity projects now (yes it hurts), but for many years I had to deal with various OS platforms, finally Unix for 14 years. It hurts but it hurts more to not be careful. :=]

The other site is trying to become a company so we can all get paid for over 5 years of development with no pay, they are shipping me a HDD so I can do this right (yahoo). But YES, I have proposed that we should pay someone (you if willing and we can connect) to help out. I am in Maine, so we are not zillions of miles apart - I don't have much of a budget, but can find something and we can publish the results if you like for others. ?Disaster recovery validation? - neat - I could tell you stories there - you would laugh yourself silly - a whole backup tape library wiped out by a large induction motor (IBM mainframe - hundreds of tapes - erased!).

I did do a search and could not find your post but forgot to add your acronym. Will save time by the link - thanks.

>Come to think of it I never used the dump utility in a production environment. ..

Veritas is great, tar will do the job for all normal files, but fails for special files. It works great and now with the -z option I don't have to pipe it to compress to make it reasonable. It also has a nice interactive mode for restoring the file(s)/dir(s) you just accidentally clobbered with fat finger syndrome.

>Things have gotten much more reasonable with regards to low level system administration in the last 10 years.
Yes, true. But some folks like to use graphical interfaces - my analysis so far is welcome to Hades when you do - you will get burnt. I like just typing the command and reading it three or four times before I press ENTER.

So, I will read your notes and try a restore as soon as I get the HDD. Will post back and let you know how I made out. If you care to contact me, perhaps we can try together and you can get paid (rayholme@yahoo.com). In either case, I will write up my experience and post it wherever you suggest for future use by others.

Thanks for all the help. :=]
 
  


Reply

Tags
dump, file, restore


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Restoring from Suse Backup tictoc Suse/Novell 9 02-09-2009 05:18 AM
Restoring X11 from backup-- HELP! philwynk Linux - Newbie 10 01-23-2008 03:34 PM
Restoring from rsync backup a_l_a_n Linux - Software 3 09-12-2007 02:13 PM
Restoring from an rsync backup of / eldoran Linux - General 3 04-26-2006 12:34 AM
Restoring backup dominique Linux - Newbie 3 12-06-2001 03:59 AM


All times are GMT -5. The time now is 08:29 PM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration