LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux 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


Reply
  Search this Thread
Old 04-10-2009, 08:25 AM   #1
richinsc
Member
 
Registered: Mar 2007
Location: Utah
Distribution: Ubuntu Linux (20.04)
Posts: 224

Rep: Reputation: 32
Unhappy Failed Tar created "-M" file now can't delete


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.
 
Old 04-10-2009, 08:32 AM   #2
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
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.
 
Old 04-10-2009, 08:42 AM   #3
richinsc
Member
 
Registered: Mar 2007
Location: Utah
Distribution: Ubuntu Linux (20.04)
Posts: 224

Original Poster
Rep: Reputation: 32
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...
 
Old 04-10-2009, 11:52 AM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
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.
 
Old 04-10-2009, 12:13 PM   #5
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , RHEL
Posts: 1,979
Blog Entries: 1

Rep: Reputation: 209Reputation: 209Reputation: 209
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
 
  


Reply

Tags
fail, tar



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 On
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 07:10 AM
what to do if you delete "title" from the grub.conf file? Pravab Linux - Kernel 3 05-11-2006 09:59 AM
How to "cp" or "rm" or "tar" all the files except a certain file? cqmyg5 Slackware 7 04-07-2006 02:45 PM
oops - made a file called "--dereference" - how do I delete it? BrianK Linux - General 2 06-21-2004 08:37 PM
How do you delete a file called "--tape-lengh=1"? I've tried everything... Huddlebum Linux - General 1 01-01-2004 10:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:51 PM.

Main Menu
Advertisement
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
Twitter: @linuxquestions
Open Source Consulting | Domain Registration