The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]

Things look quiet here. But I've been doing a lot of blogging at dan.langille.org because I prefer WordPress now. Not all my posts there are FreeBSD related. I am in the midst of migrating The FreeBSD Diary over to WordPress (and you can read about that here). Once the migration is completed, I'll move the FreeBSD posts into the new FreeBSD Diary website.

drive to drive backup 8 May 2000
Share
Need more help on this topic? Click here
This article has 4 comments
Show me similar articles
Right after I finished finishing adding a new drive, I had to copy the contents of an existing drive to that new drive.  This was pretty easy.  The more I learn about tar, the more I like it.
tar is your friend
First, I mounted the destination drive as /backup:
# mount /dev/wd1c /backup

I wanted to backup all of wd0.  This consists of /, /usr, and /var.

xymix (someone on IRC) told me about these two methods:

  • cd /SRC;dump 0f - . | (cd /DST; restor -rf - )
  • cd /SRC;tar -cf - . | (cd /DST; tar xpf - )

So here's what I did for the three slices I wanted to backup:

(cd /    ; tar -cvlf - .) | (cd /backup/    ; tar xpf -)
(cd /var ; tar -cvlf - .) | (cd /backup/var ; tar xpf -)
(cd /usr ; tar -cvlf - .) | (cd /backup/usr ; tar xpf -)
So why did you use tar?
The reason I used tar is I like it.  I could have used dump, but didn't.  I also think cp -Rp is an option here.  As is dd.  You might also want to read Swapping boot drives around.   But with as something as important as backup, I'd prefer to stick to things like tar, or dump which were made for backups.  I'm sure the other tools would work just fine, but I'm not as familiar with them.  I wouldn't want to find out later that "oooh so *that's* why I shouldn't use cp"....
Share
Need more help on this topic? Click here
This article has 4 comments
Show me similar articles