# Restore dump with existing directories



## xy16644 (Jul 27, 2012)

I am setting up a test system with encryption and ZFS. I have been following this guide:

Full Disk Encryption (with ZFS root) for FreeBSD 9.x

I'm having trouble restoring my dump file. After I have set all the ZFS mount points:

```
zfs set checksum=fletcher4 zroot
zfs create -o compression=on -o exec=on -o setuid=off zroot/tmp
chmod 1777 /boot/zfs/zroot/tmp
zfs create zroot/usr
zfs create zroot/usr/home
cd /boot/zfs/zroot; ln -s /usr/home home
zfs create -o compression=lzjb -o setuid=off zroot/usr/ports
zfs create -o compression=off -o exec=off -o setuid=off zroot/usr/ports/distfiles
zfs create -o compression=off -o exec=off -o setuid=off zroot/usr/ports/packages
zfs create zroot/var
zfs create -o compression=lzjb -o exec=off -o setuid=off zroot/var/crash
zfs create -o exec=off -o setuid=off zroot/var/db
zfs create -o compression=lzjb -o exec=on -o setuid=off zroot/var/db/pkg
zfs create -o exec=off -o setuid=off zroot/var/empty
zfs create -o compression=lzjb -o exec=off -o setuid=off zroot/var/log
zfs create -o compression=gzip -o exec=off -o setuid=off zroot/var/mail
zfs create -o exec=off -o setuid=off zroot/var/run
zfs create -o compression=lzjb -o exec=on -o setuid=off zroot/var/tmp
chmod 1777 /boot/zfs/zroot/var/tmp
```

I then try to do a restore into /boot/zfs/zroot as follows:

`# restore -rf /media/restore.dump`

It then complains that the directories already exist (from the mount points created above). After the restore all these directories are empty.

So I started working throught the guide again but this time I didn't create the ZFS mount points and everything was restored into /boot/zfs/zroot just fine. The problem came when I tried to create the ZFS mount points again. After doing this all those mountpoint directories were empty again.

So my question is, how does one restore a dump file onto a ZFS partition AND create the ZFS mountpoints? Do I need to create the ZFS mount points and then FORCE a restore of my dump file over existing directories?

Thank you!


----------



## wblock@ (Jul 27, 2012)

See restore(8) about -u.  I have not tried it with ZFS, though.


----------



## xy16644 (Jul 28, 2012)

Thank you, that worked.

I have another problem now! :e

I followed that guides instructions to the letter. The only difference is my two drive names and that I am creating a mirror rather than a raidz1.

My drives are called ada0 and ada1. All the commands I ran were with these names. The partition names are ada0p1, ada0p2, ada0p3, ada1p1, ada1p2 and ada1p3. The odd thing is, when I reboot and it askes me for the passphrase it says:


```
GEOM_ELI: Wrong key for ad0p3
```

and even if I enter the correct passphrase it fails. The questions are:

1) Why is it calling my drive ad0p3 instead of ada0p3?

2) Why is it saying wrong key?

When running:

```
gpart create -s gpt ad0
```
It fails so I *must* use:

```
gpart create -s gpt ada0
```

when partitioning. So I only have one option and that is to call the drives ada0 and ada1.

Any ideas? I can't understand what I have done wrong and why its changing the drive names!


----------

