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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
10-08-2005, 09:28 AM
|
#1
|
|
Member
Registered: Aug 2003
Location: Morio Cho
Distribution: debian sid
Posts: 124
Rep:
|
Formatting a usb drive
Hello.
I have a usb key I'd like to use.
So far it's been used on Windows (not by me), but it no longer works...
(don't know the details)
What I've tried is to erase all partitions and create a new one.
Unfortunately:
(parted) mkpartfs primary vfat 0% 100%
Error: Unable to open /dev/sda - unrecognised disk label.
What can I do to fix it?
Thanks
|
|
|
|
10-08-2005, 01:14 PM
|
#2
|
|
Senior Member
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,591
|
Many of these USB keys that I've seen aren't partitioned - they are like floppy disks. You can format the entire units as unpartitioned mountable space with:
mkdosfs -F 32 /dev/sda
If you want to partition the space, you can try wiping the device partition table with:
dd if=/dev/zero of=/dev/sda bs=512 count=10
You can also try another partitioning tool, like fdisk.
|
|
|
|
10-08-2005, 01:23 PM
|
#3
|
|
Member
Registered: Aug 2003
Location: Morio Cho
Distribution: debian sid
Posts: 124
Original Poster
Rep:
|
Thanks.
I've tried both, but each time:
# mount /mnt/usbkey/
mount: /dev/sda1 is not a valid block device
What should I check next?
|
|
|
|
10-08-2005, 01:34 PM
|
#4
|
|
Senior Member
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,591
|
If you format the entire drive unpartitioned, then you want to mount /dev/sda, not /dev/sda1 (there is no partition "1").
|
|
|
|
10-08-2005, 02:36 PM
|
#5
|
|
Member
Registered: Aug 2003
Location: Morio Cho
Distribution: debian sid
Posts: 124
Original Poster
Rep:
|
Thanks for the reply.
# mount -t vfat /dev/sda /mnt/usbkey/
mount: /dev/sda is not a block device (maybe try `-o loop'?)
# mount -t vfat -o loop /dev/sda /mnt/usbkey/
mount: wrong fs type, bad option, bad superblock on /dev/loop0,
missing codepage or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
# dmesg
...
FAT: bogus number of reserved sectors
VFS: Can't find a valid FAT filesystem on dev loop0.

Last edited by guldo; 10-08-2005 at 02:38 PM.
|
|
|
|
10-08-2005, 03:00 PM
|
#6
|
|
Senior Member
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,591
|
It's not a loopback device (a filesystem in a file), so you do not want to use the loop option.
What is the sequence of commands you issued to the device? If you wiped out the partition table with dd, then this is what I would expect.
Format, then mount:
mkdosfs -F 32 /dev/sda
mount -t vfat /dev/sda /mnt/usbkey/
|
|
|
|
10-08-2005, 04:38 PM
|
#7
|
|
Member
Registered: Aug 2003
Location: Morio Cho
Distribution: debian sid
Posts: 124
Original Poster
Rep:
|
(23:36:51)debian:~$ dd if=/dev/zero of=/dev/sda bs=512 count=10
10+0 records in
10+0 records out
5120 bytes transferred in 0.000736 seconds (6956872 bytes/sec)
(23:36:58)debian:~$ mkdosfs -F 32 /dev/sda
mkdosfs 2.11 (12 Mar 2005)
mkdosfs: Too few blocks for viable file system
(23:37:11)debian:~$ mount -t vfat /dev/sda /mnt/usbkey/
mount: /dev/sda is not a block device (maybe try `-o loop'?)
I'm puzzled...
|
|
|
|
10-08-2005, 04:50 PM
|
#8
|
|
Senior Member
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,591
|
Quote:
Originally posted by guldo
(23:36:58)debian:~$ mkdosfs -F 32 /dev/sda
mkdosfs 2.11 (12 Mar 2005)
mkdosfs: Too few blocks for viable file system
(23:37:11)debian:~$ mount -t vfat /dev/sda /mnt/usbkey/
mount: /dev/sda is not a block device (maybe try `-o loop'?)
I'm puzzled...
|
The format failed, so there is no use trying to mount. The device may be too small to support vfat, so you can try fat by just removing the "-F 32" option:
mkdosfs /dev/sda
|
|
|
|
10-08-2005, 06:10 PM
|
#9
|
|
Member
Registered: Aug 2003
Location: Morio Cho
Distribution: debian sid
Posts: 124
Original Poster
Rep:
|
Thanks for the hint 
Unfortunately:
(01:08:29)debian:guldo# mkdosfs /dev/sda
mkdosfs 2.11 (12 Mar 2005)
mkdosfs: Attempting to create a too large file system
(01:08:35)debian:guldo# mkdosfs -F 12 /dev/sda
mkdosfs 2.11 (12 Mar 2005)
mkdosfs: Attempting to create a too large file system
|
|
|
|
10-08-2005, 09:00 PM
|
#10
|
|
Senior Member
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,591
|
Then your device is broken - it's not indicating a valid size. You can try overriding the default detection by specifying the block count:
mkdosfs -F 32 /dev/sda <count>
where count is:
MB * 2048
For example, a 256MB unit would have a block count of:
256 * 2048 = 524288
|
|
|
|
10-09-2005, 05:32 AM
|
#11
|
|
Member
Registered: Aug 2003
Location: Morio Cho
Distribution: debian sid
Posts: 124
Original Poster
Rep:
|
Thank you.
What does the following mean?
(12:30:47)debian:~# mkdosfs -F 32 /dev/sda 524288
mkdosfs 2.11 (12 Mar 2005)
Warning: block count mismatch: found 5 but assuming 524288.
|
|
|
|
10-09-2005, 11:16 AM
|
#12
|
|
Senior Member
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,591
|
It means that your device reported that it has a capacity of 5 blocks (which is 2.5K) while you specified that it actually contains 524288 blocks (256MB). The device was formatted as if it had the larger capacity.
Unless you are running a broken kernel, the device is reporting a bogus capacity.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 01:34 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|