LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > General
User Name
Password
General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!

Notices


Reply
  Search this Thread
Old 12-27-2007, 07:57 AM   #1
kris.c
Member
 
Registered: May 2007
Posts: 30

Rep: Reputation: 15
Problem with a pen-drive


Hope I am posting in the right place.
I have a pen-drive which was working,normally until recently. I must have pulled it out mistakenly when it was still active(I was working on windows). Linux seems to detect it and allows me to view and edit the files. However, on windows, I get the following error as soon as I insert the drive :
" There is no disk in drive. Please insert a disk into drive \Device\Harddisk1\DR7".
Also, windows does not even allow me to format this volume. Does linux have a tool that can be used to format this drive? Or, Is there some other way to make the drive work?
 
Old 12-27-2007, 10:42 AM   #2
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by kris.c View Post
Does linux have a tool that can be used to format this drive? Or, Is there some other way to make the drive work?
Look at the output of "dmesg" to see what device your drive uses (e.g. /dev/sdc). Then you can format the partition using mkfs.vfat. The syntax will look like
# mkfs.vfat -v /dev/sdc1
If you do not have mkfs.vfat, try mkdosfs.
 
Old 12-27-2007, 10:54 PM   #3
kris.c
Member
 
Registered: May 2007
Posts: 30

Original Poster
Rep: Reputation: 15
Hi,
This is the output of "dmesg"
Code:
usb-storage: device scan complete
scsi 0:0:0:0: Attached scsi generic sg0 type 0
SCSI device sda: 1974271 512-byte hdwr sectors (1011 MB)
sda: Write Protect is off
sda: Mode Sense: 00 00 00 00
sda: assuming drive cache: write through
SCSI device sda: 1974271 512-byte hdwr sectors (1011 MB)
sda: Write Protect is off
sda: Mode Sense: 00 00 00 00
sda: assuming drive cache: write through
 sda: unknown partition table
sd 0:0:0:0: Attached scsi removable disk sda
SELinux: initialized (dev sda, type vfat), uses genfs_contexts
I tried out the two commands that you were talking about,
Code:
[root@zeus ~]# mkfs.vfat -v /dev/sda
mkfs.vfat 2.11 (12 Mar 2005)
mkfs.vfat: /dev/sda contains a mounted file system.
[root@zeus ~]# mkdosfs /dev/sda
mkdosfs 2.11 (12 Mar 2005)
mkdosfs: /dev/sda contains a mounted file system.
The drive doesnt appear to be formatted yet.Have I missed something?
 
Old 12-27-2007, 11:54 PM   #4
AceofSpades19
Senior Member
 
Registered: Feb 2007
Location: Chilliwack,BC.Canada
Distribution: Slackware64 -current
Posts: 2,079

Rep: Reputation: 58
you need to umount it before you can fsck it
 
Old 12-29-2007, 01:57 AM   #5
kris.c
Member
 
Registered: May 2007
Posts: 30

Original Poster
Rep: Reputation: 15
Yeah, i un-mounted the drive and tried it again. :
Code:
mkfs.vfat -v /dev/sda
mkfs.vfat 2.11 (12 Mar 2005)
mkfs.vfat: Will not try to make filesystem on full-disk device '/dev/sda' (use -I if wanted)
[root@zeus ~]# mkdosfs /dev/sda
mkdosfs 2.11 (12 Mar 2005)
mkdosfs: Will not try to make filesystem on full-disk device '/dev/sda' (use -I if wanted)
Also. what is the -I option it is talking about? I checked the man pages, i didnt seem to find the -I option.
 
Old 12-29-2007, 06:31 AM   #6
makuyl
Senior Member
 
Registered: Dec 2004
Location: Helsinki
Distribution: Debian Sid
Posts: 1,107

Rep: Reputation: 54
From "man mkdosfs":
Code:
-I     Normally  you  are  not allowed to use any 'full' fixed disk devices.  mkdosfs will complain and tell you that it
       refuses to work.  This is different when using MO disks.  One doesn't always need partitions on MO disks.  The file
       system can go directly to the whole disk.   Under other OSes this is known as the 'superfloppy' format.
       This switch will force mkdosfs to work properly.
Either use "-I" or make a partition on the drive.
 
Old 12-29-2007, 09:49 AM   #7
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by kris.c View Post
Code:
usb-storage: device scan complete
scsi 0:0:0:0: Attached scsi generic sg0 type 0
SCSI device sda: 1974271 512-byte hdwr sectors (1011 MB)
sda: Write Protect is off
sda: Mode Sense: 00 00 00 00
sda: assuming drive cache: write through
SCSI device sda: 1974271 512-byte hdwr sectors (1011 MB)
sda: Write Protect is off
sda: Mode Sense: 00 00 00 00
sda: assuming drive cache: write through
 sda: unknown partition table
sd 0:0:0:0: Attached scsi removable disk sda
SELinux: initialized (dev sda, type vfat), uses genfs_contexts
This indicates that your USB drive is "/dev/sda".

Quote:
Originally Posted by kris.c View Post
Code:
[root@zeus ~]# mkfs.vfat -v /dev/sda
mkfs.vfat 2.11 (12 Mar 2005)
mkfs.vfat: /dev/sda contains a mounted file system.
[root@zeus ~]# mkdosfs /dev/sda
mkdosfs 2.11 (12 Mar 2005)
mkdosfs: /dev/sda contains a mounted file system.
I can see that you figured out how to unmount it from previous posts.

Along with "/dev/sda", you should also have "/dev/sda1". That is the first partition on the thumb drive. 99.99% of thumb drives only have one partition.

To format it, use "mkfs.vfat -v /dev/sda1". As another poster mentioned, typically you cannot create a file system without a partition. I do not recommend using the "superfloppy" method as it is not as portable a format as plain old partition tables.

If it is too late, and you have already trashed your partition table, you can always learn how to use fdisk.

Code:
# fdisk /dev/sda

The number of cylinders for this disk is set to 14593.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help):
Press "p" to see a list of partitions (which may be empty). Press "n" to add a partition. You will want to add a "primary" partition by pressing "p" again. You want to use the first table entry by pressing "1". Change the type using "t" to "c" for FAT32. Save your changes by pressing "w".

The above instructions leave out some steps, but they explain the parts that you would probably have the most questions about.
 
Old 12-29-2007, 10:47 PM   #8
kris.c
Member
 
Registered: May 2007
Posts: 30

Original Poster
Rep: Reputation: 15
It still doesnt seem to format it. I have un-mounted it and have used the mkdosfs with the -I option and this is what I get :
Code:
[root@zeus media]# mkfs.vfat -I -v /dev/sda
mkfs.vfat 2.11 (12 Mar 2005)
Auto-selecting FAT32 for large filesystem
/dev/sda has 32 heads and 61 sectors per track,
logical sector size is 512,
using 0xf8 media descriptor, with 1974270 sectors;
file system has 2 32-bit FATs and 8 sectors per cluster.
FAT size is 1925 sectors, and provides 246298 clusters.
Volume ID is 4777b186, no volume label.


[root@zeus media]# mkfs.vfat -I -v /dev/sda1
mkfs.vfat 2.11 (12 Mar 2005)
/dev/sda1: No such file or directory
Coming to fdisk, even after executing the previous command, I get the following output when i use "p";
Code:
[root@zeus media]#fdisk /dev/sda1
Unable to open /dev/sda1

[root@zeus media]#fdisk /dev/sda
Command (m for help): p

Disk /dev/sda: 1010 MB, 1010826752 bytes
32 heads, 61 sectors/track, 1011 cylinders
Units = cylinders of 1952 * 512 = 999424 bytes

This doesn't look like a partition table
Probably you selected the wrong device.

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   ?      398636      983425   570754815+  72  Unknown
Partition 1 has different physical/logical beginnings (non-Linux?):
     phys=(357, 116, 40) logical=(398635, 6, 23)
Partition 1 has different physical/logical endings:
     phys=(357, 32, 45) logical=(983424, 30, 61)
Partition 1 does not end on cylinder boundary.
/dev/sda2   ?       86419     1078237   968014120   65  Novell Netware 386
Partition 2 has different physical/logical beginnings (non-Linux?):
     phys=(288, 115, 43) logical=(86418, 26, 1)
Partition 2 has different physical/logical endings:
     phys=(367, 114, 50) logical=(1078236, 17, 53)
Partition 2 does not end on cylinder boundary.
/dev/sda3   ?      957932     1949749   968014096   79  Unknown
Partition 3 has different physical/logical beginnings (non-Linux?):
     phys=(366, 32, 33) logical=(957931, 2, 32)
Partition 3 has different physical/logical endings:
     phys=(357, 32, 43) logical=(1949748, 25, 36)
Partition 3 does not end on cylinder boundary.
/dev/sda4   ?     1478321     1478349       27749+   d  Unknown
Partition 4 has different physical/logical beginnings (non-Linux?):
     phys=(372, 97, 50) logical=(1478320, 8, 25)
Partition 4 has different physical/logical endings:
     phys=(0, 10, 0) logical=(1478348, 22, 13)
Partition 4 does not end on cylinder boundary.

Partition table entries are not in disk order
I tried manually deleting the partitions using "d" and creating a new one using "n" and finally using "w" to write the changes onto the disk, however on re-plugging the drive, i still get the above output when I use "p". The changes dont seem to have been written onto the disk.
 
Old 12-30-2007, 02:00 PM   #9
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by kris.c View Post
[root@zeus media]# mkfs.vfat -I -v /dev/sda1
mkfs.vfat 2.11 (12 Mar 2005)
/dev/sda1: No such file or directory
[/code]
Leave out the "-I" here. And do this _after_ you have created the partition.

Quote:
Originally Posted by kris.c View Post
Coming to fdisk, even after executing the previous command, I get the following output when i use "p";
You destroyed the partition table by using "mkfs.vfat -I -v /dev/sda". Run "dd if=/dev/zero of=/dev/sda bs=512 count=1" to zero it out. Then run "fdisk /dev/sda".
 
  


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
pen drive problem nirmaltom General 11 02-03-2008 05:00 AM
pen drive problem ksravi08 Linux - Software 2 12-21-2007 08:26 AM
problem mounting USB pen drive Gogul VectorLinux 2 04-25-2006 03:42 AM
USB pen drive problem Superboer12 Linux - Hardware 1 08-07-2003 02:36 PM
problem with usb pen drive dryhte Slackware 3 05-20-2003 01:29 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > General

All times are GMT -5. The time now is 10:38 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