[PC-BSD Testing] Backing up a PC-BSD disk

Kris Moore kris at pcbsd.org
Mon Nov 1 08:00:30 PDT 2010


On Mon, Nov 01, 2010 at 05:39:33PM +0300, Odhiambo Washington wrote:
> On Mon, Nov 1, 2010 at 5:28 PM, Kris Moore <kris at pcbsd.org> wrote:
> 
> > On Mon, Nov 01, 2010 at 12:49:47PM +0300, Odhiambo Washington wrote:
> > > I installed PC-BSD (FreeBSD option) on a disk on which I only created /
> > > (ufs+journal) and swap.
> > > >From the handbook (
> > > http://www.freebsd.org/doc/en/articles/gjournal-desktop/article.html), I
> > am
> > > still unable to tell how much space the PC-BSD installer allocated for
> > the
> > > journal provider, which according to my understanding, resides on the
> > same
> > > partition as the data.
> > >
> > > Is the journal size defaulting to 1GB as the handbook says, or does the
> > > installer use a different value?
> > >
> > >
> > > [wash at gw ~]$ df -h
> > > Filesystem          Size   Used     Avail    Capacity Mounted on
> > > /dev/label/rootfs0  273G    9.8G   242G   4%         /
> > > devfs                   1.0K     1.0K       0B   100%     /dev
> > > devfs                   1.0K     1.0K       0B   100%     /var/named/dev
> > >
> > > I am so much used UFS2 type filesystem where I create / and swap and I'd
> > > always get an identical size disk for backup. The backup would take the
> > > form:
> > >
> > > dump -L0af - / | (cd /disk2; restore -rf -) # And this is disk
> > duplication
> > > to me, so I can use disk2 as primary disk should disk one fail.
> > >
> > > When it comes to ufs+journal, I am a bit lost on how to do things right
> > when
> > > I need to make a second disk (disk2) to have same partition layout as
> > disk
> > > 1.
> > >
> > > Suppose both disks are 320GB, can I use dd to create the duplicate
> > > structure, with journaling enabled??
> > > dd if=/dev/adX of=/dev/adY bs=1m
> > >
> > > But if you tell me that the PC-BSD installer allocated 1GB for the
> > journal,
> > > then I can follow the handbook instructions to partition my disk
> > > accordingly. However, given that the installer mounted /dev/label/rootfs0
> > on
> > > /, I am not sure what will be the name of my filesystem on disk2 when I
> > > create it from the CLI. I'd love to partition as follows:
> > >
> > > gw# bsdlabel -A /dev/ad4
> > > bsdlabel: /dev/ad4: no valid label found
> > >
> > > Since I am unable to read the disk label of the first disk, I am not
> > certain
> > > how to go about creating a similar label on disk2. I thought I could read
> > > out the disk label on disk1 and just write that to disk 2.
> > >
> > >
> > > Secondly, I am not sure how I can backup the first disk onto disk2 using
> > > dump once I have done the labels.
> > >
> > >
> > > --
> > > Best regards,
> > > Odhiambo WASHINGTON,
> > > Nairobi,KE
> > > +254733744121/+254722743223
> > > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> > > Damn!!
> >
> > > _______________________________________________
> > > Testing mailing list
> > > Testing at lists.pcbsd.org
> > > http://lists.pcbsd.org/mailman/listinfo/testing
> >
> > 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, heres 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 extra 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 :)
> >
> 
> 
> Hi Chris,
> 
> What is the disadvantage of using dump|restore after partitioning correctly?

None that I'm aware of, I'm not a big user of 'dump/restore', I'm a 'tar' guy myself,
so I was just chiming in with an alternative way to do the same thing :)

> 
> Anyway, you did not answer my question, or I haven't understood your point.
> I understand the disk geometry may differ, but I only use dump after
> partitioning, in which case I believe only files are written over, and
> nothing to do with geom, right?

I believe that is the case, I was thinking of what you said about using "dd" though, which
will try to grab everything, including partitioning. 

> 
> How can I duplicate my disk1 - the one I presented - and still ensure the
> result I get has journaling enabled?
> I am looking at a situation where, if disk one failed, I could simply
> disconnect it, connect disk 2 into the same channel and boom!
> 

Gotcha. It sounds like you want to use "gmirror" though, to keep a consistent copy of
whats on disk 1, on disk 2, and do a failover, right? Otherwise you'll be stuck having to 
keep manually syncing data from disk1 -> disk2?

However if you want to go the manual route, then you should be able to do this with either tar/dump
no problem. You'll just need to re-create disk2 with the same partition layout or similar to disk1,
make sure you setup your single "/" partition with gjournal and you'll be in business. 

The only weirdness I forsee is that we use "glabel" to setup /dev/label/rootfs0 as a link to 
/dev/ada0s1a.journal or whatever the particular devicename is you are using. If a failure occurs
and you need to swap disks, you may need to manually label the new partition when you try to boot
from it, otherwise you may get mount failures when it hits /etc/fstab :)


-- 
Kris Moore
PC-BSD Software


More information about the Testing mailing list