Welcome to Linux Forums!

With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.

Linux Forum ArticlesLinux ForumsLinux Forum DownloadsLinux HostsFree MagazinesJobs
Home|Register|FAQ|Member List|Calendar|Unanswered Posts|Forum Rules|Today's Posts|Advanced Search|
SEARCH FOR IN
Go Back   Linux Forums > GNU Linux Zone > Misc
Reload this Page How to delete files/directories on Read-Only file system
Linux Forums
Linux Forums
Welcome To The Linux Forums!
Welcome to Linux Forums. We pride ourselves in being one of the largest Linux communities on the web, we encourage you to REGISTER on our forums and participate in the community. There are over 150,000 members ready to answer your questions. JOINING US today will allow you to make new posts, get support, send messages to other members and submit downloads to our downloads directory and many other great features!

Misc Any questions or Linux discussion that does not fit in any of the other technical areas.

Reply
 
Thread Tools Display Modes
Old 07-15-2008   #1 (permalink)
Linux Engineer
 
Join Date: Sep 2004
Posts: 1,079
How to delete files/directories on Read-Only file system

Hi folks,


Ubuntu 7.10


I have some files and directories on an USB flash pendrive. I can't delele them because on read-only filesystem.


I tried;

$ sudo mount -o remount,rw /mnt/maindir
without result.


If run;
$ sudo mount -o remount,rw /dev/sdb1
Code:
mount: you must specify the filesystem type
What filesystem I have to specify there?


I don't expect running;
Code:
$ dd if=/dev/zero of=/dev/sdb1
to erase the pendrive completely.


Please shed me some light. TIA


B.R.
satimis
satimis is offline   Reply With Quote
Old 07-15-2008   #2 (permalink)
Bigtomrodinator
 
bigtomrodney's Avatar
 
Join Date: Nov 2004
Location: Sunny South-East of Ireland
Posts: 5,190
What filesystem is on the drive? If it is FAT or FAT32 you can use
Code:
sudo mount -o remount,rw -t vfat /dev/sdb1
__________________
Registered Linux user #378740
New members read here / Forum Rules
#linuxforums on irc.freenode.net
bigtomrodney is offline   Reply With Quote
Old 07-15-2008   #3 (permalink)
Linux Engineer
 
Join Date: Sep 2004
Posts: 1,079
Quote:
Originally Posted by bigtomrodney View Post
What filesystem is on the drive? If it is FAT or FAT32 you can use
Code:
sudo mount -o remount,rw -t vfat /dev/sdb1
Hi bigtomrodney,


Thanks for your advice.


Before reading your post I performed following test.


This USB pendrive looks quite strange to me. I got it in a conference as gift from a multi-nation software company. It has files on it introducing their products taking up 57M out of 1G.


After mount it with;
Code:
$ sudo mount /dev/sdb1 /mnt
(I found /dev/sdb1 by runnint "fdisk -l")

I can copy files on it. They can be deleted later.


If running
Code:
$ cp -r /path/to/dir-A /mnt/
Directory including files can be copied on the pendrive. But they can't be deleted later.


Then I ran
$ sudo mount -t vfat -o rw /dev/sdb1 /media/sdb1

Still I can't delete the directories including their files.


Later I found on running;
$ fdisk -l
Code:
Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb: 1056 MB, 1056702464 bytes
33 heads, 62 sectors/track, 1008 cylinders
Units = cylinders of 2046 * 512 = 1047552 bytes
The partition table seems gone.


Therefore I ran
# fdisk /dev/sdb

to repartition the drive and afterwards ran;

# mkfs.ext2 -c /dev/sdb1
it went though w/o complaint


But I can't mount the pendrive

$ sudo mount -t ext2 /dev/sdb1 /media/sdb1/
Code:
mount: wrong fs type, bad option, bad superblock on /dev/sdb1,
       missing codepage or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

Then I ran
Code:
dmesg | tail

It asked me to run "e2fsck /dev/sdb1"

$ sudo e2fsck /dev/sdb1
Code:
....
Inode 421 has INDEX_FL flag set but is not a directory.
Clear HTree index<y>? 
......
It took long time to run without finish. Therefore I manually exited it by pressing [Ctrl]+c


I don't know how to proceed further. Nor I know what mistake I have committed. Please advise.


TIA


B.R.
satimis
satimis is offline   Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
 

Free Magazines
Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe
Systems Management News, the newspaper for IT systems administration and data center managers!
Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe
The Enterprise Newsweekly
eWeek is the essential technology information source for builders of e-business.
subscribe
Oracle Magazine
Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe
Total Telecom
Total Telecom is "The Economist of the communications industry".
subscribe
More free magazines »



All times are GMT. The time now is 09:27 AM.




© 2000 - 2008 - All Rights Reserved - Property of  MAS Media

Content Relevant URLs by vBSEO 3.2.0