How do I delete the /usr/ports when it says device busy

Hi

Currently I am using FreeBSD 12.2.
I wanted to delete the /usr/ports and download the svnweb subversion.
How do I go about doing that???
Please help.
Thank you.
 
Maybe you have some other session logging in that's in that directory?

Also note, with a ZFS install, /usr/ports is a separate filesystem, which means you can't rm -rf /usr/ports itself, only its contents. You would need to use zfs destroy to actually remove the /usr/ports/ directory itself. Not needed if you just want to checkout a new ports tree. Just remove its contents, not the directory itself.
 
What is the output of df -h and mount -p commands?
Code:
$ sudo df -h
Filesystem            Size    Used   Avail Capacity  Mounted on                                     
zroot/ROOT/default    113G    3.6G    109G     3%    /                                              
devfs                 1.0K    1.0K      0B   100%    /dev                                           
procfs                4.0K    4.0K      0B   100%    /proc                                          
zroot/var/tmp         109G    104K    109G     0%    /var/tmp                                       
zroot/usr/home        109G     41M    109G     0%    /usr/home                                      
zroot/var/log         109G    464K    109G     0%    /var/log                                       
zroot/tmp             109G    112K    109G     0%    /tmp                                           
zroot/var/crash       109G     96K    109G     0%    /var/crash                                     
zroot                 109G     96K    109G     0%    /zroot                                         
zroot/usr/src         110G    727M    109G     1%    /usr/src                                       
zroot/var/audit       109G     96K    109G     0%    /var/audit                                     
zroot/var/mail        109G    120K    109G     0%    /var/mail                                      
zroot/usr/ports       110G    716M    109G     1%    /usr/ports   

$ sudo mount -p
zroot/ROOT/default      /                       zfs     rw,noatime,nfsv4acls    0 0
devfs                   /dev                    devfs   rw              0 0
procfs                  /proc                   procfs  rw              0 0
zroot/var/tmp           /var/tmp                zfs     rw,nosuid,noatime,nfsv4acls     0 0
zroot/usr/home          /usr/home               zfs     rw,noatime,nfsv4acls    0 0
zroot/var/log           /var/log                zfs     rw,noexec,nosuid,noatime,nfsv4acls      0 0
zroot/tmp               /tmp                    zfs     rw,nosuid,noatime,nfsv4acls     0 0
zroot/var/crash         /var/crash              zfs     rw,noexec,nosuid,noatime,nfsv4acls      0 0
zroot                   /zroot                  zfs     rw,noatime,nfsv4acls    0 0
zroot/usr/src           /usr/src                zfs     rw,noatime,nfsv4acls    0 0
zroot/var/audit         /var/audit              zfs     rw,noexec,nosuid,noatime,nfsv4acls      0 0
zroot/var/mail          /var/mail               zfs     rw,nfsv4acls    0 0
zroot/usr/ports         /usr/ports              zfs     rw,nosuid,noatime,nfsv4acls     0 0
 
Maybe you have some other session logging in that's in that directory?

Also note, with a ZFS install, /usr/ports is a separate filesystem, which means you can't rm -rf /usr/ports itself, only its contents. You would need to use zfs destroy to actually remove the /usr/ports/ directory itself. Not needed if you just want to checkout a new ports tree. Just remove its contents, not the directory itself.
Oh no wonder I cannot use the rm -rf /usr/ports command on my zfs.

So how do i zfs destroy, /usr/ports???
 
Hi

Currently I am using FreeBSD 12.2.
I wanted to delete the /usr/ports and download the svnweb subversion.
How do I go about doing that???
Please help.
Thank you.
The /usr/ports is a ZFS dataset.

After you do rm -rf /usr/ports command you HAVE a clean /usr/ports directory, but you can not delete that directory because its ZFS dataset. Do delete ZFS dataset you will have to use zfs destroy zroot/usr/ports command, but as you are saying that you want to fetch a fresh copy of Ports then you only need this:

Code:
# rm -rf /usr/ports
# portsnap auto

Regards.
 
That's just a different shell that happens to be in /usr/ports. Even if he exits that shell, he still won't be able to remove /usr/ports itself because it's a separate ZFS filesystem. ZFS isn't going to allow you to remove its mountpoint if the filesystem is mounted.

Just to reiterate, you don't need to remove the directory itself, only its contents. The directory only has to be empty for a subversion checkout to work.
 
Back
Top