Restore a single file from ufs dump on FreeBSD

Written by - 0 comments

Published on - Listed in BSD Unix


Needed to restore a local file (/etc/ssh/sshd_config) from a ufs dump.
To be safe, I chose to not overwrite the current file with the one restored from the dump, so I created a temporary folder where to restore the file to:

mkdir /var/tmp/restore
cd /var/tmp/restore

Then launch the restore where the format is the following:

restore -x -v -f /path/to/dump filetorestore

restore: The restore command
-x: Extract the given file from the dumpfile
-v: Be verbose
-f: the path to the ufs dump (/path/to/dump)
filetorestore: Within the dump, look for this file to restore

In a practical usage this looks like:

restore -x -v -f /mnt/remotebkp/20140401_0313-level-0/_.dump-0 ./etc/ssh/sshd_config
Verify tape and initialize maps
Tape block size is 32
Dump   date: Tue Apr  1 03:13:22 2014
Dumped from: the epoch
Level 0 dump of / on mymachine.local:/dev/da0s1a
Label: none
Extract directories from tape
Initialize symbol table.
Make node ./etc
Make node ./etc/ssh
Extract requested files
You have not read any tapes yet.
If you are extracting just a few files, start with the last volume
and work towards the first; restore can quickly skip tapes that
have no further files to extract. Otherwise, begin with volume 1.
Specify next volume #: 1
extract file ./etc/ssh/sshd_config
Add links
Set directory mode, owner, and times.
set owner/mode for '.'? [yn] n

Important note: The file to be restore must start with a dot (see ./etc/ssh/sshd_config).
The reason for this is the file system structure within the dump, which can be verified in interactive mode:

restore -i -f /mnt/remotebkp/20140401_0313-level-0/_.dump-0
restore > cd etc
restore > ls
./etc:
[...]


Add a comment

Show form to leave a comment

Comments (newest first)

No comments yet.

RSS feed

Blog Tags:

  AWS   Android   Ansible   Apache   Apple   Atlassian   BSD   Backup   Bash   Bluecoat   CMS   Chef   Cloud   Coding   Consul   Containers   CouchDB   DB   DNS   Database   Databases   Docker   ELK   Elasticsearch   Filebeat   FreeBSD   Galera   Git   GlusterFS   Grafana   Graphics   HAProxy   HTML   Hacks   Hardware   Icinga   Icingaweb   Icingaweb2   Influx   Internet   Java   KVM   Kibana   Kodi   Kubernetes   LVM   LXC   Linux   Logstash   Mac   Macintosh   Mail   MariaDB   Minio   MongoDB   Monitoring   Multimedia   MySQL   NFS   Nagios   Network   Nginx   OSSEC   OTRS   Office   PGSQL   PHP   Perl   Personal   PostgreSQL   Postgres   PowerDNS   Proxmox   Proxy   Python   Rancher   Rant   Redis   Roundcube   SSL   Samba   Seafile   Security   Shell   SmartOS   Solaris   Surveillance   Systemd   TLS   Tomcat   Ubuntu   Unix   VMWare   VMware   Varnish   Virtualization   Windows   Wireless   Wordpress   Wyse   ZFS   Zoneminder   


Update cookies preferences