The principle is to make a single archive containing all files on the hard disk to make a backup. Under Linux, it is possible to access all the files and modify them even if they are in use. It is theoretically not necessary, therefore, to run on a Live-CD for backup or restore. In this article we will show you how to create and restore your archive, using tar.
Before doing the backup, ensure not to include useful files:
Empty your recycle bin
- If you want a system backup, do not add personal documents.
- Also empty the fitness cache folder: When downloading a packet, it remains on the disk, they must be abolished to win (a lot) of space. For this, type in a terminal:
sudo aptitude clean
It is very important if you follow this trick directly from the system restore (no Live-CD for example) not to use other software during the backup: do not modify files on the disk whilst reading tar.
The best thing to do is the backup after installing the system. Once the software is installed and updated like this, the system is clean.
To get full access to system files, let us root user by typing in a terminal:
Then go to where you want to create the archive: here we take the root of the drive: /
We can create our archive using the following command:
tar cvpzf backup.tgz --exclude=/backup.tgz --exclude=/lost+found --exclude=/media
- cvpzf: what are the options: to create (c) showing an archive (v) the scroll on the screen. Each file will retain its permissions (p) using gzip (z) to create the file (f) backup.tgz.
- The records and files after - exclude / are the records that we do not want to include in the archive:
- 1.backup.tgz: we can not of course include the archive itself failing to create a loop ...
- 2. / lost + found, these files are not used to much.
- 3. / media: we must not include the other file systems.
- 4. As we want to save, it puts "/" to include the root file system.
Run the command and then wait as it might take time. At the end, you end up with a file backup.tgz in the root file system containing all the files in "/" we have not excluded.
- You can also use gzip Bzip2 instead: this will cause a compression of larger files (an archive smaller) but the process will take longer.
- To this solution, just replace "z" with "j" in the options, and name the archive so that it ends with. "Tar.bz2", like this:
tar cvpjf backup.tar.bz2 --exclude=/backup.tar.bz2 --exclude=/lost+found --exclude=/media /
Here be careful: handling below replace each file with their "counterpart" in the archive, so be sure what you do.
Backup.tgz Place the file in the root file system, then put in as root (sudo su) and put in the root (cd /)
- This is the command to restore any type:
tar xvpfz backup.tgz -C /
- Or in the case of using Bzip2 to replace gzip:
tar xvpfj backup.tar.bz2 -C /
options: x: to extract. -C: to use the current directory (/) to extract the files.
To restore, type the command. Then press enter and wait until the process finishes.
Important to note one thing: if you have excluded files (eg / lost + found), you must recreate them with the command
That is: after a system reboot, you'll have a system in the same condition as when creating the backup!
- Tar restore
- How to restore tar backup in linux
- Restore tar backup
- Install tar.gz > Guide
- Samsung restore code > Guide
- Restore locked facebook account > Guide
- How to restore settings icon on iphone? > Guide
- Full restore cheat fire red > Guide
- How to compile assembly code: in Linux, Windows, with NASM
- Search in Vim editor: Linux, for words
- Ubuntu remove password: for sudo, for user, for root
- How to disable avahi-daemon: Linux, Ubuntu
- Debian add printer: command line, install cups
- Change password Linux: script, terminal, Samba
- Debian change language: to English, command
- Linux read file line by line: for loop
- Vim autocomplete: C++, command
- Linux display file in reverse order
- How to install htop Linux: Ubtunu, Mint
- Restart network interface: Linux, Ubuntu
- How to create commands in Linux?
- Customize Wine on Linux: download, install, locate theme
- How to resize partition Linux: Gparted, command line
- How to remove the content of a directory: Linux
- How to recover lost admin password in CUPS?
- What is Daemon Log: in Linux
- How to split a file in Linux: split, merge
- How to convert DOS to UNIX: Linux, command
- Adding space in mount point: to FSTAB
- Delete lines in Linux: SED, commands
- How to uninstall package: in Linux