LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux > Linux - General
User Name
Password
Linux - General This forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Tags used in this thread
Popular LQ Tags ,

Reply
 
Thread Tools
Old 04-10-2009, 09:25 AM   #1
richinsc
Member
 
Registered: Apr 2007
Location: South Carolina
Distribution: Debian Lenny 5.0r1
Posts: 187
Thanked: 0
Unhappy Failed Tar created "-M" file now can't delete


[Log in to get rid of this advertisement]
Howdy Ya'll,

I have been using Linux for a number of years and frankly this one has me stumped, but while I have some ideas on how I can fix by taking down the server, I can't take the server off line because it is a production server.

There was a tar archive that failed and didn't know it. Until my /var ran out of disk space that is. Within /var there is a file name -M with a file size of 231M. At first I didn't realize it was a failed tar until I tried test extract it and discovered that it was a failed archive.

I have tried to rm, shred, mv, the file but all fail because the file keeps being seen as a command option.

Code:
ls -lh | more
total 231M
-rw-r--r--   1 root  root  231M 2009-03-25 13:54 -M
Code:
# rm -f -M
rm: invalid option -- M
Try `rm --help' for more information.
Code:
# shred -uvfz -M
shred: invalid option -- M
Try `shred --help' for more information.
Code:
# mv -M M
mv: invalid option -- M
Try `mv --help' for more information.
Code:
 tar -tvf -M
-rw-r--r-- root/root 2147483647 2009-03-25 13:47:39 eng/backup.tar
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now
Code:
# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             1.1G  220M  808M  22% /
tmpfs                 3.9G  8.0K  3.9G   1% /dev/shm
/dev/sda9             157M   47M  110M  30% /dsm
/dev/sda6             3.1G  517M  2.5G  17% /opt
/dev/sda10            111G   85G   26G  77% /tmp
/dev/sda7             4.1G  3.1G  931M  78% /usr
/dev/sda8             2.1G  1.9G  193M  91% /var
Now the issue also it likely to be due to the fact that eng/ no longer exists nor does the backup file in question. So I have a 231M file eating up valuable disk space and I can't remove it. My /var/ was at 97% but after deleting some logs that were WAY told old to be worth keeping... (I just realized to that my logs aren't rotating. :-( I will have to look into this) I deleted some achieved logs to free space.

No remember I can't take the server off line (It's Live Production), and I don't have any spare disk to move /var to larger pastures so any help or ideas to rid me of the blasted file would be most helpful. I just need it to not be interpreted as an option.
richinsc is offline  
Tag This Post ,
Reply With Quote
Old 04-10-2009, 09:32 AM   #2
tronayne
Member
 
Registered: Oct 2003
Location: Michigan
Distribution: Slackware
Posts: 757
Thanked: 32
One trick you can do (and be careful) is
Code:
rm -i *
and only answer "y" to that file.

Usually, though, you can get rid of those sort of things with
Code:
rm ./-M
or
rm -i ./*M                 (and answer "y" or "n")
Hope this helps some.
tronayne is offline     Reply With Quote
Old 04-10-2009, 09:42 AM   #3
richinsc
Member
 
Registered: Apr 2007
Location: South Carolina
Distribution: Debian Lenny 5.0r1
Posts: 187
Thanked: 0

Original Poster
Thanks tronayne.

This one really had me stumped, never thought to use ./-M It worked like a charm Now I have much more space in my /var dir.. Now to work on my log rotation and figure out why it's isn't removing older archives...
richinsc is offline     Reply With Quote
Old 04-10-2009, 12:52 PM   #4
colucix
Guru
 
Registered: Sep 2003
Location: Bologna, Italia
Distribution: OpenSUSE 11.1 CentOS 5.4 VectorLinux 6.0
Posts: 5,132
Thanked: 464
Another way is
Code:
rm -- -M
the -- is valid for a lot of commands. It means the termination of the options section, that is every string coming after -- is interpreted as argument to the command, even if it begins with a hyphen. Very useful in this case.
colucix is offline     Reply With Quote
Old 04-10-2009, 01:13 PM   #5
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora 11, CentOS 5.3, Linux Mint 5, Solaris 10
Posts: 1,260
Thanked: 35
Quote:
Originally Posted by colucix View Post
Another way is
Code:
rm -- -M
the -- is valid for a lot of commands. It means the termination of the options section, that is every string coming after -- is interpreted as argument to the command, even if it begins with a hyphen. Very useful in this case.
Also...

Code:
root@host# rm "-M"
...That's why I love Linux...so many ways to do the same thing
custangro is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
tar -jxvf returns "decompression failed" error ProoN Linux - Software 4 07-03-2007 08:10 AM
what to do if you delete "title" from the grub.conf file? Pravab Linux - Kernel 3 05-11-2006 10:59 AM
How to "cp" or "rm" or "tar" all the files except a certain file? cqmyg5 Slackware 7 04-07-2006 03:45 PM
oops - made a file called "--dereference" - how do I delete it? BrianK Linux - General 2 06-21-2004 09:37 PM
How do you delete a file called "--tape-lengh=1"? I've tried everything... Huddlebum Linux - General 1 01-01-2004 11:11 PM


All times are GMT -5. The time now is 01:34 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration