Solved Deleting ZFS datasets

Fbsdnew

Member

Reaction score: 4
Messages: 87

I set up a couple of jails and ports trees with iocage and pot and poudriere, which all use zfs. I'm done using these jails and have unmounted and deleted them from the /usr/local/poudriere .etc but in the output of zfs list there are still a great number of datasets beginning in zroot that are poudriere, pot and iocage. I have tried zpool delete and zfs destroy. still, I cannot cleanup this zfs filesystem. How do I delete some of these datasets?
Code:
[root@machine17 ~]# zfs list
NAME                                                      USED  AVAIL  REFER  MOUNTPOINT
zroot                                                    26.8G   194G    88K  /zroot
zroot/ROOT                                               14.1G   194G    88K  none
zroot/ROOT/default                                       14.1G   194G  14.1G  /
zroot/iocage                                             1.75G   194G   104K  /zroot/iocage
zroot/iocage/download                                     371M   194G    88K  /zroot/iocage/download
zroot/iocage/download/12.1-RELEASE                        371M   194G   371M  /zroot/iocage/download/12.1-RELEASE
zroot/iocage/images                                        88K   194G    88K  /zroot/iocage/images
zroot/iocage/jails                                         88K   194G    88K  /zroot/iocage/jails
zroot/iocage/log                                           88K   194G    88K  /zroot/iocage/log
zroot/iocage/releases                                    1.39G   194G    88K  /zroot/iocage/releases
zroot/iocage/releases/12.1-RELEASE                       1.39G   194G    88K  /zroot/iocage/releases/12.1-RELEASE
zroot/iocage/releases/12.1-RELEASE/root                  1.39G   194G  1.39G  /zroot/iocage/releases/12.1-RELEASE/root
zroot/iocage/templates                                     88K   194G    88K  /zroot/iocage/templates
zroot/pot                                                 403M   194G    88K  /opt/pot
zroot/pot/bases                                           402M   194G    88K  /opt/pot/bases
zroot/pot/bases/12.1                                      402M   194G   398M  /opt/pot/bases/12.1
zroot/pot/bases/12.1/custom                              4.46M   194G  4.46M  /opt/pot/bases/12.1/opt/custom
zroot/pot/bases/12.1/usr.local                             88K   194G    88K  /opt/pot/bases/12.1/usr/local
zroot/pot/cache                                            88K   194G    88K  /var/cache/pot
zroot/pot/fscomp                                           88K   194G    88K  /opt/pot/fscomp
zroot/pot/jails                                           396K   194G    88K  /opt/pot/jails
zroot/pot/jails/aliaspot                                  216K   194G    96K  /opt/pot/jails/aliaspot
zroot/pot/jails/aliaspot/custom                           120K   194G  4.46M  /opt/pot/jails/aliaspot/custom
zroot/pot/jails/aliaspot/usr.local                           0   194G    88K  /opt/pot/jails/aliaspot/usr.local
zroot/pot/jails/base-12_1                                  92K   194G    92K  /opt/pot/jails/base-12_1
zroot/poudriere                                          4.21G   194G    88K  /zroot/poudriere
zroot/poudriere/data                                     11.1M   194G    96K  /usr/local/poudriere/data
zroot/poudriere/data/.m                                   104K   194G   104K  /usr/local/poudriere/data/.m
zroot/poudriere/data/cache                                288K   194G   288K  /usr/local/poudriere/data/cache
zroot/poudriere/data/images                                88K   194G    88K  /usr/local/poudriere/data/images
zroot/poudriere/data/logs                                1.38M   194G  1.38M  /usr/local/poudriere/data/logs
zroot/poudriere/data/packages                            9.05M   194G  9.05M  /usr/local/poudriere/data/packages
zroot/poudriere/data/wrkdirs                               88K   194G    88K  /usr/local/poudriere/data/wrkdirs
zroot/poudriere/jails                                    4.19G   194G    88K  /zroot/poudriere/jails
zroot/poudriere/jails/121amd64                           1.40G   194G  1.38G  /usr/local/poudriere/jails/121amd64
zroot/poudriere/jails/121amd64-default-ref               1.51M   194G  3.69M  /usr/local/poudriere/data/.m/121amd64-default/ref
zroot/poudriere/jails/121amd64-default-ref/01             256K   194G  3.69M  /usr/local/poudriere/data/.m/121amd64-default/01
zroot/poudriere/jails/121amd64-default-ref/02             256K   194G  3.69M  /usr/local/poudriere/data/.m/121amd64-default/02
zroot/poudriere/jails/121amd64-default-ref/03             256K   194G  3.69M  /usr/local/poudriere/data/.m/121amd64-default/03
zroot/poudriere/jails/121amd64-subversive-devset-ref     81.2M   194G  1.36G  /usr/local/poudriere/data/.m/121amd64-subversive-devset/ref
zroot/poudriere/jails/121amd64-subversive-devset-ref/01      0   194G  1.36G  /usr/local/poudriere/data/.m/121amd64-subversive-devset/01
zroot/poudriere/jails/121amd64-subversive-devset-ref/02  40.9M   194G  1.40G  /usr/local/poudriere/data/.m/121amd64-subversive-devset/02
zroot/poudriere/jails/121amd64-subversive-devset-ref/03  39.7M   194G  1.39G  /usr/local/poudriere/data/.m/121amd64-subversive-devset/03
zroot/poudriere/jails/121pjail                           1.36G   194G  3.69M  /usr/local/poudriere/jails/121pjail
zroot/poudriere/jails/121pjail-local-ref                 1.49M   194G  3.69M  /usr/local/poudriere/data/.m/121pjail-local/ref
zroot/poudriere/jails/121pjail-local-ref/01               256K   194G  3.69M  /usr/local/poudriere/data/.m/121pjail-local/01
zroot/poudriere/jails/121pjail-local-ref/02               256K   194G  3.69M  /usr/local/poudriere/data/.m/121pjail-local/02
zroot/poudriere/jails/121pjail-local-ref/03               256K   194G  3.69M  /usr/local/poudriere/data/.m/121pjail-local/03
zroot/poudriere/jails/12pjail                            1.36G   194G  3.69M  /usr/local/poudriere/jails/12pjail
zroot/poudriere/jails/12pjail-local-ref                  1.48M   194G  3.69M  /usr/local/poudriere/data/.m/12pjail-local/ref
zroot/poudriere/jails/12pjail-local-ref/01                256K   194G  3.69M  /usr/local/poudriere/data/.m/12pjail-local/01
zroot/poudriere/jails/12pjail-local-ref/02                256K   194G  3.69M  /usr/local/poudriere/data/.m/12pjail-local/02
zroot/poudriere/jails/12pjail-local-ref/03                256K   194G  3.69M  /usr/local/poudriere/data/.m/12pjail-local/03
zroot/poudriere/jails/12pjail-subversive-ref             1.48M   194G  3.69M  /usr/local/poudriere/data/.m/12pjail-subversive/ref
zroot/poudriere/jails/12pjail-subversive-ref/01           256K   194G  3.69M  /usr/local/poudriere/data/.m/12pjail-subversive/01
zroot/poudriere/jails/12pjail-subversive-ref/02           256K   194G  3.69M  /usr/local/poudriere/data/.m/12pjail-subversive/02
zroot/poudriere/jails/12pjail-subversive-ref/03           256K   194G  3.69M  /usr/local/poudriere/data/.m/12pjail-subversive/03
zroot/poudriere/ports                                      88K   194G    88K  /zroot/poudriere/ports
zroot/tmp                                                 148K   194G   148K  /tmp
zroot/usr                                                6.09G   194G    88K  /usr
zroot/usr/home                                           2.21G   194G  2.21G  /usr/home
zroot/usr/ports                                          2.52G   194G  2.52G  /usr/ports
zroot/usr/src                                            1.36G   194G  1.36G  /usr/src
zroot/var                                                1.75M   194G    88K  /var
zroot/var/audit                                           368K   194G   368K  /var/audit
zroot/var/crash                                            88K   194G    88K  /var/crash
zroot/var/log                                               1M   194G     1M  /var/log
zroot/var/mail                                            120K   194G   120K  /var/mail
zroot/var/tmp                                             104K   194G   104K  /var/tmp
zroot/vms                                                 154M   194G   154M  /zroot/vms
zroot/vms/guest                                           104K   194G   104K  /zroot/vms/guest
 

mjollnir

Aspiring Daemon

Reaction score: 323
Messages: 732

zfs destroy -r -n zroot/iocage You can use -R to recursively destroy descendant datasets. Also watch for any snapshots you took. Always test with the -n (dry-run, do nothing) parameter 1st!
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 9,119
Messages: 33,688

Make sure there aren't still some processes running that are using those filesystems. Then ummount them in the right order to make sure nothing's used any more. Then you can remove them.
 

mjollnir

Aspiring Daemon

Reaction score: 323
Messages: 732

If these tools can create ZFS datasets, they can destroy them, too. So it might have been the safer & sounder method to not edit their config files, but let them delete the jails/datasets & remove from their config. Now it's too late, you must do it manually. EDIT E.g. pot destroy pot prune pot purge-snapshots pot de-init. The last one you might still want to do.
 
OP
F

Fbsdnew

Member

Reaction score: 4
Messages: 87

Make sure there aren't still some processes running that are using those filesystems. Then ummount them in the right order to make sure nothing's used any more. Then you can remove them.
What about poudriere? I can't delete those poudriere data sets with "zfs destroy -r - n" nor can I unmount them and run "rm-rf" they're still showing up in zfs list
 

mjollnir

Aspiring Daemon

Reaction score: 323
Messages: 732

Post the error message, please. Either some program is still accessing these, or you must do with -R parameter. zfs destroy -R -f -n zpool/poudriere if you're shure you're not going to use poudriere(8) anymore, and you copied all data out of the jails that you might want to keep.
 
OP
F

Fbsdnew

Member

Reaction score: 4
Messages: 87

Post the error message, please. Either some program is still accessing these, or you must do with -R parameter. zfs destroy -R -f -n zpool/poudriere if you're shure you're not going to use poudriere(8) anymore, and you copied all data out of the jails that you might want to keep.
I tried that already. it executes to the next line but does not delete the directory. here see...

[root@machine17 ~]# zfs destroy -R -f -n zroot/poudriere
[root@machine17 ~]# zfs list
NAME USED AVAIL REFER MOUNTPOINT
zroot 23.7G 197G 88K /zroot
zroot/ROOT 13.1G 197G 88K none
zroot/ROOT/default 13.1G 197G 13.1G /
zroot/poudriere 4.20G 197G 88K /zroot/poudriere
zroot/poudriere/data 192K 197G 88K /usr/local/poudriere/data
zroot/poudriere/data/.m 104K 197G 104K /usr/local/poudriere/data/.m
zroot/poudriere/jails 4.19G 197G 88K /zroot/poudriere/jails
zroot/poudriere/jails/121amd64 1.40G 197G 1.38G /usr/local/poudriere/jails/121amd64
zroot/poudriere/jails/121amd64-default-ref 1.51M 197G 3.69M /usr/local/poudriere/data/.m/121amd64-default/ref
zroot/poudriere/jails/121amd64-default-ref/01 256K 197G 3.69M /usr/local/poudriere/data/.m/121amd64-default/01
zroot/poudriere/jails/121amd64-default-ref/02 256K 197G 3.69M /usr/local/poudriere/data/.m/121amd64-default/02
zroot/poudriere/jails/121amd64-default-ref/03 256K 197G 3.69M /usr/local/poudriere/data/.m/121amd64-default/03
zroot/poudriere/jails/121amd64-subversive-devset-ref 81.2M 197G 1.36G /usr/local/poudriere/data/.m/121amd64-subversive-devset/ref
zroot/poudriere/jails/121amd64-subversive-devset-ref/01 0 197G 1.36G /usr/local/poudriere/data/.m/121amd64-subversive-devset/01
zroot/poudriere/jails/121amd64-subversive-devset-ref/02 40.9M 197G 1.40G /usr/local/poudriere/data/.m/121amd64-subversive-devset/02
zroot/poudriere/jails/121amd64-subversive-devset-ref/03 39.7M 197G 1.39G /usr/local/poudriere/data/.m/121amd64-subversive-devset/03
zroot/poudriere/jails/121pjail 1.36G 197G 3.69M /usr/local/poudriere/jails/121pjail
zroot/poudriere/jails/121pjail-local-ref 1.49M 197G 3.69M /usr/local/poudriere/data/.m/121pjail-local/ref
zroot/poudriere/jails/121pjail-local-ref/01 256K 197G 3.69M /usr/local/poudriere/data/.m/121pjail-local/01
zroot/poudriere/jails/121pjail-local-ref/02 256K 197G 3.69M /usr/local/poudriere/data/.m/121pjail-local/02
zroot/poudriere/jails/121pjail-local-ref/03 256K 197G 3.69M /usr/local/poudriere/data/.m/121pjail-local/03
zroot/poudriere/jails/12pjail 1.36G 197G 3.69M /usr/local/poudriere/jails/12pjail
zroot/poudriere/jails/12pjail-local-ref 1.48M 197G 3.69M /usr/local/poudriere/data/.m/12pjail-local/ref
zroot/poudriere/jails/12pjail-local-ref/01 256K 197G 3.69M /usr/local/poudriere/data/.m/12pjail-local/01
zroot/poudriere/jails/12pjail-local-ref/02 256K 197G 3.69M /usr/local/poudriere/data/.m/12pjail-local/02
zroot/poudriere/jails/12pjail-local-ref/03 256K 197G 3.69M /usr/local/poudriere/data/.m/12pjail-local/03
zroot/poudriere/jails/12pjail-subversive-ref 1.48M 197G 3.69M /usr/local/poudriere/data/.m/12pjail-subversive/ref
zroot/poudriere/jails/12pjail-subversive-ref/01 256K 197G 3.69M /usr/local/poudriere/data/.m/12pjail-subversive/01
zroot/poudriere/jails/12pjail-subversive-ref/02 256K 197G 3.69M /usr/local/poudriere/data/.m/12pjail-subversive/02
zroot/poudriere/jails/12pjail-subversive-ref/03 256K 197G 3.69M /usr/local/poudriere/data/.m/12pjail-subversive/03
zroot/poudriere/ports 88K 197G 88K /zroot/poudriere/ports
zroot/tmp 176K 197G 176K /tmp
zroot/usr 6.08G 197G 88K /usr
zroot/usr/home 2.21G 197G 2.21G /usr/home
zroot/usr/ports 2.52G 197G 2.52G /usr/ports
zroot/usr/src 1.36G 197G 1.36G /usr/src
zroot/var 1.75M 197G 88K /var
zroot/var/audit 368K 197G 368K /var/audit
zroot/var/crash 88K 197G 88K /var/crash
zroot/var/log 1020K 197G 1020K /var/log
zroot/var/mail 120K 197G 120K /var/mail
zroot/var/tmp 104K 197G 104K /var/tmp
zroot/vms 154M 197G 154M /zroot/vms
zroot/vms/guest
 

mjollnir

Aspiring Daemon

Reaction score: 323
Messages: 732

If it's ok to remove zroot/poudriere and all under it and all descendants, then do w/o the -n parameter.
 
OP
F

Fbsdnew

Member

Reaction score: 4
Messages: 87

If it's ok to remove zroot/poudriere and all under it and all descendants, then do w/o the -n parameter.
[root@machine17 ~]# zfs destroy -R -r zroot/poudriere
cannot unmount '/usr/local/poudriere/data/.m': Device busy
 

Lamia

Aspiring Daemon

Reaction score: 131
Messages: 576

Rún "chflags -R noschg usr/local/poudriere/data/.m"
And then
"rm -rf usr/local/poudriere/data/.m"
 
OP
F

Fbsdnew

Member

Reaction score: 4
Messages: 87

If it's ok to remove zroot/poudriere and all under it and all descendants, then do w/o the -n parameter.
[root@machine17 ~]# zfs destroy -R -r zroot/poudriere
cannot unmount '/usr/local/poudriere/data/.m': Device busy

Rún "chflags -R noschg usr/local/poudriere/data/.m"
And then
"rm -rf usr/local/poudriere/data/.m"
the solution was "umount -f /usr/local/poudriere/data/.m" then "zfs destroy -R -r zroot/poudriere"
I tried your solution and it returned with no such file or directory?
 

mjollnir

Aspiring Daemon

Reaction score: 323
Messages: 732

When we give you some different commands, they all do different things. None might actually do what you want: "I wanna get rid of those ZFS datasets", but be helpful to succeed towards your goal. As long as you do not know what a command does, do not blindy copy & paste it, but first try to understand what it does: e.g. whatis chflags, whatis rm & man zfs. On KDE, you can also view the man pages comfortably in Konqueror, type man:zfs into the adress line, or use the Help system of your GUI. Especially please be aware the -n or --dry-run parameter intentionally does nothing, except telling what would be done w/o it. The same parameter -n might have a different meaning in other commands, though! Sorry I forgot to add the parameter -v for verbose output. When some command actually succeeds to remove the datasets, obviously the next command to remove that very same thing or s/th in it, will fail, right? There were some file flags active, that prevented the deletion of some files.
Please install the docs: pkg install {de,en}-freebsd-doc, replace de with your native tongue, and point your favorite browser to /usr/local/share/doc/freebsd. Then read chapter 3.4. Permissions of the handbook, or online.
 
OP
F

Fbsdnew

Member

Reaction score: 4
Messages: 87

When we give you some different commands, they all do different things. None might actually do what you want: "I wanna get rid of those ZFS datasets", but be helpful to succeed towards your goal. As long as you do not know what a command does, do not blindy copy & paste it, but first try to understand what it does: e.g. whatis chflags, whatis rm & man zfs. On KDE, you can also view the man pages comfortably in Konqueror, type man:zfs into the adress line, or use the Help system of your GUI. Especially please be aware the -n or --dry-run parameter intentionally does nothing, except telling what would be done w/o it. The same parameter -n might have a different meaning in other commands, though! Sorry I forgot to add the parameter -v for verbose output. When some command actually succeeds to remove the datasets, obviously the next command to remove that very same thing or s/th in it, will fail, right? There were some file flags active, that prevented the deletion of some files.
Please install the docs: pkg install {de,en}-freebsd-doc, replace de with your native tongue, and point your favorite browser to /usr/local/share/doc/freebsd. Then read chapter 3.4. Permissions of the handbook, or online.
Okay great point. You're helping me learn tons and I want to keep learning more as efficiently as possible. So I will make notes of what your saying and read all of the docs. I'm reading the developers and porters handbook on top of the main handbook and love it. I'm getting somewhere with it, but I get a little intimidated with the man pages. I'll get more familiar with them before I ask to many more questions(I have tons!) Thanks I'll keep in mind the form in which I get help and utilize that the right way. Investigation instead of blind copying. Btw what is s/th? And what do you mean by my GUI?
 

mjollnir

Aspiring Daemon

Reaction score: 323
Messages: 732

s/th = something. Sorry I'm violating the forum's guidelines, which tells to avoid abbreviations for readability.
A GUI is a Graphical User Interface. You may want to bookmark the Urban Dictionary to look up such terms, or look it up in Wikipedia or just do a DuckDuckGo search..
Do not hesitate to ask, noone can read & get all that huge stuff that make up to understand UNIX, within a month or two. Not even a year.
 
OP
F

Fbsdnew

Member

Reaction score: 4
Messages: 87

s/th = something. Sorry I'm violating the forum's guidelines, which tells to avoid abbreviations for readability.
A GUI is a Graphical User Interface. You may want to bookmark the Urban Dictionary to look up such terms, or look it up in Wikipedia or just do a DuckDuckGo search..
Do not hesitate to ask, noone can read & get all that huge stuff that make up to understand UNIX, within a month or two. Not even a year.
Good I started back in February. Glad to know there's a long road ahead and plenty of freebsd material to keep me busy. I know what graphical user interface is but thought maybe you meant a specific one with those options like emacs and development environment or just browser.
 
Top