Date: Fri, 21 Feb 1997 11:37:51 -0800 (PST) From: michael@blueneptune.com To: david@wvb.gomel.by (David Stickney) Cc: freebsd-isp@FreeBSD.org Subject: Re: Big Directories.. Message-ID: <199702211937.LAA05836@rainey.sj-coop.net> In-Reply-To: <01BC2023.E0990480@david> from "David Stickney" at Feb 21, 97 06:20:10 pm
next in thread | previous in thread | raw e-mail | index | archive | help
> 1. How can you prevent users from running this in their home directory, > without cutting off their shell account That one I don't know an answer to. Obviously, if they did it intentionally, I'd give them a stern warning, or boot them from the system. But that's a reactive "solution", not proactive. > 2. How can you get rid of the directory once it has 300 or so > subdirectories. The shell keeps saying there is no such directory, and > nothing seems to delete it. I tried moving it to a floppy, but it worked > for 45 minutes and I didn't want to burn out the drive. If the command "rm -rf x" doesn't work, then there is one method you can use as a last-ditch effort. First of all, unmount the filesystem, and run 'fsck' against that partition, fixing any errors that might show up. Then create a small C program as follows: main() { unlink("x"); return(0); } and run that as root from the appropriate directory. It should just unlink the directory entry, without the normal "directory must be empty" checks done by rmdir. It has to be run as root, though, as that is the only user that is allowed to do this. [Also, it might be the case that FreeBSD does not allow this, but it is worth a shot.] The down side of doing this is that your disk is no longer consistent, and you must run an fsck against it again. Unmount the partition, and then run fsck against the raw partition. For each of the subdirectory entries, you will be asked if you want to reconnect them --- say "no". It will then ask if you want to clear them, to which you should say "yes". [The exact questions asked might be different, based on the specifics of the FreeBSD version of fsck. But the general idea should be as given.] Note that I have never done this under FreeBSD, but have done it with other Unix boxes before. It's possible that it won't work for one reason or another under FreeBSD, but it won't hurt to try. -- Michael Bryan michael@blueneptune.com Quicken Web Page: http://quicken.blueneptune.com/Quicken.html
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199702211937.LAA05836>