Backing up freebsd to 1 file?

Chris Rees utisoft at
Mon Apr 19 20:12:02 UTC 2010

On 18 April 2010 15:56, J.D. Bronson <jd_bronson at> wrote:
>  be created by the time your system boots on.
>> Nice answer by Sergio, but I personally would use the j option with tar
>> to compress to bzip2;
>> 3) tar --one-file-system -cvjf /mnt/backup.tbz ./ var usr home
>> Though I prefer personally to use dump/restore because:
>> - If you're on UFS, you don't have to single-user the system, just use
>> the L option (live filesystem)
>> - Restore has an awesome 'interactive' mode
>> - See Zwicky [1]
>> I'll send you my dump scripts if you're interested. It's dead easy to use!
>> Chris
>> [1]
>> .
> I think Sergio has a nice script. I had been doing something similar but I
> know I recall when untarring  (restoring if you will) it was complaining
> about not being able to do things. It was not sockets and similar stuff that
> gets rebuilt on reboot. I do not have failures handy to post (yet).
> Truth be told? - I am running FreeBSD hosts within ESXi. I can backup the
> hosts within ESXi but need to take the host offline and its a cumbersome
> ordeal. If I had RAID on ESXi, I wouldn't be so worried per se but this is
> not an option. ESXi is very fussy about what is supported and I dont have
> the $ for SCSI and SCSI Raid.
> Basically what I need to do is create a fully restorable backup for 2
> reasons:
> 1. Easy to create another host on ESXi. I can setup/flavor my fbsd install
> and then once thats done, setup another host.
> 2. Obvious backup reasons.
> ...right now, if the SATA drive fails that is hosting the fbsd install I am
> dead in the water. I have 5 hosts on this machine spread across 4 SATA
> drives but nothing is mirrored or RAIDed in anyway.
> I am at the mercy of these drives w/o any backup-

Yeah, use dump. It's excellent, and you can bz2 the results.

My script for dumping:

# $Id:,v 1.3 2010/02/02 13:02:06 root Exp $
# $Log:,v $
# Revision 1.3  2010/02/02 13:02:06  root
# Changed so that backup/spare is only manipulated when backup level is 0
# Revision 1.2   2009/12/22 16:13:05 root
# Now uses bzip2


mount /backup/dumps

mv /backup/dumps/root_level_$LEVEL.bz2 /backup/dumps/root_level_$LEVEL.bz2.old

dump -$LEVEL -Lauf - / | bzip2 > /backup/dumps/root_level_$LEVEL.bz2

mv /backup/dumps/var_level_$LEVEL.bz2 /backup/dumps/var_level_$LEVEL.bz2.old

dump -$LEVEL -Lauf - /var | bzip2 > /backup/dumps/var_level_$LEVEL.bz2

mv /backup/dumps/usr_level_$LEVEL.bz2 /backup/dumps/usr_level_$LEVEL.bz2.old

dump -$LEVEL -Lauf - /usr | bzip2 > /backup/dumps/usr_level_$LEVEL.bz2

umount /backup/dumps


I call it from cron ~3 in the morning with a tower of hanoi rotation;
it takes the argument to the script as the dump level;

/root/ 0

performs a level 0 dump of all the drives.

Don't forget to back up _all_ your partitions! Dump only backs up
separate partitions...


More information about the freebsd-questions mailing list