Full System Backups using dump/restore in FreeBSD

This is useful to keep identical copies of your data on a 2nd disk.  It’s NOT a replacement for using RAID1 mirroring – but it can be useful.  e.g. you can access data from the previous backup on a per-file basis.  You could also use it to mirror a current disk to a new disk to go into a seperate server (disk cloning).

What it is REALLY useful for is to copy your data from a smaller disk to a larger disk – but you should do that offline not live.  The examples here are all done using a live filesystem.  To do a non-live filesystem, boot into single user mode, mount the old drives as readonly with mount -o ro -a, then mount the new drive as normal and run the same commands to dump/restore.

Ok, so i’m going to assume that you want to dump the /usr filesystem into /mnt/usr (a filesystem mounted on a seperate disk)…

cd /mnt/usr

dump -L -0 -f- /usr | restore -r -f-

This will dump ALL files in /usr into /mnt/usr.  Status updates are written to the screen every 5 minutes.

As this can be run on a live filesystem, you can run backups during normal operation (although the disk performance hit should be taken into account)

What is really useful is that you can pipe the restore command via ssh to restore to a remote server anywhere on the internet… an example would be…

dump -L -0 -f- /usr | ssh -2 -C -l remoteuser restore -r -f-

That would restore the files into the home directory of ‘remoteuser’ on the remote server.

9 thoughts on “Full System Backups using dump/restore in FreeBSD

  1. David

    Hi Dan,

    Thanks, this is helpful. I’m looking to convert one FreeBSD and one OpenBSD physical server to VMs under VMware ESX. Can I use this procedure to do that?

    I already used dump to save each partition (one file per partition/slice) and created a basic VM on the ESX host of the same disk size. How would restore work in this scenario?

    Thanks again!

  2. dan Post author


    You can still restore to an openbsd disk, as long as the partition isnt one with system files in (e.g. /home partition) – both use the same filesystem types so should be fine.



  3. Ikan Kerapu

    Hi Dan

    How to do full backup freebsd system, i have four partition such as : / /usr /var /home
    I want to backup all folder
    Can freebsd doing this? included freebsd operating system?
    I’m using freebsd 6.4 UFS
    Please tell me how to backup full system

    Best Regards

    Ikan Kerapu

  4. Jonathan Stiansen

    Pipe to `dump | gzip -2 | ssh …` before sending over the inter webs will likely be great. It’s also doesn’t create the intermediate files this way, all compressed 🙂 recommended in the documentation

  5. tom

    Hi Dan
    i have a Problem to dump /usr over 100G it crashes with sigfault Error 11
    / and /var are ok.
    fsck on /usr ok
    cant fix.. use gmirror raid1 2 disks
    OS Freebsd 12 (head/svn)


Leave a Reply

Your email address will not be published. Required fields are marked *