Backup Restore Root Partition In Ubuntu

To backup root partition on Ubuntu Linux system, we can do this by using the following command :

ttirtawi@tedy-laptop:~$ su -
root@tedy-laptop:~# tar cvpzf backup.tgz --exclude=/proc --exclude=/lost+found --exclude=/backup.tgz --exclude=/mnt --exclude=/media --exclude=/home --exclude=/sys /

Just remove the --exclude=/home if we don’t want to backup home partition too. Using the above command the result is located on /root (as current directory) and the output name is backup.tgz.

To restore backup file to other system we can use the following command (first we transfer the backup file to the target system) :

dodol@dodol-desktop:~$ scp ttirtawi@ .
ttirtawi@'s password:
backup.tgz                                                                                                                           100% 1760MB   2.7MB/s   10:58
dodol@dodol-desktop:~$ su -
root@dodol-desktop:~# cd /home/dodol/
root@dodol-desktop:/home/dodol# ls -tlr backup.tgz
-rw-r--r-- 1 dodol dodol 1845595105 2010-09-12 18:13 backup.tgz
root@dodol-desktop:/home/dodol# tar zxvpf backup.tgz -C /

Basically this process applied for all Linux distribution not only for Ubuntu.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.