How to back up an entire Linux Ubuntu system 29/11/2025
How to back up entire Ubuntu system (content of downloadable versions above repeated below in this post):
From https://askubuntu.com/questions/7809/how-to-back-up-my-entire-system
29/11/2025
Refer to this howto: http://ubuntuforums.org/showthread.php?t=35087
FILES
In simple terms, the backup command is:
sudo tar czf /backup.tar.gz \
–exclude=/backup.tar.gz \
–exclude=/dev \
–exclude=/mnt \
–exclude=/proc \
–exclude=/sys \
–exclude=/tmp \
–exclude=/media \
–exclude=/lost+found \
/
Add more –exclude= parameters if you need to.
It will create an archive of all your files at /backup.tar.gz, which should be copied to another computer or drive.
To restore your files when the system goes pear-shaped, use a Live CD. Mount the bad system under /media or /mnt and then run tar xf /path/to/drive/with/backup.tar.gz -C /mnt (or /media).
GRUB
This will not cover GRUB, however you can easily reinstall it by following this guide below. You only need to do steps Three and Four.
Step Three – Mount /boot
Note: Instead of mounting the boot directory or partition from the installation in the live media environment you can specify the path with the –boot-directory parameter for grub-install, more information on the manpage.
Load up from your Ubuntu live CD, and then run these commands.
If you DO NOT have a separate /boot partition:
sudo mount /dev/DEVICENAME_FROM_STEP_ONE /mnt
sudo rm -rf /boot # Careful here, make sure YOU ARE USING THE LIVE CD. I tried it, it works.
sudo ln -s /mnt/boot /boot
If you have a SEPARATE /boot partition:
sudo mount /dev/DEVICENAME_FROM_STEP_ONE /boot
Step Four – Install the bootloader
Note: These instructions were initially written for Windows 7 and BIOS booting computers. If you have UEFI and Windows 8 and above you probably need to replace grub-pc with grub-efi-amd64 in sudo apt-get install grub-pc.
Then continue with those commands:
sudo apt-get update
sudo apt-get install grub-pc
sudo grub-install /dev/sda # NOTE THAT THERE IS NO DIGIT
sudo umount /boot
And restart. It should work fine and boot both systems.