0

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.

5
  • 5
    Why would you need to take your system offline for a backup? Mar 12, 2012 at 13:32
  • Because I believe the backup made under load would be inconsistent.
    – merlin
    Mar 12, 2012 at 14:08
  • 2
    Use LVM snapshots, then. If your current file systems are not using LVM, then do that during your next server refresh. Mar 12, 2012 at 14:09
  • I am not using LVM and do not mind a few minutes downtime.
    – merlin
    Mar 12, 2012 at 14:58
  • What is this "resuce system?" The 10.04LTS server installation CD has a rescue mode that should start up any MD RAID devices you have. Cf. help.ubuntu.com/10.04/installation-guide/amd64/rescue.html Mar 12, 2012 at 17:30

2 Answers 2

1

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 :)

4
  • Ok. I tried to to create a tar directly on the production server under load. The creation of the tar file exists with 1 after about 1.6GB and the message"tar: /sys/module/ipt_REDIRECT/sections/.strtab: File shrank by 4077 bytes; padding with zeros"
    – merlin
    Mar 12, 2012 at 17:25
  • well, /sys is a filesystem (sysfs) you should consider to skip when backuping just like /proc. You are safe skipping it
    – m0ntassar
    Mar 12, 2012 at 17:28
  • Skipping /proc/ and /sys worked. I have a tar now from / as a backup. I would also like to backup the bootsector. The system is a software raid 1. Can I do something like this? dd if=/dev/sda of=/tmp/sda-mbr.bin bs=512 count=1
    – merlin
    Mar 13, 2012 at 8:32
  • what's the point of backuping "bootsector", you don't need to back up it, you will be safe making a new grub install
    – m0ntassar
    Mar 13, 2012 at 15:35
1

Normally from the live system you could force assemble existing RAID arrays:

mdadm --assemble --scan --config=partitions

This will find and create the necessary md devices.

From the live CD, If you know your RAID arrays devices you can force assemble them too:

mdadm --assemble --force /dev/md... /dev/sd... /dev/sd...

Mdadm will "do the right thing".

1
  • This would only work from the live system. The situation is, that I am booting into a rescue system in RAM which is a complete other install. There I can see the two hard drives available. mdadm --assemble --scan --config=partitions mdadm: No arrays found in config file
    – merlin
    Mar 12, 2012 at 15:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .