mounting/exporting/importing a zfs volume

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

mounting/exporting/importing a zfs volume

Victor Sudakov-3
Dear Colleagues,

vm-bhyve keeps virtual machines on zfs volumes with volmode=dev. How can
I access/mount the filesystems within the volume when the virtual host
is offline?

If I kept virtual disks in raw files, I could access them as devices
with mdconfig. But:

root@newserv:~ # mdconfig -a -f /dev/zvol/zroot/vm/mail/disk0
mdconfig: /dev/zvol/zroot/vm/mail/disk0 is not a regular file
root@newserv:~ #

Also, how can I exchange those zfs volumes for use with other
hypervisors? They are not real raw disk files so I cannot use
sysutils/vmdktool etc.

--
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/

signature.asc (465 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: mounting/exporting/importing a zfs volume

freebsd-virtualization mailing list
mdconfig -a -t vnode -f <path> afaik

once they are mounted you could dd them over to the zvols and then resize
them from within the vm

On Mon, 11 Feb 2019 at 17:04, Victor Sudakov <[hidden email]> wrote:

> Dear Colleagues,
>
> vm-bhyve keeps virtual machines on zfs volumes with volmode=dev. How can
> I access/mount the filesystems within the volume when the virtual host
> is offline?
>
> If I kept virtual disks in raw files, I could access them as devices
> with mdconfig. But:
>
> root@newserv:~ # mdconfig -a -f /dev/zvol/zroot/vm/mail/disk0
> mdconfig: /dev/zvol/zroot/vm/mail/disk0 is not a regular file
> root@newserv:~ #
>
> Also, how can I exchange those zfs volumes for use with other
> hypervisors? They are not real raw disk files so I cannot use
> sysutils/vmdktool etc.
>
> --
> Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
> 2:5005/49@fidonet http://vas.tomsk.ru/
>
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: mounting/exporting/importing a zfs volume

Frank Leonhardt
In reply to this post by Victor Sudakov-3
On 11/02/2019 17:03, Victor Sudakov wrote:

> Dear Colleagues,
>
> vm-bhyve keeps virtual machines on zfs volumes with volmode=dev. How can
> I access/mount the filesystems within the volume when the virtual host
> is offline?
>
> If I kept virtual disks in raw files, I could access them as devices
> with mdconfig. But:
>
> root@newserv:~ # mdconfig -a -f /dev/zvol/zroot/vm/mail/disk0
> mdconfig: /dev/zvol/zroot/vm/mail/disk0 is not a regular file
> root@newserv:~ #
>
> Also, how can I exchange those zfs volumes for use with other
> hypervisors? They are not real raw disk files so I cannot use
> sysutils/vmdktool etc.
>
I don't know this, but I'll guess(!)

If you've set volmode to dev then you get a cdev device in devfs, and
you'll never get it to mount. Try using geom instead (which IIRC is the
default).

HOWEVER, I suspect you're doing this because you're hoping that a ZFS
volume is faster than a file.  I went through this, in the hope it
wouldn't do CoW and would therefore be a lot better for databases. I was
disappointed! Bascially, it's no better than a ZFS file. If that was
your plan, use a UFS partition. I don't use ZFS volumes any more; I
think they're more useful on Solaris. A md mapped on to a ZFS file seems
to be the BSD way, and for VMs just use a file in its own dataset. You
can then clone the dataset. Just what you need for nearly identical VMs.

Regards, Frank.


_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: mounting/exporting/importing a zfs volume

Victor Sudakov-3
In reply to this post by freebsd-virtualization mailing list
Paul Webster wrote:
> mdconfig -a -t vnode -f <path> afaik

Sorry, this does not work.

root@newserv:~ # mdconfig -a -t vnode /dev/zvol/zroot/vm/mail/disk0
mdconfig: /dev/zvol/zroot/vm/mail/disk0 is not a regular file

There must be some other way.

> once they are mounted you could dd them

Indeed, I can dd the volume to a regular file:

dd if=/dev/zvol/zroot/vm/mail/disk0 of=/var/tmp/rawimage bs=1m conv=sparse

and then work with the /var/tmp/rawimage (I can mdconfig it) but it's a waste
of disk space.


--
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/

signature.asc (465 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: mounting/exporting/importing a zfs volume

Victor Sudakov-3
In reply to this post by Frank Leonhardt
Frank Leonhardt wrote:

> >
> > vm-bhyve keeps virtual machines on zfs volumes with volmode=dev. How can
> > I access/mount the filesystems within the volume when the virtual host
> > is offline?
> >
> > If I kept virtual disks in raw files, I could access them as devices
> > with mdconfig. But:
> >
> > root@newserv:~ # mdconfig -a -f /dev/zvol/zroot/vm/mail/disk0
> > mdconfig: /dev/zvol/zroot/vm/mail/disk0 is not a regular file
> > root@newserv:~ #
> >
> > Also, how can I exchange those zfs volumes for use with other
> > hypervisors? They are not real raw disk files so I cannot use
> > sysutils/vmdktool etc.
> >
> I don't know this, but I'll guess(!)
>
> If you've set volmode to dev then you get a cdev device in devfs, and
> you'll never get it to mount. Try using geom instead (which IIRC is the
> default).
The default in vm-bhyve is volmode=dev, and I think this is reasonable.
Do you know if I can clone an existing volmode=dev volume into a
volmode=geom volume and then work with the clone?

>
> HOWEVER, I suspect you're doing this because you're hoping that a ZFS
> volume is faster than a file. 

Well, not actually.

> I went through this, in the hope it wouldn't do CoW and would
> therefore be a lot better for databases. I was disappointed!
> Bascially, it's no better than a ZFS file. If that was your plan, use
> a UFS partition.

A UFS partition? Where?

> I don't use ZFS volumes any more; I
> think they're more useful on Solaris. A md mapped on to a ZFS file seems
> to be the BSD way, and for VMs just use a file in its own dataset. You
> can then clone the dataset. Just what you need for nearly identical VMs.

I've preferred disk0_dev="zvol" VMs for aesthetical reasons since
vm-bhyve started supporting them. Those file-based VMs get in the way
while backing up $vm_dir, and their disks are not visible in
"zfs list -t volume"

--
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/

signature.asc (465 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: mounting/exporting/importing a zfs volume

Paul Vixie-2


Victor Sudakov wrote on 2019-02-11 17:46:
...
> I've preferred disk0_dev="zvol" VMs for aesthetical reasons since
> vm-bhyve started supporting them. Those file-based VMs get in the way
> while backing up $vm_dir, and their disks are not visible in
> "zfs list -t volume"

+1.

--
P Vixie

_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to "[hidden email]"