Ubuntu14.04 how to back up and restore your system

Source: Internet
Author: User
Tags bz2

Http://www.cnblogs.com/alexanderkun/p/5008514.html

This article is compiled by the captain of the Devil.
After installing Ubuntu, don't forget to install the for Linux firewall and antivirus software.
Before backing up the system, make sure the system is clean and error-free:
I am operating system is ubuntu14.04, do not know is the system out of the problem or install the software has problems, each boot appears:System program problem detected I initially feel that the problem is a graphics card driver.
Look very upset, Close method:
Administrator privileges to open /etc/default/apport
# Set this to 0 to disable Apport, or to 1 to enable it
# can temporarily override this with
# sudo service apport start force_start=1
Enabled=1
Change the original 1 to 0.

0. Clean up
CleanUbuntu14.04 System of Garbage:
First empty the Recycle Bin, software upgrade to the latest.
Ubuntu System andThe file systems used by Windows systems are different,Ubuntu systems do not generate file fragments and junk files during use or update, so use theThe Ubuntu system does not have to consider cleaning up the system's file garbage and defragmenting the files.
If you really want to clean it up,Ubuntu system, then please refer to the following methods to do it:
1. Press"Ctrl+alt+t", bring up the terminal.
2, enter the following command in the terminal (Copy to the terminal window)--Press ENTER--Enter your account password-Press ENTER.
sudo apt-get AutoClean (clean up the old version of the software cache)
sudo apt-get clean (cleans up all software caches)
sudo apt-get autoremove (remove orphaned software that is no longer used by the system)

In the backupWindows system when you might have thought that I could put the wholeThe C-plate is put in aZIP file. This inUnder Windows is not possible, because inThere are many files in Windows that are not allowed to be copied or overwritten when they run, so you need a dedicated backup tool toSpecial handling of Windows systems.
and backupWindows system is different if you want to back upUbuntu system(or any otherLinux Systems), you no longer need to be likeA backup tool like Ghost. In factGhost This kind of backup tool forThe Linux file system is poorly supported, such as someGhost version can only be fully supported byEXT2 file System, if you use it to back upExt3 andEXT4 file system, you may lose some valuable data.

1. Backup System
How do I back up myWhat about the Ubuntu system? It's simple, just like you're backing up or compressing something else, usingTAR. AndUnlike Windows,Linux does not limitRoot accesses anything, you can throw everything on the partition into aTar file!
Backup first step: Open a terminal and runsudo su (requires a password after enter)
Step two: Continue to enter in the terminalCD/(note there is a space in the middle)
Step three: (Start backup system)
In the terminal, enter:
# tar Cvpzf ubuntu.tgz–exclude=/proc–exclude=/lost+found–exclude=/ubuntu.tgz–exclude=/mnt–exclude=/sys/
Let's take a brief look at this command:
' Tar ' is the program used to back up
C-Create a new backup document
V-Verbose mode,The TAR program will output all the information in real time on the screen.
P-Save the license and apply it to all files.
Z-With' gzip ' compresses backup files to reduce the volume of backup files.
F-Indicates the path where the backup file is stored,UBUNTU.TGZ is the backup file name in this example.
"/" is the directory we want to back up, here is the entire file system.
In the file file name"Ubuntu.gz" and the name of the directory to be backed upThe directories that must be excluded from the backup are given between "/". Some directories are useless, such as"/proc","/lost+ found","/sys". Of course"Ubuntu.gz" The file itself must be excluded, otherwise you may get some out of the ordinary results. If you do not put"/mnt" excluded, then mounted onOther partitions on the "/MNT" will also be backed up. Also need to confirm"/media" didn't mount anything.(such as discs, removable hard disks), if there is something to mount, must put"/media" is also excluded.
Someone might suggest you putThe "/dev" directory is excluded, but I do not think it is a good thing to do, for the specific reason is not discussed here.
Before you execute the backup command, confirm that the command you typed is what you want. The backup command may take a short time to execute.
After the backup is complete, the root directory of the file system will generate a name of"Ubuntu.tgz" of the file, its size may be very large. Now you can burn it toOn a DVD or put it where you think it's safe.
You can also useBzip2 to compress the file,BZIP2 ratioGzip compression rate is high, but slower. If the compression rate is important to you, then you should useBZIP2, with"J" in place of the command."Z", and give the file a correct extension"BZ2". The complete command is as follows:
# tar CVPJF ubuntu.tar.bz2–exclude=/proc–exclude=/lost+found–exclude=/ubuntu.tar.bz2–exclude=/mnt–exclude=/sys/

2. Recovery System
Switch toRoot user, and put the file"Ubuntu.tgz" is copied to the root directory of the partition.
InOne of the wonderful things about Linux is that you can restore your system in a running system without needingBOOT-CD for special guidance. Of course, if your system has been hung up and cannot be started, you can use live CD to start, the effect is the same.
Use the following command to restore the system:
# tar Xvpfz ubuntu.tgz-c/
If your profile is using bzip2 compressed, should be used:
# tar XVPFJ ubuntu.tar.bz2-c/
Note: The above command overwrites all files on the partition with the files in the archive file.
parameter x is to tell tar program to extract the backup file. The  -c  parameter is the directory to which the specified tar program is extracted. / ), this will take a while. Just make sure to recreate your excluded directories before you do anything else:   (/proc,/lost+found,/mnt,/sys, , etc.). # Mkdir/proc/lost+found/mnt/sys
or:
# mkdir proc
# mkdir lost +found
# mkdir mnt
# mkdir SYS
Before you perform the restore command, confirm that the command you typed is what you want, and it may take a short time to execute the restore command. Comprehend by analogy, proficient in the above operation, the user and some of the upgrade files for regular backup, you can save a lot of time and improve security.

Ubuntu14.04 how to back up and restore the system

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.