Solved

backup and restore entire Filesystem?

Posted on 2009-05-07
22
471 Views
Last Modified: 2012-05-07
What is the best tool to backup all Linux filesystem which can be restored if Linux system crashes and not doesn't start.

I used dump to copy and restore the entire filesystem. But after restoring I can't even login to fedora anymore. The command i used to restore was:

restore rf /dev/sda4

while restoring I get message, can not overwrite file exits.

I dump is the write tool to restore the entire system encase of disaster recovery?

thanks
0
Comment
Question by:rawandnet
  • 12
  • 8
  • 2
22 Comments
 
LVL 77

Accepted Solution

by:
arnold earned 400 total points
ID: 24326779
You have to boot the system by other means i.e. CD and then restore the partition.
Do you have selinux configured?
ls -Z see if you have a context listed next to files.

What is the backup command you use? dump?
0
 

Author Comment

by:rawandnet
ID: 24326980
I disabled selinux.

backup command i used:
dump 0uf /dev/sda4 /dev/sda1

I have restored the system from the CD,

but after restart it doesn't show any thin. could you tell me the command and steps you used?
0
 
LVL 77

Expert Comment

by:arnold
ID: 24327138
When booted from the CD, did you wipe the partition /dev/sda1 clean first?
mke2fs?
the directive for -r requires that the filesystem to which the restore is to be done must be pristine.
http://linux.die.net/man/8/restore
 
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:rawandnet
ID: 24327238
I didn't wipe the partition, i just wanted to overwrite.
then format first

mkfs -t ext3 /dev/sda1

then

restore -rf /dev/sda4

is it correct?
0
 
LVL 77

Expert Comment

by:arnold
ID: 24327448
Yes.
mkfs -t ext3 /dev/sda1
mount /dev/sda1 /mnt
cd /mnt
restore -rf /dev/sda4

The above is included in the link detailing the man page for restore
Hopefully you did not backup any other partitions to /dev/sda4 with dump -0uf /dev/sda4 /dev/sdax
0
 

Author Comment

by:rawandnet
ID: 24334152
I have tried the following:

mount /dev/sda1 /mnt
cd /mnt

in mnt directory, i can't even use ls command, or restore command, it say command not available?


0
 

Author Comment

by:rawandnet
ID: 24334642
I have solve that by creating a new folder and mount /dev/sda onto that folder rather than mounting to mnt. this will work.

the problem now i have is. after restoring and restarting the system I get the following error:

"error mounting dev root on sysroot as ext3 no such file or directory"

any idea?
0
 
LVL 77

Expert Comment

by:arnold
ID: 24336516
The command you run has nothing to do with where you are.  The issue might be that the command is not in the path.
Presumably you booted with a Live CD.
before changing anything, can you run ls, restore --help, etc.?

restore is likely in /usr/bin/restore.
/bin/ls

See if the following link is helpful:
http://forums.fedoraforum.org/showthread.php?t=206071
0
 
LVL 19

Assisted Solution

by:jools
jools earned 100 total points
ID: 24353650
what do you mount under /mnt? /dev/sda is the whole disk, not the partition. you probably want /dev/sda4 or summat like that.

If you post the exact commands you use it will help
0
 

Author Comment

by:rawandnet
ID: 24373290
the Filesystem is under /dev/sda1, I backuped the system under /dev/sda4 using following command:

dump 0uf /dev/sda4 /dev/sda1.

create folder under mnt (mysystem) and mount
mount mount /dev/sda1 /mnt/mysystem

I have tried to restore the system while login to Fedora and through CD rescue mode.  
restore -rf /dev/sda4

but still I get the following error after restoring and restarting the system"mounting dev root on sysroot as ext3 no such file or directory"

0
 
LVL 77

Expert Comment

by:arnold
ID: 24374667
/mnt is the folder for mount overlay.

after the restore, if you navgate to /mnt/mysystem/etc/fstab what do you have there?
Prior to running dump, what does /dev/sda4 have?  Is it a mounted partition? or is it a raw partition that you use for the purposes of backup?
0
 

Author Comment

by:rawandnet
ID: 24374706
I will do the steps again and come backup to you.  thanks
0
 

Author Comment

by:rawandnet
ID: 24384719
hi arnold,

access Rescue mode from CD, and skipped mounting, to prevend the device from mounting:
dump 0uf /dev/destination /dev/source
format: mke2fs /dev/destiantion drive
mount /dev/destination /mnt/mysystem
restore rf /dev/destination

later I browsed to etc, there was only 38 file and folders. and there wasn't fstab file.  many file hasn't been backup, what is the reason?

Thanks

0
 
LVL 19

Expert Comment

by:jools
ID: 24385195
did you cd into /mnt/mysystem before restoring?

did you look in /mnt/mysystem/etc???

only asking...
0
 
LVL 77

Expert Comment

by:arnold
ID: 24385817
It's either a typo or you formatted the partition where you stored your backup:
/dev/destination is the location to which you backed up /dev/source.

I think the default will make it ext2.  converting to ext3 is not a big deal.
You should run mke2fs -T ext3 /dev/source prior to mounting/restoring from /dev/destination.


0
 

Author Comment

by:rawandnet
ID: 24390411
answer for jool:
I did CD to the directory and looked at the restored directory.

answer for arnold.
I formatted the filesystem (sda1) partition were Linux was installed. then restored the backed up file from /dev/sda4 to sda1.

you suggesting to format filesystem partition sda1 using (mke2fs -T ext3 /dev/sda1) then mounting and restore to from sda4 to sda1. I will do that tomorrow morning and come back with result.

thanks
0
 

Author Comment

by:rawandnet
ID: 24394036
This time after restore, computer pass BIOS and just stops, doesnt even get to grub.conf file.

Just to remind you that I installed the entire filesystem on one partition sda1.

Steps:

Create folder under /mnt/mysystem
    mount /dev/sda1 /mnt/mysystem
    cd /mnt/mysystem
    restore rf /dev/sda3             "backup location"


White restoring it show following error:

Resync restotre, skipped 1 blocks
Error in EA block1
Magic = 0

This keept showing 9 times.

This time more file was restored and fstab setting is as follow:
UUID = (long number)       ext3 default
Ts      1 1
Tmpfs      /dev/shm      tmpfs      defaults       00
Devpts      /dev/pts      devpts      gid=5,mode=620        00
Sysfs      /sys      sysfs      defaults      00
Proc      /proc      proc      defaults      00
UUID= (long number) swap
Ts       00

if you have quesions ask me please.
thanks
0
 
LVL 77

Expert Comment

by:arnold
ID: 24399694
run fsck.ext3 on the /dev/sda1 partition do not mount the partition.

fsck.ext3 /dev/sda1

Which linux are you using?
Usually, /boot is one partition and then /.
0
 

Author Comment

by:rawandnet
ID: 24409784
I am using Fedora. I too think it might be something to do with boot partition.  I installed the entire filesystem into / (sda1), but do you think that boot will be installed on another one? how can I backup and restore boot, and on which partition?

Thanks
0
 
LVL 77

Expert Comment

by:arnold
ID: 24411974
You can create a small 100-200MB /dev/sda1
in fstab you would use /dev/sda1 as the /boot mount point.
You can then use the -x  to extract just the /boot data.

But before trying that see whether you have a restoresymtable file in the /mnt/myssytem directory after the restore is complete.  Delete this file and see whether you have the same error.

If you go with the reconstruction of the file system i.e. /boot /.
Your fstab references the device based on UUID.
Is the number in the fstab matches the UUID of the SDA1 partition?
 
0
 

Author Comment

by:rawandnet
ID: 24491266
Hi guys,

thanks for your help especially arnold.  the problem was boot loader file.  because MBR is instal on sda drive, it have to either backup the entire drive using dd command. or backup up a partition and backup boot loader separately.  I think dd is the best tool for that purpose.


thank you again
0
 

Author Closing Comment

by:rawandnet
ID: 31586172
Hi guys,

thanks for your help especially arnold.  the problem was boot loader file.  because MBR is instal on sda drive, it have to either backup the entire drive using dd command. or backup up a partition and backup boot loader separately.  I think dd is the best tool for that purpose.


thank you again
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question