Linux - GeneralThis 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
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.
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: open SUSE 11.0, Fedora 7 and Mandriva 2007
Posts: 1,662
Rep:
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.
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.
Distribution: open SUSE 11.0, Fedora 7 and Mandriva 2007
Posts: 1,662
Original Poster
Rep:
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]#
Distribution: open SUSE 11.0, Fedora 7 and Mandriva 2007
Posts: 1,662
Original Poster
Rep:
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]
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.