Problem formatting USB drive, need some help...
I'm trying to format my USB drive and am having a problem mounting it as read only and don't know what I'm doing wrong?
Can someone help me reformat this thing and wipe it out? Thanks, root@dns1:/mnt# fdisk /dev/sda1 You will not be able to write the partition table. Command (m for help): ====================================================== root@dns1:/mnt# ls -l /dev/sda1 brw-rw---- 1 root plugdev 8, 1 2007-08-07 20:13 /dev/sda1 ====================================================== root@dns1:/mnt# mount /dev/sda1 /mnt/USB mount: block device /dev/sda1 is write-protected, mounting read-only ====================================================== root@dns1:/mnt# fdisk -l Disk /dev/hda: 203.9 GB, 203928109056 bytes 255 heads, 63 sectors/track, 24792 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/hda1 1 12 96358+ 83 Linux /dev/hda2 13 74 498015 82 Linux swap / Solaris /dev/hda3 75 1533 11719417+ 83 Linux /dev/hda4 1534 24792 186827917+ 5 Extended /dev/hda5 1534 24792 186827886 83 Linux Disk /dev/sda: 131 MB, 131072000 bytes 8 heads, 32 sectors/track, 1000 cylinders Units = cylinders of 256 * 512 = 131072 bytes Device Boot Start End Blocks Id System /dev/sda1 1 1000 127984 6 FAT16 root@dns1:/mnt# |
try
Code:
fdisk /dev/sda |
Quote:
Command (m for help): root@dns1:/mnt# df -h Filesystem Size Used Avail Use% Mounted on /dev/hda3 12G 5.1G 5.5G 48% / varrun 252M 92K 252M 1% /var/run varlock 252M 0 252M 0% /var/lock procbususb 10M 144K 9.9M 2% /proc/bus/usb udev 10M 144K 9.9M 2% /dev devshm 252M 0 252M 0% /dev/shm /dev/hda1 89M 36M 49M 43% /boot /dev/hda5 176G 869M 166G 1% /video df: `/mnt/USB': Input/output error /dev/sdb1 125M 1.8M 124M 2% /media/usbdisk root@dns1:/mnt# fdisk /dev/sdb You will not be able to write the partition table. Command (m for help): q root@dns1:/mnt# Does this help??? [43548683.230000] Vendor: USB Model: Flash Disk Rev: 2.00 [43548683.230000] Type: Direct-Access ANSI SCSI revision: 02 [43548684.280000] ready [43548684.280000] SCSI device sdb: 256000 512-byte hdwr sectors (131 MB) [43548684.280000] sdb: Write Protect is on [43548684.280000] sdb: Mode Sense: 03 00 80 00 [43548684.280000] sdb: assuming drive cache: write through [43548684.290000] SCSI device sdb: 256000 512-byte hdwr sectors (131 MB) [43548684.290000] sdb: Write Protect is on [43548684.290000] sdb: Mode Sense: 03 00 80 00 [43548684.290000] sdb: assuming drive cache: write through [43548684.290000] sdb: sdb1 [43548684.290000] sd 20:0:0:0: Attached scsi removable disk sdb [43548684.290000] sd 20:0:0:0: Attached scsi generic sg0 type 0 [43548685.210000] FAT: utf8 is not a recommended IO charset for FAT filesystems, filesystem will be case sensitive! |
Quote:
By the way, you don't even need to mount anything to use fdisk. You can fdisk unmounted partitions, but again when you call fdisk don't include the partition numbers. Also, it does not matter to fdisk if a partition is mounted as read only. If fdisk is having a problem it is either a driver or hardware issue. Also, Quote:
Thirdly, if you are going to manually mount a usb stick you shouldn't just use 'mount /dev/sda1 /mnt/USB'. You should include options to specify that it is vfat, noatime, etc. man mount for more info on the options. I usually create an entry in /etc/fstab if I am going to be manually mounting stuff a lot. Don't do this if your disk is still auto-mounting. Try this... Code:
cat /proc/bus/usb/devices Double check your drivers (check your kernel config to see if they are included or built as modules). Are the correct modules loaded (look at lsmod)? Is it just this USB stick a problem or do others also have the same problem. Try another stick if you have the option. |
Thanks for the reply.
Here is the info from mount: root@dns1:/mnt# mount /dev/hda3 on / type ext3 (rw,errors=remount-ro) proc on /proc type proc (rw,noexec,nosuid,nodev) /sys on /sys type sysfs (rw,noexec,nosuid,nodev) varrun on /var/run type tmpfs (rw,noexec,nosuid,nodev,mode=0755) varlock on /var/lock type tmpfs (rw,noexec,nosuid,nodev,mode=1777) procbususb on /proc/bus/usb type usbfs (rw) udev on /dev type tmpfs (rw,mode=0755) devshm on /dev/shm type tmpfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) /dev/hda1 on /boot type ext3 (rw) /dev/hda5 on /video type ext3 (rw) nfsd on /proc/fs/nfsd type nfsd (rw) binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw) /dev/sda1 on /media/usbdisk type vfat (ro,nosuid,nodev,quiet,shortname=mixed,uid=1001,gid=1001,umask=077,iocharset=utf8) from lsmod: root@dns1:/mnt# lsmod Module Size Used by nls_iso8859_1 5248 0 ntfs 111732 0 nls_utf8 3200 1 nls_cp437 6912 3 vfat 14720 1 fat 56092 1 vfat sg 37020 0 sd_mod 22528 2 usb_storage 74816 1 libusual 16912 1 usb_storage binfmt_misc 13448 1 nfsd 233892 13 exportfs 7168 1 nfsd lockd 67848 2 nfsd sunrpc 165820 8 nfsd,lockd ipt_TCPMSS 5376 1 xt_limit 3840 8 xt_tcpudp 4480 16 ip_nat_irc 3840 0 ip_nat_ftp 4736 0 iptable_nat 8964 1 iptable_mangle 3968 0 ipt_LOG 8320 8 ipt_MASQUERADE 4864 1 ip_nat 19884 4 ip_nat_irc,ip_nat_ftp,iptable_nat,ipt_MASQUERADE ipt_TOS 3456 0 ipt_REJECT 6784 1 ip_conntrack_irc 7920 1 ip_nat_irc ip_conntrack_ftp 8816 1 ip_nat_ftp xt_state 3328 8 ip_conntrack 53088 8 ip_nat_irc,ip_nat_ftp,iptable_nat,ipt_MASQUERADE,ip_nat,ip_conntrack_irc,ip_conntrack_ftp,xt_state nfnetlink 8088 2 ip_nat,ip_conntrack iptable_filter 4224 1 ip_tables 15204 3 iptable_nat,iptable_mangle,iptable_filter x_tables 16132 10 ipt_TCPMSS,xt_limit,xt_tcpudp,iptable_nat,ipt_LOG,ipt_MASQUERADE,ipt_TOS,ipt_REJECT,xt_state,ip_tabl es cpufreq_userspace 5408 0 cpufreq_stats 7744 0 freq_table 6048 1 cpufreq_stats cpufreq_powersave 2944 0 cpufreq_ondemand 8876 0 cpufreq_conservative 8712 0 video 17412 0 tc1100_wmi 8324 0 sbs 16676 0 sony_acpi 6412 0 pcc_acpi 14080 0 i2c_ec 6272 1 sbs hotkey 11556 0 dev_acpi 12164 0 button 7952 0 battery 11652 0 container 5632 0 ac 6788 0 asus_acpi 17688 0 sbp2 24968 0 lp 12964 0 3c59x 47912 0 mii 6912 1 3c59x msp3400 32928 0 saa7115 16400 0 tda9887 18320 0 tuner 54828 0 v4l2_common 17280 2 msp3400,tuner ivtv 199184 0 i2c_algo_bit 10376 1 ivtv v4l1_compat 15108 1 ivtv tveeprom 16144 1 ivtv videodev 10752 1 ivtv tsdev 9152 0 snd_mpu401 9640 0 snd_mpu401_uart 10240 1 snd_mpu401 nvidia_agp 9628 1 serio_raw 8452 0 snd_rawmidi 27136 1 snd_mpu401_uart snd_seq_device 9868 1 snd_rawmidi agpgart 35016 1 nvidia_agp i2c_nforce2 8192 0 i2c_core 23424 9 i2c_ec,msp3400,saa7115,tda9887,tuner,ivtv,i2c_algo_bit,tveeprom,i2c_nforce2 evdev 11392 1 snd_intel8x0 34844 1 snd_ac97_codec 97440 1 snd_intel8x0 snd_ac97_bus 3456 1 snd_ac97_codec snd_pcm_oss 47232 0 snd_mixer_oss 19328 1 snd_pcm_oss snd_pcm 84356 3 snd_intel8x0,snd_ac97_codec,snd_pcm_oss snd_timer 25348 1 snd_pcm snd 58116 12 snd_mpu401,snd_mpu401_uart,snd_rawmidi,snd_seq_device,snd_intel8x0,snd_ac97_codec,snd_pcm_oss,snd_mi xer_oss,snd_pcm,snd_timer soundcore 11232 1 snd snd_page_alloc 11528 2 snd_intel8x0,snd_pcm shpchp 42144 0 analog 12960 0 pci_hotplug 32828 1 shpchp psmouse 41352 0 pcspkr 4352 0 gameport 17032 1 analog floppy 62916 0 parport_pc 37796 1 parport 39368 2 lp,parport_pc ext3 142600 3 jbd 62100 1 ext3 ehci_hcd 35208 0 ohci1394 37168 0 ieee1394 305976 2 sbp2,ohci1394 forcedeth 32780 0 ohci_hcd 22788 0 usbcore 134656 5 usb_storage,libusual,ehci_hcd,ohci_hcd ide_generic 2432 0 ide_cd 33696 0 cdrom 38944 1 ide_cd ide_disk 18560 5 generic 6276 0 amd74xx 15132 0 [permanent] sata_nv 11268 0 libata 74764 1 sata_nv scsi_mod 144392 5 sg,sd_mod,usb_storage,sbp2,libata thermal 15624 0 processor 31560 1 thermal fan 6020 0 fbcon 41376 0 tileblit 3840 1 fbcon font 9344 1 fbcon bitblit 7296 1 fbcon softcursor 3328 1 bitblit vesafb 9244 0 capability 5896 0 commoncap 8704 1 capability Can I simply umount the drive then try and mount it as rw? root@dns1:/mnt# mount /dev/sda1 on /media/usbdisk type vfat (rw,nosuid,nodev,quiet,shortname=mixed,uid=1001,gid=1001,umask=077,iocharset=utf8) from cat: root@dns1:/mnt# cat /proc/bus/usb/devices T: Bus=03 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=480 MxCh= 8 B: Alloc= 0/800 us ( 0%), #Int= 0, #Iso= 0 D: Ver= 2.00 Cls=09(hub ) Sub=00 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=0000 ProdID=0000 Rev= 2.06 S: Manufacturer=Linux 2.6.17-11-server ehci_hcd S: Product=EHCI Host Controller S: SerialNumber=0000:00:02.2 C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr= 0mA I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub E: Ad=81(I) Atr=03(Int.) MxPS= 2 Ivl=256ms T: Bus=03 Lev=01 Prnt=01 Port=05 Cnt=01 Dev#= 26 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=0ea0 ProdID=2168 Rev= 2.00 S: Manufacturer=USB S: Product=Flash Disk C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=200mA I: If#= 0 Alt= 0 #EPs= 3 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=03(Int.) MxPS= 2 Ivl=125us T: Bus=02 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 4 B: Alloc= 0/900 us ( 0%), #Int= 0, #Iso= 0 D: Ver= 1.10 Cls=09(hub ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=0000 ProdID=0000 Rev= 2.06 S: Manufacturer=Linux 2.6.17-11-server ohci_hcd S: Product=OHCI Host Controller S: SerialNumber=0000:00:02.1 C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr= 0mA I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub E: Ad=81(I) Atr=03(Int.) MxPS= 2 Ivl=255ms T: Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 4 B: Alloc= 0/900 us ( 0%), #Int= 0, #Iso= 0 D: Ver= 1.10 Cls=09(hub ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=0000 ProdID=0000 Rev= 2.06 S: Manufacturer=Linux 2.6.17-11-server ohci_hcd S: Product=OHCI Host Controller S: SerialNumber=0000:00:02.0 C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr= 0mA I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub E: Ad=81(I) Atr=03(Int.) MxPS= 2 Ivl=255ms It is an inexpensive drive and yes this is the only one it seems to be happening with... TW, |
This is really strange. Everything I am seeing would lead me to believe it should work. Maybe your 'USB Flash Disk' (as it appears in proc) is some weird unsupported hardware in linux. Either that or it has some hidden lock keeping it as read-only.
What model/brand is this disk? My only other suggestion is to try it in other operating systems. Try it in a completely different linux distro. If you can try it in Windows. If it still does not work in other OSs then it is probably a broken drive. If you only get it to work in Windows there is a nice (free) HP USB disk formatting tool that can do the job for you. Edit: formatting |
If the pendrive has "U3 Smart" written on it anywhere you could try removing the U3 program. There are instructions on the internet.
|
It's a no name brand USB drive, only 125 meg. Since it doesn't have a physical lock on it I can only assume it's broken and I'll just move on.
The exercise was more in determining if I was doing something incorrectly and you guys taught me a thing or two, no loss on my end... Thanks for all the input. TW, |
you might try installing gparted and then using that program. It can give you the option to unmount and then format to the file system you like. then you can mount the drive again
|
formatting does not require you to mount the drive. Also, there is a live cd for gparted, so you don't have to install it if you want to use it. It is a mighty handy tool and I would recommend that every serious computer user have a gparted live cd in their tool set.
At any rate gparted won't do anything useful for formatting a USB stick that fdisk can't do. |
All times are GMT -5. The time now is 01:28 AM. |