Format your pendrive / memory card from terminal


As I needed the same and I thought to share it too so that it can be useful to others. Its very quick now to format your pendrive / memory card in ubuntu through terminal.

First of all you need to know the name of your pendrive / memory card and the location they are mounted on.

Just type this command in the terninal.

 dmesg | tail

Test@Testing:~$ dmesg | tail
[ 85.526761] audit_printk_skb: 39 callbacks suppressed
[ 85.526765] type=1701 audit(1348983052.085:25): auid=4294967295 uid=1000 gid=1000 ses=4294967295 pid=2221 comm=”chrome” reason=”seccomp” sig=0 syscall=20 ip=0xaa7416 code=0x50001
[ 102.219536] init: plymouth-stop pre-start process (2535) terminated with status 1
[ 626.271412] sd 10:0:0:0: [sdb] 3862528 512-byte logical blocks: (1.97 GB/1.84 GiB)
[ 626.277713] sd 10:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn’t support DPO or FUA
[ 626.296023] sdb: sdb1

Here sdb1 is the name of your pendrive / memory card.

Now next is to unmount this to begin our format process. so to do that just execute this command

sudo umount /dev/sdb1

you will need to enter your password here.

There are other options available you can choose according to your need . like:

mkfs, mkfs.cramfs, mkfs.ext3, mkfs.ext4dev, mkfs.msdos, mkfs.vfat,mkfs.bfs, mkfs.ext2, mkfs.ext4, mkfs.minix, mkfs.ntfs

Now enter the following command to format your pen drive with FAT32 partition.

sudo mkfs.vfat -n ‘Ubuntu’ -I /dev/sdb1

And your pendrive is ready too use !