Advice on backup method

Ralf Mardorf silver.bullet at zoho.com
Sun May 29 10:52:55 UTC 2016


Form a live media with root privileges run

  cd /mount/point/of/partition && tar -czf name_of_the_backup.bak.tar.gz *

Note, apart from hidden files and directories, the asterisk is a dummy to
write all files and directories to the archive, ignored would be e.g.

  /mount/point/of/partition/.a_hidden_file

but hidden files and directories in a directory are not ignored, e.g.

  /mount/point/of/partition/a_directory/.some_hidden_file

usually there aren't hidden files and directories in the root
directory. However, you also could add the one or two unusual hidden
files that might be part of your root directory.

  cd /mount/point/of/partition && tar -czf name_of_the_backup.bak.tar.gz * .hidden_thingy_1 .hidden_thingy_2

Assumed you write a script to copy several partitions, consider to write
the status to a log file.

  #!/bin/bash
  STORE_BACKUP_HERE="/mount/point/of/backup/device"

  cd /mount/point/of/partition_1 && tar -czf $STORE_BACKUP_HERE/name_of_the_backup_1.bak.tar.gz *
  echo "exit status backup 1: $?" >> $STORE_BACKUP_HERE/bak.log

  cd /mount/point/of/partition_n && tar -czf $STORE_BACKUP_HERE/name_of_the_backup_n.bak.tar.gz * .hidden_file
  echo "exit status backup n: $?" >> $STORE_BACKUP_HERE/bak.log

  exit

The exit status is 0, if there were no issues.

You can backup a complete Linux and restoring it works without an issue,
you only need to do it from another Linux, you can't backup a complete
Linux by itself, when it's running. Actually you don't need to backup a
few directories, to restore a complete install, but they are small and it
doesn't harm to backup everything.

Other data, e.g. a MBR of a device, e.g. sda, might be important too.

  dd if=/dev/sda of=$STORE_BACKUP_HERE/mbr_sda.bak bs=512 count=1

Restoring a complete Linux with data and software is not that tricky as,
restoring a Windows. To restore a Linux, you only need to extract the
backup archive on a new drive and maybe to fix grub.cfg. Assumed the mobo
is new too, you might need to correct the graphics driver etc..

Regards,
Ralf





More information about the ubuntu-users mailing list