Article: HowTo Backup and Restore the Tumbleweed Root/System Partition Quickly & Simply

Alternative Title: Quick and Easy Insurance for Tumbleweed Users

Introduction: I back up Tumbleweed each time there’s a kernel update because I can’t afford to have my computer go down, not even for a day, so I back up my Tumbleweed root partition before allowing any potentially problematic upgrades using “zypper dup”. If you have separated your home and root partitions, backing up Tumbleweed is done simply by backing up the root filesystem.

There are many ways to back up a Linux root partition. The method I use is fast and simple, involving the Linux copy command “cp”.

Storage: I use a spare partition I’ve created on my internal hard drives for storage. You could equally well use an external USB hard drive. You must use a Linux filesystems, preferably the same filesystem as your root partition. The current openSUSE default root filesystem is ext4. A root filesystem doesn’t actually take up much space unless you’ve done something unusual. Maybe it contains 5 to 10 Gb of files in normal cases. To find out your usage, run the command df -h and look in the column labelled used.

I need about 4 copies of the root filesystem to feel safe. Before I start a new one, I delete the oldest, so I have a sequential set of four copies. My root filesystem is on a 30 GB partition, but I only have 6Gb of files on it. So since I like to store the latest four copies, at 6Gb each I need a storage partition sized 24Gb. Consequently I made a 30Gb storage partition to allow for storing four historical copies plus wiggle room.

Backup Method: I boot into a live CD because It’s not a good idea to copy a live root filesystem. Good live CDs are Knoppix, System Rescue CD and Parted Magic.

Suppose for example I have Tumbleweed root on sda5 and the storage partition is on sdc2. Here are the steps:

  1. make a directory called origin to mount the Tumbleweed root partition: mkdir /mnt/origin

  2. mount Tumbleweed: mount /dev/sda5 /mnt/origin

  3. make a directory called storage to mount the storage partition: mkdir /mnt/storage

  4. mount the storage partition: mount /dev/sdc2 /mnt/storage

  5. make a new directory on the storage space, coded for the date (e.g 22 July 2011 is 110722): mkdir /mnt/storage/110722

  6. check the oldest stored backup by listing the contents of the storage partition: ls -l /mnt/storage/

  7. suppose the oldest backup was made on 30 June 2011, the name would be 110613, delete it: rm -Rf /mnt/storage/110613

  8. make a new backup with this command (the period after / is real): cp -a -u -v /mnt/origin/. /mnt/storage/110722/

Restore Tumbleweed: if you want to restore Tumbleweed by bringing back an earlier root filesystem, you mount the partitions again in the Live Cd. But this time you delete the current Tumbleweed filesystem and then copy a backup filesystem in the reverse direction, from /mnt/storage to /mnt/origin. Suppose the backup you want to retrieve is in directory 110722 on the backup partition. Here are the steps:

  • mount the partitions the same way using steps 1 through 4 in the list above

  • delete the unwanted (current) Tumbleweed root filesystem e.g. here’s one way:** rm -Rf /mnt/origin/; rm -Rf /mnt/origin/.**

  • copy the backup over from directory 110722 (heed the period after /): cp -a -u -v /mnt/storage/110722/. /mnt/origin/

  • reboot and you should boot to Tumbleweed as it was on 22 June 2011.

Alternatively, you can use Clonezilla to backup critical partitions.

Thanks swerdna, a simple way:P