# dump, restore, and the /usr mount



## pgmrdlm (May 21, 2010)

Using the example found here: http://forums.freebsd.org/showthread.php?t=185, I have been backing up my desktop freebsd box. I used the gzip example, and the files that were created were placed in a samba network mounted folder.

Over the last couple days, I have been doing port upgrades to just stay up to date and one of those ports that was upgraded was xorg. It went from xorg_4.7 to 5.?.  Something like that, can't rember what.  When I rebooted my machine, xwindows did not launch.  I have poked around, and tried different things, but never figured out why it would not launch. Point being, I wasn't to worried because I thought I could restore back.

I copied my backup of the /usr director to a thumb drive and mounted it to a sub directory on /.  I then tried to perform a newfs -U to ad0s1f(/usr slice) which did not work(I beleive because this slice was still mounted).  Even though I now I missed a step, I then umounted that slice and tried to perform a zcat <backup file name> | restore -rf. zcat was not found. Ok, I can understand this. Not an issue. the /usr slice was no longer mounted which contains the binaries.

sooooooooooooooo, how the bloody heck do a restore of the /usr directory then?  I have seen some references here of the fixit boot floopy?  hu? Right now, I don't have one of them.  Is this the route I need to follow??? 

Ok, looking here in the handbook: http://www.freebsd.org/doc/en/books/handbook/backup-basics.html


> Second, determine that the boot and fix-it floppies (boot.flp and fixit.flp) have all your devices. The easiest way to check is to reboot your machine with the boot floppy in the floppy drive and check the boot messages. If all your devices are listed and functional, skip on to step three.



um, can we do this some way off a cd?????  If I create the bootable cd/floopy, am I going to be able to run zcat/gzip -d to uncompress the dump backup I created?

I'm about ready to do the "if in doubt, throw the p.o.s. out" restore procedure.  ie: reload FreeBSD from scratch. But I really would like to know the correct way to restore from backups.


----------



## pgmrdlm (May 21, 2010)

*additional information*

This machine is still bootable and fully functional other then xwindows and kde.  At least I think it is lol.

Dan


----------



## graudeejs (May 21, 2010)

depending on your setup you can:
a) reboot in single user mode
b) use dvd1/LiveFS cd/ubs stick to get yourself in fixit mode
from there you can fix anything

If you need further instruction, let us know (I assume you know how to boot to single user mode, and fix stuff)

also maybe show your logs, perhaps install is OK, but something else is not
/var/loc/Xorg.0.log


----------



## SirDice (May 21, 2010)

Both zcat and restore are also available in /rescue/. No need to boot a live CD.


----------



## pgmrdlm (May 21, 2010)

*Well that was fun, definite learning experience*

First, let me apologize for not coming back and updating that I had found the live cd iso's off the FreeBSD web site. I was trying to figure out the rest of this restore procedure.

I am going to post this full restore procedure because to be honest, in all my google searching I did not see a complete restore example from a zipped dump backup file.

```
1). Boot to single user mode
2). Boot into fixit mode with a live cd.
3). Mount the medium where your restore file is. In my case, it was an 8 gig thumb drive.
4). Problem 1, not enough temp space for restore.
*** Hopefully your medium you mounted has a decent amount of free space. The fixit partition does not have much tmp space, and both the 
gzip(compression agent) and restore commands required more space then I had.
    4a). rm -rf tmp
    4b). mkdir /mnt/tmp
    4c). ln -s /mnt/tmp /tmp
5). "newfs -U ad0s1f"
*** I am restoring my usr partition, and that was the device slice for it. I
6). Mount the directory you are about the restore
*** This took a bit of searching on my part to find out this needed to be done.
    6a). mkdir rebuild_ad0s1f
    6b). mount /dev/ad0s1f rebuild_ad0s1f
7). Restore the file slice.
*** Problems I encountered actually doing this.
    Problem 1: The way I was using the restore procedure was expecting console input, and I did not have the syntax of my gzip correct for 
outputting to console. 
    Problem 2: You need to be physically in the directory you are restoring.  grrrr

gzip -d -c 20100502_usr_ad0s1f.gz | restore -rf -
```

Like I said, I have found complete examples of using the dump. But darned if I could find a complete example of doing a restore from a compressed backup file.

Oh well, if that was a waste of everyones time. I do apologize.


----------



## graudeejs (May 21, 2010)

From my howto


			
				killasmurf86 said:
			
		

> to restore from compressed backup
> 
> ```
> $ bzcat /mnt/usb/ad0s1d.dump.bz2 | restore -rf -
> ```



if you used gzip, to compress, then use gzcat instead of bzcat

perhaps go and read:
http://forums.freebsd.org/showthread.php?t=185
again, especially *Restoring system* section


----------



## pgmrdlm (May 22, 2010)

*actually, I used gzip -d -c to decompress*

The -c option sent the output to stdout which was piped into the restore.

I used your example ;o), thats actually why I had backups in the first place. Your article/examples,


----------



## graudeejs (May 22, 2010)

so what is exact problem right now? Are there any problem left?
(After rereading your 4 all yor problems would have been avoided if you stick to howto more strictly)


----------



## pgmrdlm (May 22, 2010)

None, I have completed the restores.

My problems were:
I did not know I had to use the live cd/dvd file system, and be in fixit mode.
I didn't know I had to mount the file system/slice after I did a newfs it.
I didn't know I had to be in that file system/slice when I performed the restore.
Your right, I didn't use the gzcat you have listed in your article. But, I am more comfortable with gzip which is why I used it.  Just had to do a man page lookup for that one to be resolved.


----------



## graudeejs (May 22, 2010)

pgmrdlm said:
			
		

> None, I have completed the restores.
> 
> My problems were:
> I did not know I had to use the live cd/dvd file system, and be in fixit mode.
> ...



Which proves what I said: You didn't read howto properly (it mentioned, that you need to mount it, cd to it etc...)

anyway you fixed you problem, congratulations.
If you already can edit your posts add Solved tag to this thread.


----------

