Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 482
  • Last Modified:

backup and restore entire Filesystem?

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
rawandnet
Asked:
rawandnet
  • 12
  • 8
  • 2
2 Solutions
 
arnoldCommented:
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
 
rawandnetAuthor Commented:
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
 
arnoldCommented:
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
rawandnetAuthor Commented:
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
 
arnoldCommented:
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
 
rawandnetAuthor Commented:
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
 
rawandnetAuthor Commented:
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
 
arnoldCommented:
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
 
joolsCommented:
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
 
rawandnetAuthor Commented:
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
 
arnoldCommented:
/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
 
rawandnetAuthor Commented:
I will do the steps again and come backup to you.  thanks
0
 
rawandnetAuthor Commented:
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
 
joolsCommented:
did you cd into /mnt/mysystem before restoring?

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

only asking...
0
 
arnoldCommented:
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
 
rawandnetAuthor Commented:
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
 
rawandnetAuthor Commented:
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
 
arnoldCommented:
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
 
rawandnetAuthor Commented:
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
 
arnoldCommented:
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
 
rawandnetAuthor Commented:
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
 
rawandnetAuthor Commented:
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 12
  • 8
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now