Just Installed and when to back it up

Folks....I have just finished installing what I would like to call my base FreeBSD installation. From here I will be experimenting with and learning about FreeBSD. Thus, I would like to make a backup of this install for easy/quick recovery if one of my experiments goes wrong. On a Windows box I would have used GHOST.

I have Googled and read but questions remain and practical advice seems to have eluded me.

Here is where I am. I have created, formated and mounted an external USB hard disk.

Here is the df -h output:
Code:
Filesystem                Size    Used   Avail Capacity  Mounted on
/dev/ad0s1a               496M    169M    287M    37%    /
devfs                     1.0K    1.0K      0B   100%    /dev
/dev/ad0s1e               496M     50K    456M     0%    /tmp
/dev/ad0s1f               176G    1.3G    161G     1%    /usr
/dev/ad0s1d               2.9G     92M    2.6G     3%    /var
/dev/ufs/BUDiskFreeBSD    289G    8.0K    271G     0%    /mnt

where the last entry is my external drive which has one folder bu022211

Some authors suggest backing up everything while others seem to propose deleting the ports directory as it can be easily restored with portsnap. And, there seem to be many other variants.

From a "How to" on this forum,

dump -0Lauf /path/to/backups/ad0s1d.dump /dev/ad0s1d
and
dump -0Lauf - /dev/ad0s1d | bzip2 > /path/to/backups/ad0s1d.dump.bz2.

Does this "How to" imply that I only need to back up the ad0s1d folder (/var) to later do a full restore?

Assuming I would use the latter command above, it this the correct format to create a compressed image on my external hard disk?
dump -0Lauf - /dev/ad0s1d | bzip2 > /mnt/bu022211/ad0s1d.dump.bz2

Then for restoring, after any necessary disk maintenance tasks

bzcat /mnt/bu022211/ad0s1d.dump.bz2 | restore -rf -

and a reboot to be back in operation?

Thanks in advance.....GK
 
GrizzlyKing said:
From a "How to" on this forum,

dump -0Lauf /path/to/backups/ad0s1d.dump /dev/ad0s1d
and
dump -0Lauf - /dev/ad0s1d | bzip2 > /path/to/backups/ad0s1d.dump.bz2.

Does this "How to" imply that I only need to back up the ad0s1d folder (/var) to later do a full restore?
No, it's just an example how to backup one filesytem. Since a 'normal' FreeBSD installation consists of multiple filesystem you'll have to do the same 'trick' for each one.

AFAIK you can use Ghost or similar programs to image a FreeBSD system. I don't have any experience with it but I know it's possible.

As far as myself is concerned I only have a directory with all the packages I've installed and only backup a few configuration files. It's usually quicker to do a clean install (with the saved packages) and restoring the configuration files then it is to do a full restore of all filesystems.
 
net/grsync is that you are looking for I guess. I have used it to backup a lot of things on my system. System's files and folders too. Never understood why exist on net section. Maybe because also you can backup to network :)
 
GrizzlyKing said:
Some authors suggest backing up everything while others seem to propose deleting the ports directory as it can be easily restored with portsnap.

There can be a lot of large distfiles in /usr/ports. chflags(1) can be used to set the nodump flag, and dump ... -h0 will skip those files or directories on a level 0 dump.

Other directories you might want to skip are /usr/src and /usr/obj, some may be present and huge like /usr/.ccache.

Examples here: Backup Options For FreeBSD
 
I do backups of my 2 servers about once a month. I have never encountered a catastrophe where a full backup was needed, but I have had to recover individual files.

The commands I enter to do the backup are as follows. I actually do an SSH command with the '-R' flag from my home computer to the server, that's why you see localhost connections here.

Code:
bsdlabel ad4s1                    | ssh -p 22222 nlandys@localhost dd of=/home/nlandys/backup/daffy/bsdlabel_ad4s1
dmesg -a                          | ssh -p 22222 nlandys@localhost dd of=/home/nlandys/backup/daffy/dmesg
dd if=/dev/ad4 bs=512 count=1     | ssh -p 22222 nlandys@localhost dd of=/home/nlandys/backup/daffy/MBR
cat /etc/fstab                    | ssh -p 22222 nlandys@localhost dd of=/home/nlandys/backup/daffy/fstab
dump -0Lan -C 16 -f - /    | gzip -2    | ssh -p 22222 -c blowfish nlandys@localhost dd of=/home/nlandys/backup/daffy/dump0-root.gz
dump -0Lan -C 16 -f - /tmp | gzip -2    | ssh -p 22222 -c blowfish nlandys@localhost dd of=/home/nlandys/backup/daffy/dump0-tmp.gz
dump -0Lan -C 16 -f - /var | gzip -2    | ssh -p 22222 -c blowfish nlandys@localhost dd of=/home/nlandys/backup/daffy/dump0-var.gz
dump -0Lan -C 16 -f - /usr | gzip -2    | ssh -p 22222 -c blowfish nlandys@localhost dd of=/home/nlandys/backup/daffy/dump0-usr.gz

You'll have to adjust the partition numbers if you use a similar strategy.
 
Oh.. A tip I recently read somewhere which is really, really good advice. No matter how you decide to do your backups..

Don't test your backup strategy, test your restore procedures.

You won't be the first who's been diligently backing up everything for the past 5 years only to find out at the worst possible moment that the backups are worthless.
 
Martillo1 said:
How about replicating a slice? Is it possible?

A slice is just a bsdlabel describing the FreeBSD partitions plus the filesystems on those partitions. One way to duplicate it is to use bsdlabel(8) to create new FreeBSD partitions within the slice (see Disk Setup On FreeBSD), newfs(8) them, and restore from dumpfiles.

Another way is with a binary copy like Clonezilla or dd(8). That's fraught with peril, but is used routinely, or dd(8) is, anyway. Both are described in the article linked in post #4.
 
Ghost should work, it seems you have created MBR style slice ("Windows Partition"). But though shalt not use Symmantec software so give http://en.wikipedia.org/wiki/Clonezilla a try.

Create another slice on the disk using something like gParted Live CD, then Clone from your BSD Slice to the new Slice by booting up the gParted Live CD.. And do the reverse to recover ;)
 
Thanks to all who have replied to my posting. I think SirDice has come the closest to addressing my question and uncertainties. Dump basically copies a part of the file system, ad0s1d in my example. So to have a complete backup of my install I would need to run dump (and restore) on the ad0s1d (/var), ad0s1f (/usr) and ad0s1e (/tmp) file systems detailed in my original note?

I also need to acknowledge wblock for his comments on "stuff" which can be skipped during the dump and the use of chflags to do it.

Now, regarding GHOST, I don't think it will work like it does with a Windows disk, i.e. copying only the used parts of the disk. I suspect it will basically do a sector by sector copy, thus a 500 GB hard disk will require a 500 GB backup disk. No data to support this, but a strong suspicion.

Now I need to do the backup and, as SirDice suggested, test the restore. Scary thought to purposely overwrite a good, working system to see if I got the backup parts right!!

Thanks again....GK
 
GrizzlyKing said:
Dump basically copies a part of the file system, ad0s1d in my example. So to have a complete backup of my install I would need to run dump (and restore) on the ad0s1d (/var), ad0s1f (/usr) and ad0s1e (/tmp) file systems detailed in my original note?
Exactly. And don't forget to change both the device (adXsYz) as well as the name of the dump file accordingly for each one. dump doesn't append, it overwrites.
dump/restore are IMHO the best and easiest method and they're available right in the base system.

GrizzlyKing said:
I also need to acknowledge wblock for his comments on "stuff" which can be skipped during the dump and the use of chflags to do it.
% man dump | less +/"Directories and regular"

GrizzlyKing said:
Now I need to do the backup and, as SirDice suggested, test the restore. Scary thought to purposely overwrite a good, working system to see if I got the backup parts right!!
% man restore | less +/"Do the extraction"

Otherwise, if you have a spare disk, test the backup on it. You always need to newfs the filesystem before using restore anyway.
 
GrizzlyKing said:
Thanks to all who have replied to my posting. I think SirDice has come the closest to addressing my question and uncertainties. Dump basically copies a part of the file system, ad0s1d in my example.

That isn't a part of the file system, it is an entire filesystem. A normal FreeBSD install has several filesystems: /, /var, /tmp, and /usr.

So to have a complete backup of my install I would need to run dump (and restore) on the ad0s1d (/var), ad0s1f (/usr) and ad0s1e (/tmp) file systems detailed in my original note?

Also /, which has a lot of important things like etc.
 
Folks....Well, finally getting back to this project, real work and real play (skiing) got in the way.

One of the later replies suggested testing my backup procedure by restoring to a spare disk. Does it have to be exactly the same size as the original?

Thanks.....GK
 
No, all you need is a free partition big enough to hold the data.
The partition can be on the disk you backed up from or another disk. Just make sure it won't run full during the restore.
 
Back
Top