Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Use OS 9 to delete huge files that OS X won't delete System
I recently nearly ran out of hard drive space when, unbeknownst to me, a third-party extension began excessive logging to a log file. However, when I tried to delete the file, which was now more than 8GB, OS X would crash, presumably because the file was too large for it to handle. I even tried removing it and "emptying it" from the command line in terminal, using UNIX techniques I read about online -- but that crashed as well, even when I logged in in single-user mode (command line at startup).

It seemed I could not get rid of the file, until a helpful hint from a guru at the Apple Store's Genius Bar came to the rescue. He said that often when files can not be deleted in OS X, they CAN be deleted in OS 9. I simply rebooted under OS 9, and sure enough, the file deleted without a hitch. Hopefully, this simple tip can help others regain some hard drive space, or sanity, when OS X won't fulfill its deleting obligations!

[robg adds: I'm not sure what the answer is if you get into this situation with a new machine that won't boot into OS 9. Although I have such a machine, I'm not really interested in trying to create an 8gb+ file with which to test this hint -- so if anyone has any advice/experience, please share it...]
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[15,774 views]  

Use OS 9 to delete huge files that OS X won't delete | 32 comments | Create New Account
Click here to return to the 'Use OS 9 to delete huge files that OS X won't delete' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Use OS 9 to delete huge files that OS X won't delete
Authored by: aboswell on Mar 16, '04 10:46:34AM
I am wondering why opening the terminal and typing
sudo rm -r filename
or some such would'nt work. If for some reason that doesn't, create a root account and log into that. I agree that if you can boot into OS9, that is a great solution, I can't so...

[ Reply to This | # ]
Use OS 9 to delete huge files that OS X won't delete
Authored by: macevangelist on Mar 16, '04 11:28:45AM

I agree with aboswell, never had a file that I couldn't delete with the rm command in the terminal. I usually have plenty of DV files that are way over 8GB. I would like to see the error message of the rm command when run as root for that file that was only deletable with Mac OS 9.



[ Reply to This | # ]
Use OS 9 to delete huge files that OS X won't delete
Authored by: gospodin_david on Mar 16, '04 11:42:29AM

I think that you meant to say "sudo rm -f filename" -f is for force, -r is for recursive.



[ Reply to This | # ]
Use OS 9 to delete huge files that OS X won't delete
Authored by: macevangelist on Mar 16, '04 11:59:11AM
-f is for 'shut up and delete'. From man rm:

     -f          Attempt to remove the files without prompting for confirma-
                 tion, regardless of the file's permissions.  If the file does
                 not exist, do not display a diagnostic message or modify the
                 exit status to reflect an error.  The -f option overrides any
                 previous -i options.


[ Reply to This | # ]
Use OS 9 to delete huge files that OS X won't delete
Authored by: enigmamf on Mar 16, '04 01:34:25PM

Force is a good mnemonic, whereas "shut up and delete" is, uh, not.



[ Reply to This | # ]
Use OS 9 to delete huge files that OS X won't delete
Authored by: macevangelist on Mar 17, '04 11:16:51AM

when using the -f flag every question about privileges is being answered with yes and errors are not prompted to the screen. how does that have anything to do with "force"?



[ Reply to This | # ]
Use OS 9 to delete huge files that OS X won't delete
Authored by: stcanard on Mar 16, '04 02:43:56PM

Best bet is that something still had the file open; obviously going to OS9 would fix that issue.

If you ever have a file you absolutely cannot delete, go to terminal and try:

lsof <filename>

That will list all processes that have the file open. Killing the process will allow you to delete the file. 99% of the time this is the issue with something like this.



[ Reply to This | # ]
Use OS 9 to delete huge files that OS X won't delete
Authored by: hbwiner on Mar 16, '04 05:26:12PM

I have found that on occasion I will need to change the permissions on the file before it will allow me to delete it, even if I am logged in as root.

chmod 777 filename

Good luck



[ Reply to This | # ]
Use OS 9 to delete huge files that OS X won't delete
Authored by: schneb on Mar 16, '04 11:29:33AM

I used to boot OS9 to do such things, however, I am trying to be less dependant on it. I find that BatChmod comes in real handy for those of us who are not comfortable with using the terminal.

http://www.versiontracker.com/dyn/moreinfo/macosx/12057



[ Reply to This | # ]
Use OS 9 to delete huge files that OS X won't delete
Authored by: xyz3 on Mar 16, '04 12:37:30PM

try:

echo > '/Users/You/Path/To/File/



[ Reply to This | # ]
Use OS 9 to delete huge files that OS X won't delete
Authored by: xyz3 on Mar 16, '04 12:40:10PM

Don't add the last trailing slash on the command above:

echo > '/Users/admin/Desktop/bigFile'

This will pretty much so zap the contents of the file, but i have not tested on an 8GB file yet. ; )



[ Reply to This | # ]
Use OS 9 to delete huge files that OS X won't delete
Authored by: tji on Mar 16, '04 01:19:57PM

I have not seen this problem..

I use my G4 Cube, running Panther, as a file server for my HTPC (using external firewire drives). I record HDTV programs as huge files ~ 8GB. I have not had any problem deleting them.



[ Reply to This | # ]
Use OS 9 to delete huge files that OS X won't delete
Authored by: EddEdmondson on Mar 16, '04 01:21:04PM
Open Terminal.app. Create an 8G+ file:
box:~ edd$ dd ibs=1024 count=8400000 if=/dev/zero of=./8gigs

Check it's there:
box:~ edd$ ls -hl
...
-rw-r--r--   1 edd  edd          8G 16 Mar 18:18 8gigs

Delete it:

box:~ edd$ rm 8gigs 
remove 8gigs? y
box:~ edd$ 

Check it's gone:
box:~ edd$ ls

- not there.

Good job this worked. No OS9 on this machine! Something else is causing the original poster's problems. (Running 10.3.3)

[ Reply to This | # ]

Use OS 9 to delete huge files that OS X won't delete
Authored by: uurf on Mar 16, '04 02:57:44PM

I had no trouble deleting the file created above from the Finder either.



[ Reply to This | # ]
I suspect...
Authored by: enigmamf on Mar 16, '04 01:40:37PM

I suspect that the problem wasn't the size of the file, but that it was in use by a system process or something like that, although I can't see why that would be true of a log file.

I tried to delete the old directories left behind by AOL Instant Messenger, but every time I tried to erase the trash, I would get a kernal panic. To say the least, it was annoying. I slowly figured out which was causing the panic, pulled it out of the trash, left it on the desktop renamed as "Deleting this file will cause a kernal panic". Every now and then I woudl try again, and then I gave up until I upgraded to 10.3 (not to mention a few newer versions of AIM). I can delete it now. But it felt embarrasing (to say the least) that I, Master of my Domain Name, could not delete this wimpy little file.

I would have been a little wary of going to OS-9 to delete it -- what if I crash on startup without the file? But if I had thought of it I'm sure my curiosity would have overwhelmed my sense of fear eventually :)



[ Reply to This | # ]
Use OS 9 to delete huge files that OS X won't delete
Authored by: jps3 on Mar 16, '04 02:22:52PM

Might it have had a file flag set, like "uchg" or "sappnd" or "uappnd" (see man chflags)? A log file might have been set for one or more...

% ls -lo # -o shows the flags
-rw-r--r-- 1 jps3 wheel uchg 0 Mar 16 14:19 foo

% rm -f foo
rm: foo: Operation not permitted

% chflags nouchg foo

% ls -lo
-rw-r--r-- 1 jps3 wheel 0 Mar 16 14:19 foo

% rm -f foo
%



[ Reply to This | # ]
locked file?
Authored by: sjk on Mar 16, '04 03:03:38PM
Yep, it sounds like the file was locked. Thanks for mentioning "ls -o"; I forgot that in the file permissions and flags post I wrote yesterday.

[ Reply to This | # ]
Use OS 9 to delete huge files that OS X won't delete
Authored by: raven42rac on Mar 16, '04 03:23:14PM

I don't think that the size of the file makes any difference, I would assume that the file is still in use by the 3rd party app, and, for the most part, you can not delete files that are in use. I suspect the reason that it deleted under OS9 is that the app does not run in classic mode, therefore that file is not being written to.



[ Reply to This | # ]
Use OS 9 to delete huge files that OS X won't delete
Authored by: risc_abacus on Mar 16, '04 03:25:06PM
Use the power of /dev/null or /dev/urandom

ln -s /dev/null .null
or
ln -s /dev/urandom .rand

then

mv spamBits .null
or
mv spamBits .rand



[ Reply to This | # ]
Use OS 9 to delete huge files that OS X won't delete
Authored by: mproud on Mar 16, '04 03:39:09PM

It sounds like perhaps this file was deemed dependent, that it was being used by an application or something.

I would try moving the file to a safe location (like the root of your home folder, or the desktop), restart, and then try deleting it (chmod-ing where necessary).

If the original poster could give us some light on what kind of file and where it was located, we could gain more insight to the problem.



[ Reply to This | # ]
Use OS 9 to delete huge files that OS X won't delete
Authored by: allenhuffman on Mar 16, '04 04:59:06PM

Indeed, as an avid iMovie/iDVD user (currently with 480GB of external storage, plus the 80GB in my iMac and 80GB in my AlBook), I have files over 8GB all the time. I have not had a crash from deleting any of the larger video files, though I did discover bugs back in the 8.x and 9.x days with too many files open (fixed in 9-ish) and trying to import files too large.


---
-- OS-9 Al



[ Reply to This | # ]
Use OS 9 to delete huge files that OS X won't delete
Authored by: Makosuke on Mar 16, '04 05:00:15PM

I'm with everybody else that if there was something preventing the file from being deleted, even via the command line, it certainly wasn't the file's size.

This, however, does remind me of the one and only time I simply could not delete a file any way but through booting in 9. In the early days of X I had basically done a drag-and-drop "clone" of an older drive to a newer one. In the process, somehow, one of the filesystem's "_____HFS_somethingorother" files got copied to another disk.

It was visible from OSX and although I could move it to the trash, it proved absolutely impossible to delete; I tried sudo, GUI tools, everything I could think of, all to no avail--'File could not be deleted' or something along those lines. I don't know if it had something to do with the odd null characters preceeding the filename, unusual permissions, or something else, but after about a week of leaving it in the trash and occasionally taking a shot at it, I gave up, booted into 9, and was able to delete it that way.

Weird, but I'm assuming that if I'd gotten more creative I could've gotten rid of it. At least, I hope, since I sure can't boot into OS9 any more.



[ Reply to This | # ]
Use OS 9 to delete huge files that OS X won't delete
Authored by: olivesoft on Mar 16, '04 05:56:35PM
Reading the article:
I recently nearly ran out of hard drive space when, unbeknownst to me, a third-party extension began excessive logging to a log file.
Note they said that the hard drive was nearly full. I think that was the problem, not that the file was 8GB in size. However, I do find it hard to understand how rm'ing the file from the command line would crash.

---
-Bob
---------------------
I tend to think of [Mac] OS X as Linux with QA and Taste.
-James Gosling, Java Architect

[ Reply to This | # ]

Use OS 9 to delete huge files that OS X won't delete
Authored by: coolsoldier on Mar 16, '04 09:39:06PM

This has nothing to do with the size of the file, but rather with the fact that it is a log file. Because the system writes to log files almost continuously, they are always in use by the system. OS 9 doesn't use log files, so it can delete them. You can accomplish the same thing in OS X, though, if you move the file and reboot. Then OS X won't find the old log file, so it will create a new one and you can delete the old one.



[ Reply to This | # ]
Use OS 9 to delete huge files that OS X won't delete
Authored by: baronadv on Mar 16, '04 10:56:26PM

i have had the same problem with my g4 running first 10.2 and now 10.3.2. This has been going on for months.

I get a kernel panic whenever i try to empty the trash with files that are larger than 200mgs or so. I have to save up all my large files and then boot in 9.2 to throw them out.

Its really annoying but i suppose I should be grateful that my computer boots in 9. Other than this the computer runs fine.

i read about moving the files and then rebooting...but i really dont want to have to do that. I'll try changing the permissions and see if that works. Thanks everybody.



[ Reply to This | # ]
You CAN rm files that are in use!
Authored by: Anonymous on Mar 16, '04 11:40:41PM

Hello? McFly?

People are suggesting that perhaps the file couldn't be rm'd because it was in use. This is patently wrong. "In use" files can be rm'd under any UNIX system. In fact, a common (ugly) hack to creating private temp files is to create a new file, open it, and then rm it while it is still open.

The rm just tells the file system that the file is gone, but the blocks aren't free'd until the last open file descriptor pointing to that file is closed. So an open file, even one that is actively being written to, can be rm'd.

Just FYI.



[ Reply to This | # ]
You CAN rm files that are in use!
Authored by: stetner on Mar 17, '04 06:35:58AM

Agreed, Nothing should stop you from deleting an in use file (other than that immutable flag which is separate from the in use issue).

If the system was panicing, I would suspect that the file system got corrupt when you ran out of space and trying to rm the file triggered the panic.

In all likelihood, if you had just booted into OS X single user and forced an fsck, you would have cleared it up as well....



[ Reply to This | # ]
Use OS 9 to delete huge files that OS X won't delete
Authored by: nite77 on Mar 17, '04 08:26:28AM

What I find curious, is that everyone is suggesting that the file was in use, and that in OS9 it wasn't. But everyone seems forgetting this: "but that crashed as well, even when I logged in in single-user mode (command line at startup)."

I don't think that many things are open in single-user mode... at least not any 3rd party... I'm voting for random cosmic rays causing trouble :P
And if rm'ing the file *crashed* the system, even in single-user mode, there just *had* to be something else wrong.

---
/Nite - "can't rain all the time"
[ http://www.nitesade.net ]



[ Reply to This | # ]
Use OS 9 to delete huge files that OS X won't delete
Authored by: SeanAhern on Mar 17, '04 03:30:03PM

But it was a system extension that caused the problem. If it were a haxie, for example, it could be doing God knows what. If it were a standard application, I'd agree with you. But a system extension ... I think all bets are off.



[ Reply to This | # ]
Use OS 9 to delete huge files that OS X won't delete
Authored by: foodragon on Mar 17, '04 09:14:16AM

I actually have a problem similar to this, I use to have a an mp3 with some weird characters in it that I decided I didn't want anymore, so I was able to drag it into the trash, but that's as far as I get. Upon trying to empty the trash the finder gives me an error -43. So I figured I'd give rm a try, no good, the terminal it the file name comes up as Bj??????- Live In Cambridge.mp3 and when I goto rm the the and hit tab to fill in the file name it comes out with this Bj\355\266\206\355\271\240-\ Live\ In\ Cambridge.mp3 even doin rm -f didn't work, try some of the other things in this thread such as echo >, no go. I've really been trying to figure a way to get rid of it as i don't have os 9. any ideas guys?

---
_rob



[ Reply to This | # ]
Use OS 9 to delete huge files that OS X won't delete
Authored by: EddEdmondson on Mar 17, '04 09:55:38AM

Check these links:

http://forums.macosxhints.com/showthread.php?s=&threadid=15814&perpage=20
http://forums.macosxhints.com/showthread.php?s=&threadid=11566
http://forums.macosxhints.com/showthread.php?s=&threadid=10758



[ Reply to This | # ]
Panic on large file removal
Authored by: snoopy42 on Apr 25, '04 09:50:48AM

Note that there is a bug in the journaling subsystem. It is not consistent, I have seen it panic on 3 of 6 large files. Manual attempt to trash or rm as a normal user would just make the machine "freeze"/panic with no usable error message.

Single user startup showed the error message from "jnl".

OSX 10.3.3, 1.5 gig of RAM.



[ Reply to This | # ]