Linux – How to backup a linux server running a software raid

backuplinuxraidrestoreUbuntu

I would like to backup a production server running ubuntu 10.04 LTS on a software raid. In order to to that I have rebooted into a rescue system which is running in RAM.

df -h on ubuntu looks like this:

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

The thing is, that after booting to rescue the md devices are not present. Instead I do see the 2 harddrives directly:

RAM  32112 MB
Disk /dev/sda: 3000.6 GB  (=> 2861 GIB)
Disk /dev/sdb: 3000.6 GB  (=> 2861 GIB)

I need to exclude some folders as the backup image would otherwise contain xxx GB of data. So partimage as a backup solution does not work. I am using a regular tar with exclude:

mkdir /mnt/md1_backup/
sudo mount /dev/md1 /mnt/md1_backup/
tar cvzpf test.taz ./ --exclude=test.taz  --exclude...

Can I simply mount /dev/sda and run the tar with all the exclude commands? I could imagine, that without the system raid the folders like /home are not present and I also fear that I could even break the system by mounting /dev/sda

How can I proceed from here? My goal is a full system backup without some data dirs.

Best Answer

It works only if you are using raid 1 (Mirror disks) If you think your backup won't be consistent under load, I recommand you stop all possible services running on your box instead of rebooting it on rescue mode. As it's name suggests, rescue mode is for rescue and you are not in trouble :)

Related Topic