[PC-BSD Testing] Cloning a PCBSD installation, updated

Ian Robinson fitchkendall at gmail.com
Tue Jan 4 12:06:46 PST 2011


Several weeks ago, Kris responded to a user with information about cloning a
PCBSD hard disk, and Kris provided this advice:

========== Kris' advice ==================

Personally when I do a backup / clone to another drive, I prefer to just use
"tar" to backup all the files individually, and then re-create the
partitions on the new disk fresh, since geom may be different between them,
etc.

So, here's how I would do it:

# cd /
# tar cvjf /usr/myback.tbz --exclude ./usr/myback.tbz --exclude ./dev .

Then format / mount the new disk somewhere, like /mnt, and extract the
archive:

# cd /mnt
# tar xvpf /usr/myback.tbz

Then if you partitioned correctly, you should be able to boot right off the
new disk :)

--
Kris Moore
PC-BSD Software
======== End Kris' advice =====================

I hit a couple of problems in the extraction doing what Kris suggested.  The
problems were in two areas:

(1) when the backup file was created with a "z" or a "j" flag to create a
.tbz tarball, the extract command also needed to have the "z" or "j" flag

(2) when the target disk is divided into separate slices for "/", "/var",
and "/usr" (as is the current fashion for FreeBSD/PCBSD file systems
contrasted with the previous PCBSD practice of having a single file system
slice mounted as "/"), then I had to mount each slice on /mnt/  [/mnt,
/mnt/var, /mnt/usr] * For example, where the tarball to be extracted
(8200_backup.tbz) is located on a disk recognized as ad6s1a which will be
mounted at /media, and where the target disk is recognized as ad4s2, and the
slices are ad4s2a (for "/"), ad4s2d (for "/var"), and ad4s2e (for "/usr")
then the working command set is:


#mount /dev/ad6s1a /media    [the location holding the backup file]

#mount /dev/ad4s2a /mnt        [the location of the root (/) directory,
approx 2 Gib]
#mount /dev/ad4s2d /mnt/var    [the location of the var (/var) directory,
approx. 1 Gib]
#mount /dev/ad4s2e /mnt/usr    [the location of the usr (/usr) directory,
approx. 700 Gib on my disk]

#cd /mnt
#tar xvzpf /media/8200_backup.tbz


*  If you don't do this, you will fill up the 2 Gib "/" slice almost
immediately, and the extraction will generate a disk full error for each
successive file that tar attempts to extract.

I used #sysinstall -> configure -> label to determine the disk id and the
slices.

So, if the target disk has a file system consisting of a single slice, then
Kris' cloning instructions work flawlessly.  But if you have your target
disks is divided into separate slices for /, /var, and /usr, you must mount
each slice so that the extract command works as intended.

Ian Robinson
Salem, Ohio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pcbsd.org/pipermail/testing/attachments/20110104/0b28742b/attachment.html>


More information about the Testing mailing list