LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 01-02-2010, 02:42 AM   #1
cdarrah010
LQ Newbie
 
Registered: Dec 2009
Posts: 14

Rep: Reputation: 0
Post USB as read-Only....


running linux mint 8, I am incapable of repairing my Usb after it has became read only. I have tried using the gparted to repair, but what steps would i have to do after i delete the old partition and the file system is "allocated"

I tried to go to devices> create partition table and click create.
after that i go to create new partition, change the filesystem to fat32, then attempt to add it, i get a error at

Create new Fat32 File system
>mkdosfs -f32 -v -n "" /dev/sdc1
mkdosfs: unable to open /dev/sdc1



what step did i miss in this???
 
Old 01-02-2010, 05:02 AM   #2
sonichedgehog
Member
 
Registered: Oct 2007
Location: London UK
Distribution: Fedora Core 17
Posts: 298

Rep: Reputation: 32
The package that creates a dos filesystem is dosfstools, first check whether it is installed. I haven't used mint but I believe it's not too far removed from debian/ubuntu, so if you can't get on with the graphical user interface (gui) then you might be able to get it from commandline thus:
Code:
apt-cache policy dosfstools
to check whether you have it then if not
Code:
sudo apt-get install dosfstools
I guess from your post that you are using gui mostly? Note use of sudo to get you admin privilege if that is the case, required for system change but not for package search.

Then insert your device and unmount it. If you can't do that from gui post again.

I guess it will have a device node /dev/sdb? Several ways to check, simplest is
Code:
dmesg | tail
which will show you what has just happened.

Then try:
Code:
sudo mkfs.vfat /dev/sdb
or whatever device node has been assigned.

Note that I am guessing the commands are like ubuntu, the main point is that admin needs privileges gained by switching to root user (not automatically provided in ubuntu therefore probably same in mint) or prefacing the command with sudo. Many problems in linux are nothing more than privileges issues. Regards

Last edited by sonichedgehog; 01-02-2010 at 05:07 AM. Reason: error in recommended code
 
Old 01-03-2010, 12:27 AM   #3
cdarrah010
LQ Newbie
 
Registered: Dec 2009
Posts: 14

Original Poster
Rep: Reputation: 0
I attempted what you did and what you said did function on the terminal, but i am still unable to open it, this is what i did
Quote:
cody@somemachine ~ $ sudo apt-get install dosfstools
Reading package lists... Done
Building dependency tree
Reading state information... Done
dosfstools is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 9 not upgraded.
cody@somemachine ~ $ apt-cache policy dosfstools
dosfstools:
Installed: 3.0.3-1
Candidate: 3.0.3-1
Version table:
*** 3.0.3-1 0
500 http://archive.ubuntu.com karmic/main Packages
100 /var/lib/dpkg/status
cody@somemachine ~ $ dmesg | tail
[ 65.987794] cfg80211: Regulatory domain: 98
[ 65.987798] (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[ 65.987805] (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2700 mBm)
[ 65.987817] cfg80211: Disabling channel 2467 MHz on phy0 due to Country IE
[ 65.987822] cfg80211: Disabling channel 2472 MHz on phy0 due to Country IE
[ 65.987828] cfg80211: Disabling channel 2484 MHz on phy0 due to Country IE
[ 65.987837] cfg80211: Current regulatory domain updated by AP to: US
[ 65.987842] (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[ 65.987849] (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2700 mBm)
[ 76.273069] wlan1: no IPv6 routers present
cody@somemachine ~ $ sudo mkfs.vfat /dev/sdc
mkfs.vfat 3.0.3 (18 May 2009)
mkfs.vfat: unable to open /dev/sdc
cody@somemachine ~ $
 
Old 01-03-2010, 03:46 AM   #4
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,363

Rep: Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335Reputation: 2335
Sorry to cut across clever solutions with a banal one. Met this many times. Has the thing got a read/write switch? Switch it!
 
Old 01-03-2010, 07:12 AM   #5
sonichedgehog
Member
 
Registered: Oct 2007
Location: London UK
Distribution: Fedora Core 17
Posts: 298

Rep: Reputation: 32
which is probably right! Anyway, my code was slightly wrong- the device node is sd(something, b,c, etc, depending on what has been detected first) but there is a partition, in your case sdc1. So you would need to enter sdc1 not sdc. Actually dmesg | tail didn't include your device, it must have been plugged in earlier. Dmesg without tail will show a longer event history.

As an alternative you could clear the device and make a new partition using parted. To test this, I have just deleted all partitions on an old spare usb stick and created a new partition with type fat16 (fat32 u/s for this ancient disk). I used parted for this. If you need further help please post again.
 
Old 01-03-2010, 07:28 AM   #6
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,248
Blog Entries: 8

Rep: Reputation: 235Reputation: 235Reputation: 235
I think it's safe to make the USB act like a super floppy:
Code:
dd if=/dev/zero of=/dev/sdc   # optional if you want to make sure if all parts of your USB is still writable
mkdosfs -f32 -v -n "" -i 0 -I /dev/sdc   # -i is optional
Please make sure that /dev/sdc really points to your usb drive or else you might erase the wrong drive. Do 'dmesg | tail' OR 'dmesg | grep sdc'.

Last edited by konsolebox; 01-03-2010 at 07:29 AM.
 
Old 01-03-2010, 01:23 PM   #7
cdarrah010
LQ Newbie
 
Registered: Dec 2009
Posts: 14

Original Poster
Rep: Reputation: 0
i tried dd if=/dev/zero of=/dev/sdc and i got this
Quote:
cody@somemachine ~ $ dd if=/dev/zero of=/dev/sdc
dd: opening `/dev/sdc': Permission denied

it seems like permission denied is my main error.... along with the fact that it cannot open the filesystem that it is trying to create, which seems like they are both the same problem.
 
Old 01-03-2010, 01:52 PM   #8
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Rep: Reputation: 231Reputation: 231Reputation: 231
Quote:
Originally Posted by cdarrah010 View Post
i tried dd if=/dev/zero of=/dev/sdc and i got this



it seems like permission denied is my main error.... along with the fact that it cannot open the filesystem that it is trying to create, which seems like they are both the same problem.
you need to be root/superuser.
 
Old 01-03-2010, 04:39 PM   #9
sonichedgehog
Member
 
Registered: Oct 2007
Location: London UK
Distribution: Fedora Core 17
Posts: 298

Rep: Reputation: 32
I assume that there is nothing on the device that you need to backup or you would have done so. To test whether you have any control over what is on the device, you could overwrite with random data by
Code:
sudo shred -n1 /dev/sdc
although if unable to dd anything to it it sounds as though there may be a permission issue as has been said. If you have problems with getting root privilege (unlikely as you have been using sudo?) please post.

Again as has been mentioned you need to be sure that you are taking out the right device- if one of your hd's/partitions is unmounted the various mkfs,dd, shred etc commands will destroy the data on it.
 
Old 01-03-2010, 08:04 PM   #10
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,248
Blog Entries: 8

Rep: Reputation: 235Reputation: 235Reputation: 235
Quote:
Originally Posted by cdarrah010 View Post
it seems like permission denied is my main error....
Probably but we're not sure about that yet. Denial of permission does not imply write access error or IO error. As suggested, try to do it as a super user. Also try to watch the output of dmesg if it shows errors related to the device. Still, 'dmesg | tail'.
 
Old 01-03-2010, 11:27 PM   #11
cdarrah010
LQ Newbie
 
Registered: Dec 2009
Posts: 14

Original Poster
Rep: Reputation: 0
now the device is unable to mount afer plugging it back into the laptop... lol

the eroor is this

Quote:
Error mounting: mount exited with exit code 32: mount: wrong fs type, bad option, bad superblock on /dev/sdc1,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
so after doing dmesg | tail i got

Quote:
cody@somemachine ~ $ dmesg | tail
[ 2321.186314] ath9k: timeout (100000 us) on reg 0x806c: 0xdeadbeef & 0x01f00000 != 0x00000000
[ 2321.186486] ath9k: RX failed to go idle in 10 ms RXSM=0xdeadbeef
[ 2441.183243] ath9k: timeout (100000 us) on reg 0x806c: 0xdeadbeef & 0x01f00000 != 0x00000000
[ 2441.183414] ath9k: RX failed to go idle in 10 ms RXSM=0xdeadbeef
[ 2497.921936] ath9k: timeout (100000 us) on reg 0x806c: 0xdeadbeef & 0x01f00000 != 0x00000000
[ 2497.922106] ath9k: RX failed to go idle in 10 ms RXSM=0xdeadbeef
[ 2670.197815] FAT: invalid media value (0x2b)
[ 2670.197836] VFS: Can't find a valid FAT filesystem on dev sdc1.
[ 2681.475312] FAT: invalid media value (0x2b)
[ 2681.475333] VFS: Can't find a valid FAT filesystem on dev sdc1.

which to my newbie eyes appears to be the result of no fat system??? and yes i have been using sudo
 
Old 01-04-2010, 01:03 AM   #12
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,248
Blog Entries: 8

Rep: Reputation: 235Reputation: 235Reputation: 235
Why is it that it's trying to search sdc1 and not sdc? On my system that does not happen even if HAL is active.

Where you able to properly format the device using mkdosfs and were there no errors found? You might actually ran 'dd if=/dev/zero of=/dev/sdc'... But you might still have tried to create a filesystem in /dev/sdc1. Even though you already erased tables in /dev/sdc, /dev/sdc1 will not disappear until you plug it again to the system. AFAIK the kernel does not automatically update the tables until the device is reloaded.
 
Old 01-04-2010, 08:31 AM   #13
sonichedgehog
Member
 
Registered: Oct 2007
Location: London UK
Distribution: Fedora Core 17
Posts: 298

Rep: Reputation: 32
At this stage it doesn't matter whether the device is mounted on connection. When it has a valid filesystem, it can easily be mounted manually, but that's for later.

I used the following on my spare disk, adjusted for your case. This would require a cleared device, which
Code:
sudo shred -n1 /dev/sdc
would achieve irrespective of what is on it at present:
Code:
sudo parted /dev/sdc mkpartfs primary fat32 0 8000
Translate: make a new primary partition on sdc, of fat32 type, start at the beginning of the device, end at 8gB (either how big you want the partition, or the limit of the usbstick).

After this, my device automounted when next plugged in.
 
Old 01-05-2010, 01:21 AM   #14
cdarrah010
LQ Newbie
 
Registered: Dec 2009
Posts: 14

Original Poster
Rep: Reputation: 0
welll i think i fixed my harddrive, i plugged into a microsoft 7 computer and it reformatted it automatically. bad news though. i completely mashed my linux hard drive, as in i cannot find it anywhere on my external harddrive. apparently closing the terminal when it is executing a process will delete any and all files you have...
 
Old 01-05-2010, 10:21 AM   #15
sonichedgehog
Member
 
Registered: Oct 2007
Location: London UK
Distribution: Fedora Core 17
Posts: 298

Rep: Reputation: 32
Your other thread http://www.linuxquestions.org/questi...t-boot-779940/ indicated that you are running Mint7 from usb hard drive- is this the one that is giving you trouble? I don't want to go off topic here and I guess i am somewhat breaching etiquette by crossing info from different threads but it seems the best way to help. AFAIK grub can be configured to look anywhere on your system for your kernel,including a removable device. If you are trying to boot a Lx device from W$ laptop, AFAIK this must be either a live CD, live USB (with BIOS altered to loom for it first before booting from HD) or you have to install GRUB which modifies the MBR code so that w$ will sit alongside other options. I mention this because you need to make clear what end result you require from your USB device, as it may be that you are carrying out tasks that are slightly outside the scope of this thread.

The only incidence I know where an operation destroys data if hung is a defrag (w$) or a partition resize/move (parted, gparted). However I think a w$ os would not perceive an ext file system as data so might reformat a device that contained nothing else. This would not harm the hardware.

If W$ can write to your device than linux can. Please decide what you need, you can build a linux OS on either of your laptops, with dual boot on the W$ one, or if you prefer on your removable HD, from your Linux laptop; but the installation will change the MBR to look for grub.lst on your removable HD so you will need to run GRUB from the existing OS on the laptop to restore its independence.

We can help you with any of these steps, but I believe that grub editing is difficult until you have more experience with linux.
 
  


Reply



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
USB drive not working properly, read only device? (USB key storage device) Arodef Linux - Hardware 14 01-01-2010 07:32 AM
Read only filesystem in USB ravi_chobey Linux - Hardware 5 03-07-2009 01:54 AM
USB HardDrive mounts read-only. Is there anyway to make it read-write? Fritz_Katz Linux - Hardware 7 09-13-2007 06:50 PM
Why has my USB Diskbecome read-only? PostPCMan SUSE / openSUSE 6 07-01-2006 08:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 12:57 AM.

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