Clone or Backup Linux System

From Hack Sphere Labs Wiki
Revision as of 18:18, 12 May 2013 by Webdawg (talk | contribs) (Created page with "*https://wiki.archlinux.org/index.php/Disk_Cloning =Using cp= The cp program can be used to clone a disk, one partition at a time. An advantage to using cp is that the filesy...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Using cp

The cp program can be used to clone a disk, one partition at a time. An advantage to using cp is that the filesystem type of the destination partition(s) may be the same or different than the source. For safety, perform the process from a live environment.

The basic procedure from a live environment will be:

  • Create the new destination partition(s) using fdisk, cfdisk or other tools available in the live environment.
  • Create a filesystem on each of the newly created partitions. Example:
mkfs -t ext3 /dev/sdb1
  • Mount the source and destination partitions. Example:
mount -t ext3 /dev/sda1 /mnt/source
mount -t ext3 /dev/sdb1 /mnt/destination
  • Copy the files from the source partition to the destination
cp -a /mnt/source/* /mnt/destination

-a: preserve all attributes , never follow symbolic links and copy recursively

  • Change the mount points of the newly cloned partitions in /etc/fstab accordingly
  • Finally, install the GRUB bootloader if necessary. (See GRUB)