On Mon, 28 Jan 2013 15:53:25 +0100, Ralf Mardorf wrote:
> Hi :)
> 
> I don't understand how to use the restore command.

The answer is in "man restore". :-)



> root@freebsd:/mnt/dump # restore -v -t  
> dump-9.1-RELEASE-20130123_193142-usr_f.dump
> Verify tape and initialize maps
> /dev/sa0: No such file or directory

Correct. The program defaults to a tape drive /dev/sa0 to read
dumps from. You need to specify -f <file> if you want to read
from a file instead.

Also: Note that restore will usually restore the files in the
current (!) directory, so you need to cd to where you want to
extract the dump to.



> root@freebsd:/mnt/dump # restore -v -t -f  
> dump-9.1-RELEASE-20130123_193142-usr_f.dump
> Verify tape and initialize maps
> Tape block size is 32
> Tape is not a dump tape

Did you create the dump in some non-default format?



> FWIW the dump files are on a ext3 fs. I know that I don't need to backup  
> /tmp.

It shouldn't matter what filesystem the dump files are stored
on. It's just important they are in the correct format.



> The backups were done by this script, perhaps I've done something wrong:
> 
> root@freebsd:/mnt/dump # cat /root/dump.sh
> #! /bin/bash

Ern... two things: Do you _really_ have /bin/bash on FreeBSD?
I know this is possible.

And do you use any bash-specific features in your script? If
not, why not use /bin/sh, the "universally" accepted standard? :-)



> # bash dump.sh
> 
> dumpstart=$(date "+%Y%m%d_%H%M%S")
> dump_path="/mnt/dump/dump-$(uname -r)-$dumpstart"
> rootdir_a="/dev/ad4s1a"
> usr_dir_f="/dev/ad4s1f"
> var_dir_d="/dev/ad4s1d"
> tmp_dir_e="/dev/ad4s1e"
> 
> #mkdir $dump_path
> dump -0Launf - $rootdir_a | bzip2 > "$dump_path-roota.dump"
> dump -0Launf - $usr_dir_f | bzip2 > "$dump_path-usr_f.dump"
> dump -0Launf - $var_dir_d | bzip2 > "$dump_path-var_d.dump"
> dump -0Launf - $tmp_dir_e | bzip2 > "$dump_path-tmp_e.dump"
> echo "Started: $dumpstart"
> echo "   Done: $(date "+%Y%m%d_%H%M%S")"
> 
> exit 0

Looks correct, but read carefully:

> dump -0Launf - $usr_dir_f | bzip2 > "$dump_path-usr_f.dump"

Now compare again:

restore -v -t -f dump-9.1-RELEASE-20130123_193142-usr_f.dump

Do you notice bzip is involved in the creation step, but not
in the reading step?

You need to apply uncompression first so that restore will
have data in .dump format (instead of .dump.bz2 which it
obviously cannot understand). Verify:

file dump-9.1-RELEASE-20130123_193142-usr_f.dump

So using proper file extensions can prevent confusion. :-)



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

Reply via email to