From owner-freebsd-questions@FreeBSD.ORG Mon Jan 28 15:54:28 2013 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D414E19A for ; Mon, 28 Jan 2013 15:54:28 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx01.qsc.de (mx01.qsc.de [213.148.129.14]) by mx1.freebsd.org (Postfix) with ESMTP id 922E5759 for ; Mon, 28 Jan 2013 15:54:28 +0000 (UTC) Received: from r56.edvax.de (port-92-195-8-191.dynamic.qsc.de [92.195.8.191]) by mx01.qsc.de (Postfix) with ESMTP id 2B7943CFFE; Mon, 28 Jan 2013 16:54:26 +0100 (CET) Received: from r56.edvax.de (localhost [127.0.0.1]) by r56.edvax.de (8.14.5/8.14.5) with SMTP id r0SFsTnq003126; Mon, 28 Jan 2013 16:54:29 +0100 (CET) (envelope-from freebsd@edvax.de) Date: Mon, 28 Jan 2013 16:54:29 +0100 From: Polytropon To: "Ralf Mardorf" Subject: Re: Usage of "restore" Message-Id: <20130128165429.c5368afe.freebsd@edvax.de> In-Reply-To: References: Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: FreeBSD quest X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Polytropon List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jan 2013 15:54:28 -0000 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 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, ...