Posts:
8
From:
Registered:
5/11/09
|
|
|
|
virsh troubling zfs!?
Posted:
Nov 3, 2009 11:39 AM
To: Communities » zfs » discuss
|
|
Hi and hello,
I have a problem confusing me. I hope someone can help me with it. I followed a "best practise" - I think - using dedicated zfs filesystems for my virtual machines. Commands (for completion): [i]zfs create rpool/vms[/i] [i]zfs create rpool/vms/vm1[/i] [i] zfs create -V 10G rpool/vms/vm1/vm1-dsk[/i]
This command creates the file system [i]/rpool/vms/vm1/vm1-dsk[/i] and the according [i]/dev/zvol/dsk/rpool/vms/vm1/vm1-dsk[/i].
If I delete a VM i set up using this filesystem via[i] virsh undefine vm1[/i] the [i]/rpool/vms/vm1/vm1-dsk[/i] gets also deleted, but the [i]/dev/zvol/dsk/rpool/vms/vm1/vm1-dsk[/i] is left.
Without [i]/rpool/vms/vm1/vm1-dsk[/i] I am not able to do [i]zfs destroy rpool/vms/vm1/vm1-dsk[/i] so the [i]/dev/zvol/dsk/rpool/vms/vm1/vm1-dsk[/i] could not be destroyed "and will be left forever"!?
How can I get rid of this problem?
Oh just forgot
Thanks in advance :-)
Message was edited by: rale_t
|
|
|
Posts:
17
From:
GB
Registered:
3/9/05
|
|
|
|
Re: [zfs-discuss] virsh troubling zfs!?
Posted:
Nov 4, 2009 1:10 AM
in response to: rale_t
|
|
On Tue, Nov 03, 2009 at 11:39:28AM -0800, Ralf Teckelmann wrote: > Hi and hello, > > I have a problem confusing me. I hope someone can help me with it. > I followed a "best practise" - I think - using dedicated zfs filesystems for my virtual machines. > Commands (for completion): > [i]zfs create rpool/vms[/i] > [i]zfs create rpool/vms/vm1[/i] > [i] zfs create -V 10G rpool/vms/vm1/vm1-dsk[/i] > > This command creates the file system [i]/rpool/vms/vm1/vm1-dsk[/i] and the according [i]/dev/zvol/dsk/rpool/vms/vm1/vm1-dsk[/i]. >
(Clarification)
Your commands create two filesystems:
rpool/vms rpool/vms/vm1
You then create a ZFS Volume:
rpool/vms/vm1/vm1-dsk
which results in associated dsk and rdsk devices being created as:
/dev/zvol/dsk/rpool/vms/vm1/vm1-dsk /dev/zvol/rdsk/rpool/vms/vm1/vm1-dsk
These two nodes are artifacts of the zfs volume implementation and are required to allow zfs volumes to emulate traditional disk devices. They will appear and disappear accordingly as zfs volumes are created and destroyed.
> If I delete a VM i set up using this filesystem via[i] virsh undefine vm1[/i] the [i]/rpool/vms/vm1/vm1-dsk[/i] gets also deleted, but the [i]/dev/zvol/dsk/rpool/vms/vm1/vm1-dsk[/i] is left. >
virsh undefine does not delete filesystems, disks or any other kind of backing storage. In order to delete the three things you created, you need to issue:
zfs destroy rpool/vms/vm1/vm1-dsk zfs destroy rpool/vms/vm1 zfs destroy rpool/vms
or (more simply) you can do it recursively, if there's nothing else to be affected:
zfs destroy -r rpool/vms
Obviously you need to be careful with recursive destruction that no other filesystems/volumes are affected.
> Without [i]/rpool/vms/vm1/vm1-dsk[/i] I am not able to do [i]zfs destroy rpool/vms/vm1/vm1-dsk[/i] so the [i]/dev/zvol/dsk/rpool/vms/vm1/vm1-dsk[/i] could not be destroyed "and will be left forever"!? > > How can I get rid of this problem?
You don't have a problem. When the zfs volume is destroyed (as I describe above), then the associated devices are also removed.
> -- > This message posted from opensolaris.org > _______________________________________________ > zfs-discuss mailing list > zfs-discuss at opensolaris dot org > http://mail.opensolaris.org/mailman/listinfo/zfs-discuss
Hope that helps.
Gary -- Gary Pennington Solaris Core OS Sun Microsystems Gary dot Pennington at sun dot com _______________________________________________ zfs-discuss mailing list zfs-discuss at opensolaris dot org http://mail.opensolaris.org/mailman/listinfo/zfs-discuss
|
|
|
|
Posts:
8
From:
Registered:
5/11/09
|
|
|
|
Re: [zfs-discuss] virsh troubling zfs!?
Posted:
Nov 5, 2009 10:37 AM
in response to: garypen
To: Communities » zfs » discuss
|
|
Good Evening,
Thanks for your fast reply Gary. I believe you are right but something is messed up with my system. I tested the way i thought my problem was created but can't rebuild it in that way.
All I have is:
1) The list of my file systems: rtm@katecholamin:~$ zfs list NAME USED AVAIL REFER MOUNTPOINT rpool 11.7G 673G 82K /rpool rpool/ROOT 3.31G 673G 19K legacy rpool/ROOT/opensolaris 218M 673G 3.11G / rpool/ROOT/opensolaris-1 3.09G 673G 2.93G / rpool/dump 2.00G 673G 2.00G - rpool/export 4.43G 673G 21K /export rpool/export/home 4.43G 673G 21K /export/home rpool/export/home/rtm 4.43G 673G 4.43G /export/home/rtm rpool/swap 2.00G 675G 101M - spool 114G 2.57T 38.3K /spool spool/audio 67.3G 2.57T 67.3G /spool/audio spool/backup 30.4K 2.57T 30.4K /spool/backup spool/other 4.42G 2.57T 4.42G /spool/other spool/software 15.6G 2.57T 15.6G /spool/software spool/video 27.1G 2.57T 27.1G /spool/video
2) The vms/ device in /dev/zvol/dsk/rpool/ after I destroyed it via zfs destroy -r rpool/vms rtm@katecholamin:~$ ls /dev/zvol/dsk/rpool/ dump swap vms/
3) The 2 devices according to the "sub"-filesystems i destroyed via zfs destroy rpool/vms/hellcat and zfs destroy rpool/vms/viking before i destroyed rpool/vms/ rtm@katecholamin:~$ ls /dev/zvol/dsk/rpool/vms/ hellcat/ viking/
4) The devices for the filesystems for the virtual machines i never had destroyed because they were gone some day some way (possibly in coherence with the "undefine" of the vms as I thought but couldn't readjust) rtm@katecholamin:~$ ls /dev/zvol/dsk/rpool/vms/hellcat/ hell-hvm rtm@katecholamin:~$ ls /dev/zvol/dsk/rpool/vms/viking/ viking-hvm viking-xvda
So 2) and 3) are possibly only there because they are needed for the path to the devices of 4). I destroyed the filesystems rpool/vms/hellcat, rpool/vms/viking and at last /rpool/vms (addional with -r).
How can I remove these 3 (with the devs of /dev/zvol/rdsk/.. 6) devices without according filesystem?
Message was edited by: rale_t
Message was edited by: rale_t
|
|
|
|
Posts:
17
From:
GB
Registered:
3/9/05
|
|
|
|
Re: [zfs-discuss] virsh troubling zfs!?
Posted:
Nov 6, 2009 7:44 AM
in response to: rale_t
|
|
On Thu, Nov 05, 2009 at 10:37:28AM -0800, Ralf Teckelmann wrote: > Good Evening, > > Thanks for your fast reply Gary. I think I didn't get the point in the right way so heres the second try :-) > > > On Tue, Nov 03, 2009 at 11:39:28AM -0800, Ralf > > Teckelmann wrote: > > > Hi and hello, > > > > > > I have a problem confusing me. I hope someone can > > help me with it. > > > I followed a "best practise" - I think - using > > dedicated zfs filesystems for my virtual machines. > > > Commands (for completion): > > > [i]zfs create rpool/vms[/i] > > > [i]zfs create rpool/vms/vm1[/i] > > > [i] zfs create -V 10G rpool/vms/vm1/vm1-dsk[/i] > > > > > > This command creates the file system > > [i]/rpool/vms/vm1/vm1-dsk[/i] and the according > > [i]/dev/zvol/dsk/rpool/vms/vm1/vm1-dsk[/i]. > > > > > > > (Clarification) > > > > Your commands create two filesystems: > > > > rpool/vms > > rpool/vms/vm1 > > > > You then create a ZFS Volume: > > > > rpool/vms/vm1/vm1-dsk > > > > which results in associated dsk and rdsk devices > > being created as: > > > > /dev/zvol/dsk/rpool/vms/vm1/vm1-dsk > > /dev/zvol/rdsk/rpool/vms/vm1/vm1-dsk > > > > These two nodes are artifacts of the zfs volume > > implementation and are required > > to allow zfs volumes to emulate traditional disk > > devices. They will appear > > and disappear accordingly as zfs volumes are created > > and destroyed. > > > Thanks for this information. > > > > If I delete a VM i set up using this filesystem > > via[i] virsh undefine vm1[/i] the > > [i]/rpool/vms/vm1/vm1-dsk[/i] gets also deleted, but > > the [i]/dev/zvol/dsk/rpool/vms/vm1/vm1-dsk[/i] is > > left. > > > > > > > virsh undefine does not delete filesystems, disks or > > any other kind of > > backing storage. In order to delete the three things > > you created, you need > > to issue: > > > > zfs destroy rpool/vms/vm1/vm1-dsk > > zfs destroy rpool/vms/vm1 > > zfs destroy rpool/vms > > So here comes the second try: > > If I remove a VM with "virsh undefine vm1" the directory /rpool/vms/vm1/ representing the filesystem above the filesystem /rpool/vms/vm1/vm1-dsk is removed and the path /rpool/vms/vm1/vm1-dsk isn't existing anymore. So I can't do "zfs destroy rpool/vms/vm1/vm1-dsk" nore "zfs destroy rpool/vms/vm1".
"virsh undefine vm1" doesn't remove any of the backing storage associated with the guest. It removes the definition of the guest, but definitely not the backing storage. So, /rpool/vms/vm1/vm-dsk must still exist. Have you checked that it is being removed? If it is being removed, then something else is removing it, not virsh.
You can prove this to yourself. Do the following:
Run the zfs list command to list all zfs datasets
e.g.: zfs list
This should contain the filesystem you are interested in.
Now run undefine:
e.g.: virsh undefine vm1
Now run zfs list again:
e.g.: zfs list
You will see that your filesystem is still present and you will be able to destroy it using zfs destroy.
> Considering virsh does not remove filesystems the filesystem "/rpool/vms/vm1/vm1-dsk" must be there anyway as well as the path does not exist anymore. And the fact that the 2 nodes you described above is a argument furthermore, but I don't have a path. > > Am I completly messing around? I am new in Opensolaris and zfs and quite confused. I hope I am not too confusing for you. >
I think there is some confusion, but hopefully it is clear that the virsh command doesn't remove storage.
Gary
> > > > or (more simply) you can do it recursively, if > > there's nothing else to be > > affected: > > > > zfs destroy -r rpool/vms > > > > Obviously you need to be careful with recursive > > destruction that no other > > filesystems/volumes are affected. > > > > > Without [i]/rpool/vms/vm1/vm1-dsk[/i] I am not able > > to do [i]zfs destroy rpool/vms/vm1/vm1-dsk[/i] so the > > [i]/dev/zvol/dsk/rpool/vms/vm1/vm1-dsk[/i] could not > > be destroyed "and will be left forever"!? > > > > > > How can I get rid of this problem? > > > > You don't have a problem. When the zfs volume is > > destroyed (as I describe > > above), then the associated devices are also removed. > > > As i thought, great. > > > -- > > > This message posted from opensolaris.org > > > _______________________________________________ > > > zfs-discuss mailing list > > > zfs-discuss at opensolaris dot org > > > > > http://mail.opensolaris.org/mailman/listinfo/zfs-discu > > ss > > > > Hope that helps. > > > > Gary > > -- > > Gary Pennington > > Solaris Core OS > > Sun Microsystems > > Gary dot Pennington at sun dot com > > _______________________________________________ > > zfs-discuss mailing list > > zfs-discuss at opensolaris dot org > > http://mail.opensolaris.org/mailman/listinfo/zfs-discu > > ss > -- > This message posted from opensolaris.org > _______________________________________________ > zfs-discuss mailing list > zfs-discuss at opensolaris dot org > http://mail.opensolaris.org/mailman/listinfo/zfs-discuss
-- Gary Pennington Solaris Core OS Sun Microsystems Gary dot Pennington at sun dot com _______________________________________________ zfs-discuss mailing list zfs-discuss at opensolaris dot org http://mail.opensolaris.org/mailman/listinfo/zfs-discuss
|
|
|
|
|