Can't delete a jail

Status
Not open for further replies.

sdspieg

Contributor
Joined
Aug 6, 2012
Messages
168
I am having problems deleting a number of old plugin jails that are no longer viewable in the jail list, but that I also cannot remove through rm. If I go into the directories I can use chflags and aftter that I can remove that directory. But there does not seem to be a recursive option for chflags and there are hundreds of directories in that jail. Does anybody have any idea on how to fix this? Thanks.
 

Yatti420

Wizard
Joined
Aug 12, 2012
Messages
1,437

sdspieg

Contributor
Joined
Aug 6, 2012
Messages
168
Yes, since I can't 'see' them anymore (including after multiple reboots), I'm trying through CLI. I'm using 9.2.1, but the jails were created under previous versions (but none over a few months ago at the latest). And it IS a flag issue - as soon as I change the flags (manually), I CAN delete them.
 
D

dlavigne

Guest
It did the last time I needed to recursively use chflags...
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,525

sdspieg

Contributor
Joined
Aug 6, 2012
Messages
168
Ok - so I tried again, in putty this time. And
Code:
chflags -R noschg *
did seem to work. And it also then allowed me to removed all of those directories. But when I go one dir up and try to remove that one I get the following
Code:
[root@freenas] /mnt/StephanNAS/jails# rm -rf plexmediaserver_1
rm: plexmediaserver_1: Device busy

Any ideas on this one?
 

sdspieg

Contributor
Joined
Aug 6, 2012
Messages
168
It really seems as though SOMETHING in the system still thinks that those jails are there. But I don't see them in the gui, and also in the CLI I see
Code:
[root@freenas] /mnt/StephanNAS/jails# jls
  JID  IP Address      Hostname                      Path
    1  -              couchpotato_1                /mnt/StephanNAS/jails/couchpotato_1
    2  -              sabnzbd_1                    /mnt/StephanNAS/jails/sabnzbd_1
    3  -              sickbeard_1                  /mnt/StephanNAS/jails/sickbeard_1
    4  -              transmission_1                /mnt/StephanNAS/jails/transmission_1
    5  -              minidlna_1                    /mnt/StephanNAS/jails/minidlna_1
 

sdspieg

Contributor
Joined
Aug 6, 2012
Messages
168
I just tried renaming that directory
Code:
mv: cannot rename a mount point.
So this does suggest it still thinks it's mounted.
 

sdspieg

Contributor
Joined
Aug 6, 2012
Messages
168
Code:
[root@freenas] /mnt/StephanNAS/jails# mount
/dev/ufs/FreeNASs1a on / (ufs, local, read-only)
devfs on /dev (devfs, local, multilabel)
/dev/md0 on /etc (ufs, local)
/dev/md1 on /mnt (ufs, local)
/dev/md2 on /var (ufs, local)
/dev/ufs/FreeNASs4 on /data (ufs, local, noatime, soft-updates)
StephanNAS on /mnt/StephanNAS (zfs, local, nfsv4acls)
StephanNAS/.samba4 on /mnt/StephanNAS/.samba4 (zfs, local, nfsv4acls)
StephanNAS/Scripts on /mnt/StephanNAS/Scripts (zfs, local, nfsv4acls)
StephanNAS/jails on /mnt/StephanNAS/jails (zfs, local, nfsv4acls)
StephanNAS/jails/.warden-template-9.1-RELEASE-amd64 on /mnt/StephanNAS/jails/.warden-template-9.1-RELEASE-amd64 (zfs, local, nfsv4acls)
StephanNAS/jails/.warden-template-9.1-RELEASE-amd64-pluginjail on /mnt/StephanNAS/jails/.warden-template-9.1-RELEASE-amd64-pluginjail (zfs, local, nfsv4acls)
StephanNAS/jails/.warden-template-pluginjail-9.2-RELEASE-x64 on /mnt/StephanNAS/jails/.warden-template-pluginjail-9.2-RELEASE-x64 (zfs, local, nfsv4acls)
StephanNAS/jails/.warden-template-pluginjail-9.2-RELEASE-x64-20140221173933 on /mnt/StephanNAS/jails/.warden-template-pluginjail-9.2-RELEASE-x64-20140221173933 (zfs, local, nfsv4acls)
StephanNAS/jails/couchpotato_1 on /mnt/StephanNAS/jails/couchpotato_1 (zfs, local, nfsv4acls)
StephanNAS/jails/plex_1 on /mnt/StephanNAS/jails/plex_1 (zfs, local, nfsv4acls)
StephanNAS/jails/plexmediaserver_1 on /mnt/StephanNAS/jails/plexmediaserver_1 (zfs, local, nfsv4acls)

So there we have them. Now I just have to figure out how to UNmount those...
 

sdspieg

Contributor
Joined
Aug 6, 2012
Messages
168
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/mount-unmount.html

And BINGO!
Code:
[root@freenas] /mnt/StephanNAS/jails# umount StephanNAS/jails/plex_1
[root@freenas] /mnt/StephanNAS/jails# umount StephanNAS/jails/plexmediaserver_1


And after having done that, I could easily remove the dirs.

SO summing up - if anybody ever has a similar problem, for me the key commands were
  1. chflags -R noschg * and
  2. mount to see the mounts
  3. unmount [name of the jail you're trying to delete]
Glad that's finally solved. And hopefully I'll now be able to reinstall my plexmediaserver properly!
 
Status
Not open for further replies.
Top