LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-11-2009, 11:04 AM   #1
Gins
Senior Member
 
Registered: Jul 2004
Location: Germany
Distribution: open SUSE 11.0, Fedora 7 and Mandriva 2007
Posts: 1,662

Rep: Reputation: 47
Formatting a USB module


I am struggling to format a USB module using Mandriva 2009.

When I insert a USB module, the system in Mandriva recognizes it as 'sdc'.

I created a folder called 'usbflash' inside the /mnt folder. This will help me to mount, unmount and format USB modules.

Code:
[root@localhost ni]# cd /mnt
[root@localhost mnt]# ls
usbflash/ 
 win_c/  
win_c2/  
win_d/
[root@localhost mnt]#

Code:
[root@localhost ~]# fdisk -l
Disk /dev/sda: 250.0 GB, 250059350016 bytes

Disk /dev/sdb: 500.1 GB, 500107862016 bytes

Disk /dev/sdc: 416 MB, 416328704 bytes
13 heads, 62 sectors/track, 1008 cylinders
Units = cylinders of 806 * 512 = 412672 bytes
Disk identifier: 0x73696420
Code:
[root@localhost ~]# mkfs -t ext3 /mnt/usbflash
mke2fs 1.41.2 (02-Oct-2008)
/mnt/usbflash is not a block special device.
Proceed anyway? (y,n)
I selected yes and got the following error message:
mkfs.ext3: Device size reported to be zero. Invalid partition specified, or partition table wasn't reread after running fdisk, due to
a modified partition being busy and in use. You may need to reboot
to re-read your partition table.

What is the meaning of the above error message?
I know the existence of character special and block special in UNIX files.

How do I format a USB module?

I think the command 'mkfs -t ext3 /mnt/usbflash' is correct

Why did I get the above strange message?

Please help me to format a USB module.

The module I want to format has some data from a Windows based program. I don't need those data.

Last edited by Gins; 01-11-2009 at 11:08 AM.
 
Old 01-11-2009, 11:30 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
I think you cannot specify a device using its mount point in the mkfs command. You have to type the name of the block device /dev/something in the command line.

Moreover, the output of fdisk -l (if not cutted) shows there is no partition on the disk. So you may want first create a partition using fdisk (it will be named /dev/hdc1) then run the mkfs command on /dev/sdc1.

In addition, you should have the mkfs.ext3 command on your system, which is a sort of alias for mkfs that set the proper options for you.
 
Old 01-11-2009, 12:53 PM   #3
Gins
Senior Member
 
Registered: Jul 2004
Location: Germany
Distribution: open SUSE 11.0, Fedora 7 and Mandriva 2007
Posts: 1,662

Original Poster
Rep: Reputation: 47
Thanks colucix.

I did what you thought though I didn't post it.
Here I am posting it.

Code:
[root@localhost ni]# mkfs -t ext3 /mnt/sdc
mke2fs 1.41.2 (02-Oct-2008)
Could not stat /mnt/sdc --- No such file or directory

The device apparently does not exist; did you specify it correctly?
[root@localhost ni]#
Code:
[root@localhost ni]# mkfs -t ext3 /mnt/sdc1
mke2fs 1.41.2 (02-Oct-2008)
Could not stat /mnt/sdc1 --- No such file or directory

The device apparently does not exist; did you specify it correctly?
[root@localhost ni]#
 
Old 01-11-2009, 12:58 PM   #4
Gins
Senior Member
 
Registered: Jul 2004
Location: Germany
Distribution: open SUSE 11.0, Fedora 7 and Mandriva 2007
Posts: 1,662

Original Poster
Rep: Reputation: 47
The following is the description of the drives and partitions.


Code:
[root@localhost ni]# fdisk -l                                

Disk /dev/sda: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x24312430                     

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               2       26912   216162607+   5  Extended
/dev/sda2   *       26913       30402    28025856    7  HPFS/NTFS
/dev/sda5               2        8955    71922973+  83  Linux    
/dev/sda6            8956       18034    72927036   83  Linux    
/dev/sda7           18035       26912    71312503+  83  Linux    

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xdd98dd98                     

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1       13057   104880321    7  HPFS/NTFS
/dev/sdb2           13058       22724    77650177+   7  HPFS/NTFS
/dev/sdb3           22725       31836    73192140   83  Linux    
/dev/sdb4           31837       59748   224203140    5  Extended 
/dev/sdb5           40791       49744    71922973+  83  Linux    
/dev/sdb6           49745       58698    71922973+  83  Linux    
/dev/sdb7           58699       59748     8434093+  82  Linux swap / Solaris
/dev/sdb8           31837       40790    71922942   83  Linux               

Partition table entries are not in disk order

Disk /dev/sdc: 416 MB, 416328704 bytes
13 heads, 62 sectors/track, 1008 cylinders
Units = cylinders of 806 * 512 = 412672 bytes
Disk identifier: 0x73696420                  

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

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   ?     2382074     3057554   272218546+  20  Unknown
Partition 1 has different physical/logical beginnings (non-Linux?):
     phys=(356, 97, 46) logical=(2382073, 1, 59)                   
Partition 1 has different physical/logical endings:                
     phys=(357, 116, 40) logical=(3057553, 5, 23)
Partition 1 does not end on cylinder boundary.
/dev/sdc2   ?     1650353     2319058   269488144   6b  Unknown
Partition 2 has different physical/logical beginnings (non-Linux?):
     phys=(288, 110, 57) logical=(1650352, 7, 57)
Partition 2 has different physical/logical endings:
     phys=(269, 101, 57) logical=(2319057, 8, 52)
Partition 2 does not end on cylinder boundary.
/dev/sdc3   ?      668722     2403663   699181456   53  OnTrack DM6 Aux3
Partition 3 has different physical/logical beginnings (non-Linux?):
     phys=(345, 32, 19) logical=(668721, 4, 18)
Partition 3 has different physical/logical endings:
     phys=(324, 77, 19) logical=(2403662, 11, 49)
Partition 3 does not end on cylinder boundary.
/dev/sdc4   *     1730308     1730334       10668+  49  Unknown
Partition 4 has different physical/logical beginnings (non-Linux?):
     phys=(87, 1, 0) logical=(1730307, 3, 36)
Partition 4 has different physical/logical endings:
     phys=(335, 78, 2) logical=(1730333, 9, 44)
Partition 4 does not end on cylinder boundary.

Partition table entries are not in disk order
[root@localhost ni]
 
Old 01-11-2009, 03:30 PM   #5
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Looking at the output of fdisk -l, it looks like the partition scheme on /dev/sdc is completely messed up. Can you confirm /dev/sdc is the device you want to format? It appears to be of size 416 MB, is it a USB pen drive (or memory stick as you may want to call it)?

Ok. These are the steps:

1) you have to delete the existing partitions on /dev/sdc, since I guess you don't need 4 partitions on a half Gigabyte device, don't you?

2) you have to create a single partition spanning all the volume size. You will end up with /dev/sdc1 only.

3) Format the newly created partition using
Code:
mkfs.ext3 /dev/sdc1
note that to specify the block device you have to type the device name on the command line, that is /dev/sdc1 (not the mount point or anything else, like in your last example where you put /mnt/sdc). The name of a block device is always /dev/something (look at the content of the /dev directory to see how many block, character and special devices you have on your system)!

To accomplish the first two tasks in the list above I suggest the fdisk command, since it is the tool you have at hand. If you're not used to this command I suggest to read a good tutorial and the fdisk's man page before trying anything. Otherwise you can try a graphical front-end like gparted. In any case, be sure to not touch your other existing devices, /dev/sda and /dev/sdb.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
formatting a usb pen in fat32 khronosschoty Slackware 10 11-29-2008 10:54 AM
external USB formatting and USB version apachenew Linux - Hardware 5 09-19-2007 06:49 PM
usb - traveldrive - formatting - automount - Help !!! nomb Linux - Hardware 3 08-07-2006 11:34 PM
formatting USB to FAT filesystem today53 Linux - Newbie 1 06-21-2006 05:33 AM
Formatting a usb drive guldo Linux - Hardware 11 10-09-2005 11:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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