# zfs volume after send / receive



## Sylhouette (Nov 24, 2011)

Hello all.
Starting to use zfs more and more, i came acros a little issue i can not resolve.

I use the following command to send my vmware target to a bachkup machine.


```
zfs send sanstore@2011-24-11 | ssh 192.168.1.29 zfs receive -F zpool/sanstore-bck
```
.

This works quite well, and the files and snapshots are on the remote machine.

But on the target, my volume is not recognized as a volume anymore.

On the master so to say.

```
nas01-bw ~ # zfs list -t volume
NAME               USED  AVAIL  REFER  MOUNTPOINT
sanstore/vmtgt01   206G   355G    16K  -
```

But on the receiving side.


```
[root@zfsguru /zpool/sanstore-bck]# zfs list -t volume
NAME                 USED  AVAIL  REFER  MOUNTPOINT
zpool/zfsguru/SWAP  2.06G   129G    16K  -
```
As you see, the volume is not visable.

the files and snapshots are all the same on both sides.

```
nas01-bw ~ # zfs list
NAME               USED  AVAIL  REFER  MOUNTPOINT
sanstore           309G   148G  82.1G  /sanstore
sanstore/vmtgt01   206G   355G    16K  -
nas01-bw ~ # cd /sanstore/
nas01-bw sanstore # ls -al
total 86112569
drwxr-xr-x   2 root  wheel             3 Nov  8 14:46 .
drwxr-xr-x  19 root  wheel          1024 Nov  8 14:26 ..
-rw-r--r--   1 root  wheel  214748364800 Nov 24 13:20 vmtgt01
```


```
[root@zfsguru /zpool/sanstore-bck]# zfs list
NAME                        USED  AVAIL  REFER  MOUNTPOINT
zpool                       102G   127G    33K  /zpool
[B]zpool/sanstore-bck         98.9G   127G  82.1G  /zpool/sanstore-bck[/B]
zpool/zfsguru              2.67G   127G    21K  /zpool/zfsguru
zpool/zfsguru/9.0-002       621M   127G  76.5M  legacy
zpool/zfsguru/9.0-002/usr   541M   127G   541M  legacy
zpool/zfsguru/9.0-002/var  3.70M   127G  3.70M  legacy
zpool/zfsguru/SWAP         2.06G   129G    16K  -


[root@zfsguru /zpool/sanstore-bck]# ls -al
total 86045977
drwxr-xr-x  2 root  wheel             3 Nov  8 13:46 ./
drwxr-xr-x  4 nfs   nfs               4 Nov 17 14:14 ../
-rw-r--r--  1 root  wheel  214748364800 Nov 24 08:17 vmtgt01
[root@zfsguru /zpool/sanstore-bck]#
```


Do i need one more command to tell the sending side that i am transfering a volume, or the receiving side for that matter.
Or can i promote the file to a volume.

regards
Johan


----------



## gkontos (Nov 24, 2011)

I didn't understand what exactly you want to do but if you might want to use the -R switch during send operation. 


```
-R
               Generate a replication stream package, which will replicate the
               specified  filesystem,  and  all descendent file systems, up to
               the named snapshot. When received, all  properties,  snapshots,
               descendent file systems, and clones are preserved.
```

It should preserve the VOLUME property.

You can also get an idea on how to transfer a complete pool here.

George


----------



## Sylhouette (Nov 24, 2011)

Well what i mean is that everything works like expected.
Only on the receiving side, the Volume is not a Volume, just a file.
So with *zfs list -t volume* it does not show my volume.

I will test the -R option.

regards
Johan


----------



## Sylhouette (Nov 25, 2011)

Ok i am probably doing something wrong, but i can not get my zvol to the other machine.
I did start all over.

I have a master so to say, and a bacup server.
On the master the pool is named storage, on the backup machine the pool is called tank.

on the master i did the following.


```
# zfs create -V10G storage/iscsitest
```
if i do a zfs list -t volume, i see that the volume is there.

```
# zfs list -t volume
NAME                       USED  AVAIL  REFER  MOUNTPOINT
storage/iscsitest         10.3G  65.9G    16K  -
```
If i go to the directory /storage and do a ls -al
i see my zvol file.

```
# ls -al
total 1901416
drwxr-xr-x   4 root  wheel            5 Nov 25 17:44 .
drwxr-xr-x  19 root  wheel         1024 Nov 25 11:33 ..
-rw-r--r--   1 root  wheel  10737418240 Nov 25 20:46 iscsitest
```

Ok all is fine, i can create a scsi target pointing to storage/iscsitest, and it works, and i use a esxi host to mount it.
Works great.

Now i want to make a backup of that zvol so i can create a kind of cold standby server.

So on the master i create a snapshot of my zvol.

```
#zfs snapshot storage/iscsitest@snap1
```
Check with zfs list -t snapshot to see if i have a snapshot.

```
#zfs list -t snapshot 
NAME                      USED  AVAIL  REFER  MOUNTPOINT
storage/iscsitest@snap1      0      -    16K  -
```
Well there it is.

now i want to send that zvol to my backup server.
So the following command should do it.

```
# zfs send -R storage/iscsitest@snap1 | ssh root@192.168.50.200 zfs recv -v tank/iscsitest
Password:
receiving full stream of storage/iscsitest@snap1 into tank/iscsitest@snap1
received 3.85KB stream in 1 seconds (3.85KB/sec)
```

on my backup server, i now have the following

```
#zfs list
NAME             USED  AVAIL  REFER  MOUNTPOINT
tank             159G   427G    31K  /tank
tank/iscsitest  10.3G   438G    16K  -
tank/share       149G   427G   136G  /mnt
```

Ok that looks fine, lets see if i have some snapshots here.

```
#zfs list -t snapshot
NAME                    USED  AVAIL  REFER  MOUNTPOINT
tank/iscsitest@snap1       0      -    16K  -
```
Ok that looks good.
Let see if there is a volume

```
# zfs list -t volume
NAME             USED  AVAIL  REFER  MOUNTPOINT
tank/iscsitest  10.3G   438G    16K  -
```

Well all looks good, now lets look at the file so i can share this over iscsi.

```
cd /tank
#ls -al
total 4
drwxr-xr-x   2 root  wheel    2 Nov 25 21:45 ./
drwxr-xr-x  22 root  wheel  512 Nov 25 21:54 ../
```

Where is my file???
I am trying to get this done the whole day now, and i can not get it to work!!
i did do a export / import, but no file!

Also a local backup does not work.

```
# zfs send -R storage/iscsitest@snap1 | zfs recv -v storage/iscsitest-bck
receiving full stream of storage/iscsitest@snap1 into storage/iscsitest-bck@snap1
received 3.85KB stream in 1 seconds (3.85KB/sec)

# zfs list
NAME                       USED  AVAIL  REFER  MOUNTPOINT
storage                    411G  45.3G  1.81G  /storage
storage/iscsitest         10.3G  55.6G    16K  -
storage/iscsitest-bck     10.3G  55.6G    16K  -

# zfs list -t volume
NAME                       USED  AVAIL  REFER  MOUNTPOINT
storage/iscsitest         10.3G  55.6G    16K  -
storage/iscsitest-bck     10.3G  55.6G    16K  -

# zfs list
NAME                       USED  AVAIL  REFER  MOUNTPOINT
storage/iscsitest         10.3G  55.6G    16K  -
storage/iscsitest-bck     10.3G  55.6G    16K  -

# ls -al
total 1901416
drwxr-xr-x   4 root  wheel            5 Nov 25 17:44 .
drwxr-xr-x  19 root  wheel         1024 Nov 25 11:33 ..
-rw-r--r--   1 root  wheel  10737418240 Nov 25 20:46 iscsitest
```
So again no file iscsitest-bck


What am i missing.!

This is on FreeBSD 9.0 RC2 AMD64

regards
Johan


----------



## Sylhouette (Nov 26, 2011)

Solved, i used the wrong path in my /usr/local/etc/istgt.conf file.

So istgt creates a file, and i was not using a zvol at all.

regards
Johan


----------

