Use tar backup to restore the entire Ubuntu Process

Source: Internet
Author: User

Operating System: Ubuntu 10.04
Hardware environment: VMware Workstation 7.1.6, a virtual machine running on Windows xp

Cause of tossing: I have been running ubuntu under the virtual machine, and it is often easy to back up and restore the system under the Virtual Machine. For vmware, you only need to use snapshots to back up and restore the system. I have been doing this before, snapshots are taken 5 or 6 times. However, you have manually deleted these snapshot files. I have always thought that the snapshot function of vmware is amazing, and the snapshot file is only MB .. then we can completely restore everything .. I found that no. the space occupied by my ubuntu virtual machine has become abnormally large (close to 80 GB), but less than half of the space occupied by all the items in ubuntu, so the idea of restoring the backup system ....

Backup and restoration ideas: tar backs up the entire system (excluding unnecessary items), creates a new virtual machine, installs the same system, and uses the same partitioning scheme, after the installation is complete, copy the backup system to the new system, and then go to live cd rm-rf to remove everything except the backup file and unnecessary file deletion, and then tar recovery.

Step 1 backup:
Run the following code in the/directory:

Code:
Sudo tar-cvpjf/main_backup.tar.bz2 -- directory =/-- exclude = opt/ti-ezsdk_dm816x-evm_5_03_01_15 -- exclude = opt/exclude -- exclude = opt/ti -- exclude = home/tracyone/MPC_PROJ -- exclude = root /DVS_PROJ -- exclude = root/workspace_v5_2 -- exclude = mnt -- exclude = proc -- exclude = lost + found -- exclude = sys -- exclude = media -- exclude = dev -- exclude = tmp success.


Well, some people on the Internet only forward, do not verify, find tar backup-related items on the Internet, and find that all of the previous articles are in the form of "-- exclude =/mnt, I have proved that after doing so, the mnt folder will still be included. The correct method is "-- exclude = mnt", because I restored it to another computer (another virtual machine, in addition, the dev folder cannot be included.

Step 2 install a new Virtual Machine
Make sure that the same system has the same partition. I have never tried to restore the data in different partitions. I guess it will not work. Both virtual machines are one/Add one swap and two partitions.

Step 3 restore:
After the new virtual machine is installed, enter its livecd (set cdrom to start and specify the iso file of the ubuntu system to enter)
After entering live cd, open the file browser and you will see the xxG File System on the left side. Clicking it will automatically mount it to the/media folder.

Code:
Sudo-s
Cd/media/<corresponding uuid number>
Rm-rf root home usr lib etc .........
Sudo tar-xvjpf main_backup.tar.bz2-C/mnt


Do not delete the folders excluded from the backup system, such as dev mnt media sys.

After recovery, do not rush to restart, because it is a different hard disk
Therefore, we must modify the startup configuration.
Run

Code:
Gedit/media/<uuid number>/boot/grub. cfg

Find the string similar to "22efe8c5-af5e-4744-b7e4-9901a29a679c"
This is the uuid of your hard disk device. Each hard disk is different.
Check the uuid of your current hard disk and replace it with the uuid in grub. cfg.
The viewing method is as follows:

Code:
Sudo blkid/dev/sdax

X depends on the partition where your boot file is located. my/AND/boot are in the same partition, so ..

  • 1
  • 2
  • Next Page

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.