Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am running ubuntu 10.04 LTS on a remote root server and almost the same setup on a development server over virtualbox. My goal is to backup the remote root server to an ftp-account. In case the hard drive failes I would then boot from a rescue system and install the backup. I looked into partimage, but that unfortunatelly does not support exclude folders and the drive in question contains about 200GB of Data I do not want to backup.

So I tried it with tar:

mkdir /mnt/system
mount /dev/sda1 /mnt/system
cd /mnt/rescue
tar cvzpf image.tar.gz ./ --exclude=image.tar.gz --exclude=unwanted_folder

This worked, but obviously the boot sector is not included. So I am left with a copy that does not help to make a full server restore.

The server looks like this:

/home$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/md2             1016G  4.9G  960G   1% /
none                   16G  220K   16G   1% /dev
none                   16G     0   16G   0% /dev/shm
none                   16G   72K   16G   1% /var/run
none                   16G     0   16G   0% /var/lock
none                   16G     0   16G   0% /lib/init/rw
/dev/md3              1.7T  267G  1.4T  17% /home
/dev/md1              496M   69M  402M  15% /boot

What would be the best way to do a full backup to an image or tar with the option of excluding special folders inside /home ?

Thank you for any help.

share|improve this question
    
You may be able to tar directly to the ftp server by the way using something like tar -cvzpf ./ | curl -u User:Pass ftp://ftpserver/Folder/filename -T - I've not tried it (as i don't use ftp) but it should work –  Sirex Mar 8 '12 at 11:11
add comment

1 Answer 1

You can use dd to backup MBR

dd if=/dev/sdX of=/tmp/sda-mbr.bin bs=512 count=1

to restore use

dd if= sda-mbr.bin of=/dev/sdX bs=1 count=64 skip=446 seek=446

Replace X with actual device name such as /dev/sda.

share|improve this answer
    
I did the backup/restore of the MBR and the file system is in place. However, the machine does not start up with the backup and the screen just stays black. Any ideas what could be missing? Do I also need a partition table backup? –  merlin Mar 9 '12 at 11:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.