# send|receive mountpoint problem



## blazingice (Jun 14, 2013)

I have two zpools. 


```
NAME     SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
backup   232G   596M   231G     0%  1.00x  ONLINE  -
tank0    149G  1.49G   148G     1%  1.00x  ONLINE  -
```

I created a snapshot of tank0

`#zfs snapshot -r tank0@install`

Then try to send the snapshot to backup/elohim

`#zfs send -R tank0@install | zfs receive -Fduv backup/elohim`

Despite using -u the filesystems in backup/elohim are mounted in the same location as the filesystems in tank0


```
NAME                                USED  AVAIL  REFER  MOUNTPOINT
backup                             2.64G   226G    31K  /backup
backup/elohim                      2.64G   226G    31K  legacy
backup/elohim/ROOT                  418M   226G    31K  legacy
backup/elohim/ROOT/default          418M   226G   406M  /mnt
backup/elohim/ROOT/freshconf          1K   226G   406M  /mnt
backup/elohim/swap                 2.06G   228G    16K  -
backup/elohim/tmp                    35K   226G    35K  /tmp
backup/elohim/usr                   177M   226G    31K  /mnt/usr
backup/elohim/usr/home               43K   226G    43K  /usr/home
backup/elohim/usr/jails              31K   226G    31K  /usr/jails
backup/elohim/usr/obj                31K   226G    31K  /usr/obj
backup/elohim/usr/ports             176M   226G   175M  /usr/ports
backup/elohim/usr/ports/distfiles  1.55M   226G  1.55M  /usr/ports/distfiles
backup/elohim/usr/src                31K   226G    31K  /usr/src
backup/elohim/var                   140K   226G    31K  /mnt/var
backup/elohim/var/audit              31K   226G    31K  /var/audit
backup/elohim/var/log                46K   226G    46K  /var/log
backup/elohim/var/tmp                32K   226G    32K  /var/tmp
tank0                              3.55G   143G   144K  legacy
tank0/ROOT                          711M   143G   144K  legacy
tank0/ROOT/default                  711M   143G   697M  /mnt
tank0/ROOT/freshconf                  8K   143G   697M  /mnt
tank0/swap                         2.06G   145G    72K  -
tank0/tmp                           176K   143G   176K  /tmp
tank0/usr                           812M   143G   144K  /mnt/usr
tank0/usr/home                      300K   143G   204K  /usr/home
tank0/usr/jails                     144K   143G   144K  /usr/jails
tank0/usr/obj                       144K   143G   144K  /usr/obj
tank0/usr/ports                     811M   143G   810M  /usr/ports
tank0/usr/ports/distfiles          1.66M   143G  1.66M  /usr/ports/distfiles
tank0/usr/src                       144K   143G   144K  /usr/src
tank0/var                           720K   143G   144K  /mnt/var
tank0/var/audit                     144K   143G   144K  /var/audit
tank0/var/log                       280K   143G   196K  /var/log
tank0/var/tmp                       152K   143G   152K  /var/tmp
```

I was expecting for a mountpoint something like for example backup/elohim/usr/home and not /usr/home. Am i doing something wrong? What is the correct way to send receive snapshots between two zpools in the same system?

Thanks


----------



## kpa (Jun 14, 2013)

Import the receiving pool with the -R option of zpool(8).

`zpool import -R /mnt backup`

Now all paths of the backup pool will be rooted at /mnt.


----------



## blazingice (Jun 16, 2013)

kpa said:
			
		

> `zpool import -R /mnt backup`
> 
> Now all paths of the backup pool will be rooted at /mnt.



I get this error:


```
cannot import 'backup': a pool with that name is already created/imported,
and no additional pools with that name were found
```


----------



## kpa (Jun 16, 2013)

You can't re-import a pool while it's already in imported state, export it first and then re-import.

`zpool export backup`
`zpool import -R /mnt backup`


----------



## blazingice (Jun 16, 2013)

Thanks that worked. 

I wasn't aware that I needed to use export/import. This is complicating what I thought it would be an easy way to do backups, so few questions to clarify few things:


Do I still need to use -u option? I thought that would take care of not mounting filesystems on the same mountpoints, but it seems that it doesn't do anything.

If later I send|receive incremental snapshots, will the mountpoints revert back to the one that tank0 is using? So, will I need to run export/import on backup every time I send|receive snapshots?

When I need to use backup to restore tank0, will these steps be fine?
`#zfs send -R backup/elohim@install | zfs receive -Fduv tank0`
`#zfs export tank0`
`#zfs import -R / tank0`

Will any of these steps need changing if backup is on a external hard disk that is used as an off site backup?


----------

