LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to format pendrive in FAT32 format (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-format-pendrive-in-fat32-format-698540/)

chrischristian 01-20-2009 02:28 AM

How to format pendrive in FAT32 format
 
Does any one know how to format pendrive in FAT 32 format in Debian, I tried Gparted but it have ext3, ext2 and swap format only .

Nylex 01-20-2009 02:31 AM

Use (c)fdisk to create the partitions and then mkfs to format them.

colucix 01-20-2009 03:07 AM

After running fdisk or cfdisk to create a partition as suggested by Nylex, you can use the mkfs.vfat command. Be careful to specify -F32 on the command line, otherwise you will end up with a FAT12 or a FAT16 filesytem. Here is an excerpt from man mkfs.vfat explaining this issue:
Code:

-F FAT-size
    Specifies the type of file allocation tables used (12, 16 or 32 bit).
    If nothing is specified, mkdosfs will automatically select between
    12 and 16 bit, whatever fits better for the file system size.
    32 bit FAT (FAT32 format) must (still) be selected explicitly
    if you want it.


chrischristian 01-20-2009 03:49 AM

Is not there graphic based more safe way to do this ?, one have to be very careful of will format wrong drive .

SqdnGuns 01-20-2009 03:54 AM

Quote:

Originally Posted by chrischristian (Post 3414788)
Is not there graphic based more safe way to do this ?, one have to be very careful of will format wrong drive .

Attention to detail, don't FEAR the CLI, it's your best friend.

colucix 01-20-2009 04:48 AM

Quote:

Originally Posted by chrischristian (Post 3414788)
Is not there graphic based more safe way to do this ?, one have to be very careful of will format wrong drive .

If your main concern is about partitioning you can always use gparted to partition the pen drive. Then go to the command line to run the mkfs.vfat command only.

About fdisk usage, don't be afraid. Just read a good tutorial about partitioning using fdisk (plenty of them online, but you can start from the official Partition HOWTO) then first check the list of drives using
Code:

# fdisk -l

Disk /dev/hdc: 122.9 GB, 122942324736 bytes
255 heads, 63 sectors/track, 14946 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start        End      Blocks  Id  System
/dev/hdc1  *          1          26      208813+  83  Linux
/dev/hdc2              27        392    2939895  83  Linux
/dev/hdc4            393      14946  116905005    f  W95 Ext'd (LBA)
/dev/hdc5            393        1667    10241406  83  Linux
/dev/hdc6            1668        1928    2096451  82  Linux swap / Solaris
/dev/hdc7            1929        2183    2048256  83  Linux
/dev/hdc8            2184        2221      305203+  83  Linux
/dev/hdc9            2222      14946  102213531  83  Linux

Disk /dev/sda: 2055 MB, 2055208960 bytes
255 heads, 63 sectors/track, 249 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *          1        250    2007008+  6  FAT16

This is an example of a list on my current machine with a 2Gb pen drive inserted. You can easily locate the name of the device looking at its size (highlighted in red in the example above). Then simply run the command
Code:

fdisk name_of_the_device
then type the relevant interactive commands to create a partition on that device. In my example above the command would have been fdisk /dev/sda. Most likely on your system /dev/sda is the main disk, so you will have the pen drive as /dev/sdb OR /dev/sdc and so on. If you double check the fdisk command line before pressing enter, you can safely proceed being sure the other drives rest untouched.

chrischristian 01-20-2009 06:13 AM

formating it to FAT32 gives "FAT32 is not supported by your system" when reinserted. So can I use ex2 will it work on any windos sys ? Why I always have one "lost+found" folder on pendrive ? it is of 1025MB (1GB) but it always show 49MB used ???

amani 01-20-2009 06:32 AM

1. gparted should be able to format it in fat32 (=vfat)

2. or use the parted magic cd

3. qtparted is another gui option

ext2 is more efficient on pendrives...esp if they are 'large'
and you want to put 'large' files in them

#man mkfs.ext2

amani 01-20-2009 06:32 AM

1. gparted should be able to format it in fat32 (=vfat)

2. or use the parted magic cd

3. qtparted is another gui option

ext2 is more efficient on pendrives...esp if they are 'large'
and you want to put 'large' files in them

#man mkfs.ext2

colucix 01-20-2009 07:04 AM

Quote:

Originally Posted by chrischristian (Post 3414875)
formating it to FAT32 gives "FAT32 is not supported by your system" when reinserted.

Which exact command line did you issued to format the pen drive to fat32? Also to be more helpful, let us see the output of fdisk -l with the pen drive inserted.
Quote:

So can I use ex2 will it work on any windos sys ? Why I always have one "lost+found" folder on pendrive ? it is of 1025MB (1GB) but it always show 49MB used ???
ext2 filesystem can be managed by windows if you have a ext2/ext3 tool installed. One of the most reliable is Ext2IFS and it has full plug-n-play functionality.

The lost+found directory is always created on a ext2/ext3 filesystem. It is the place where chunks of corrupted files are stored in order to rescue them. Regarding the used space, it is normal that the filesystem reserves some space for its functionality. The used space increases when the filesystem uses journaling: this is the default for ext3 formatting but can be explicitly set for ext2 as well.

chrischristian 01-20-2009 07:47 AM

O.K. that satisfies me , as far as FAT32 is concerned I'm not going to use it as Debian does'nt support it. Thanks for replies.

jmite 01-20-2009 07:56 AM

Just out of curiosity, where did we get the notion that Debian doesn't support Fat32? I used gparted to format my pendrive to Fat32, and it's readable in windows, mac, debian, ubuntu, gentoo...etc.

craigevil 01-20-2009 08:01 AM

FAT32 works just fine with any Linux.

There are actually many ways of formatting a USB flash drive in Linu

The quick 'n' easy way:

First establish what your stick is. It'll probably be sda1 - but check anyway by looking at the results of the following command (you need to be root to do this):

# fdisk -l

Assuming it is sda1, you'll need to unmount the flash disk, so:

# umount /dev/sda1

Once done, enter the following command to format the flash device to FAT32

# mkdosfs -F 32 -I /dev/sda1

Needless to say, you'll lose everything on the disk so be sure that sda1 really is the flash disk in question! Best switch off any external drives first, just to be sure!

USB Flash Memory HOWTO
http://tldp.org/HOWTO/html_single/Flash-Memory-HOWTO/


All times are GMT -5. The time now is 09:35 PM.