Format partition as FAT32

mkdosfs -F 32 /dev/sda1

-1
By: dudko
2011-06-07 11:20:27

These Might Interest You

  • With this command you can create an empty NTFS partition. The command is useful if, for example, we want to format a previous installation of Windows and reinstall before you want to restore some files on the partition.


    -3
    mkntfs /dev/hda1
    0disse0 · 2011-07-02 17:43:16 0
  • this work even if a partition table exist


    -3
    echo -e "o\nn\np\n1\n\n\nw\n" | fdisk /dev/sdX
    bunam · 2012-04-05 13:04:40 0
  • You can convert a FAT or FAT32 volume to an NTFS volume without formatting the drive, though it is still a good idea to back up your data before you convert.


    -1
    CONVERT D: /FS:NTFS
    starchox · 2009-02-18 05:56:07 0
  • Suppose you made a backup of your hard disk with dd: dd if=/dev/sda of=/mnt/disk/backup.img This command enables you to mount a partition from inside this image, so you can access your files directly. Substitute PARTITION=1 with the number of the partition you want to mount (returned from sfdisk -d yourfile.img). Show Sample Output


    6
    INFILE=/path/to/your/backup.img; MOUNTPT=/mnt/foo; PARTITION=1; mount "$INFILE" "$MOUNTPT" -o loop,offset=$[ `/sbin/sfdisk -d "$INFILE" | grep "start=" | head -n $PARTITION | tail -n1 | sed 's/.*start=[ ]*//' | sed 's/,.*//'` * 512 ]
    Alanceil · 2009-03-06 21:29:13 3

What Others Think

I think mkfs.vfat does this by default. On my system that's a symlink to mkdosfs, so I'm not sure if mkdosfs has some magic that makes it default to FAT32 when called as mkfs.vfat, or whether mkdosfs also defaults to FAT32. Anyway, your command forces FAT32, which might be good if mkdosfs normally formats smaller disks as FAT16.
thetrivialstuff · 367 weeks and 1 day ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: