How to format pendrive or Memorycard or USB in ubuntu by Terminal

Hi…all today ..i tried to to format by pendrive by our file manager. But sometimes it fails to format.So we have to format it by terminal.

After plugging your device(usb or pendrive or memory card).

Open Terminal(cntrl +Alt + T)

type the command as $ dmesg | Tail

it will display like this

[ 1749.108796] sd 9:0:0:0: [sdb] Write Protect is off
[ 1749.108813] sd 9:0:0:0: [sdb] Mode Sense: 43 00 00 00
[ 1749.109803] sd 9:0:0:0: [sdb] No Caching mode page present
[ 1749.109816] sd 9:0:0:0: [sdb] Assuming drive cache: write through
[ 1749.116895] sd 9:0:0:0: [sdb] No Caching mode page present
[ 1749.116906] sd 9:0:0:0: [sdb] Assuming drive cache: write through
[ 1749.118911]  sdb: sdb1    –> Things to be noted
[ 1749.122785] sd 9:0:0:0: [sdb] No Caching mode page present
[ 1749.122800] sd 9:0:0:0: [sdb] Assuming drive cache: write through
[ 1749.123771] sd 9:0:0:0: [sdb] Attached SCSI removable disk

Then Unmount your device by

$ sudo umount /dev/sdb1

Finally Enter this command to format Your device

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

Thats it….Now plug out your device and plug in again to use . Your device is now formatted and ready to use now..

Happy coding!!!!

Author: Balaji

Hi..My name is Balaji and i am working as a Senior Software Developer in India. I am interested in Shell scripts, python, erlang , linux kernel .

16 thoughts on “How to format pendrive or Memorycard or USB in ubuntu by Terminal”

  1. Ηmm it appeas like your ωebsite ate my first comment (it was extгemely long)
    so I guess I’ll just sum іt up what I had wгitten and say,
    I’m thoroughly enjoying your blog. I too am an аspiring blog blogger but I’m
    ѕtill new to thе whole thing. Do you have any helpful hints
    for beginner blog writers? I’d genuinelу apprеciate it.

    1. Thanks …i don’t have that much experience in blog writing …But i would say this. whenever i write a post ,i consider this only that “I am explaining this to other who doesn’t know about this “. If you like this means follow it …..

  2. i am unable to format.every time it writes ‘no such drives were found’.found’after entering last command

  3. ubuntu@ubuntu-linux:~$ dmesg|tail
    [ 4573.320755] scsi76 : usb-storage 2-3:1.5
    [ 4573.321692] scsi77 : usb-storage 2-3:1.6
    [ 4574.321794] scsi 76:0:0:0: CD-ROM HUAWEI Mass Storage 2.31 PQ: 0 ANSI: 2
    [ 4574.323233] scsi 77:0:0:0: Direct-Access HUAWEI SD Storage 2.31 PQ: 0 ANSI: 2
    [ 4574.331557] sr1: scsi-1 drive
    [ 4574.332404] sr 76:0:0:0: Attached scsi CD-ROM sr1
    [ 4574.332824] sr 76:0:0:0: Attached scsi generic sg2 type 5
    [ 4574.336100] sd 77:0:0:0: Attached scsi generic sg3 type 0
    [ 4574.339363] sd 77:0:0:0: [sdb] Attached SCSI removable disk
    [ 4592.733008] type=1701 audit(1408887675.171:46): auid=4294967295 uid=1000 gid=119 ses=4294967295 pid=16868 comm=”chrome” reason=”seccomp” sig=0 syscall=20 ip=0xb336b424 code=0x50001
    ubuntu@ubuntu-linux:~$ sudo umount /dev/sdb1
    [sudo] password for ubuntu:
    umount: /dev/sdb1: not found
    ubuntu@ubuntu-linux:~$

    1. It looks like ..the device name is not correct . check ur device name in that command. i couldn’t see ur device name in this ..
      it’s not always /dev/sdb1 .. It varies .. check that properly.

  4. ubuntu@ubuntu-linux:~$ dmesg|tail
    [ 5133.904005] cdc_ether 2-1:1.1: wwan0: unregister ‘cdc_ether’ usb-0000:00:1d.7-1, Mobile Broadband Network Device
    [ 5133.947259] option1 ttyUSB1: GSM modem (1-port) converter now disconnected from ttyUSB1
    [ 5133.947315] option 2-1:1.3: device disconnected
    [ 5133.947655] option1 ttyUSB2: GSM modem (1-port) converter now disconnected from ttyUSB2
    [ 5133.947699] option 2-1:1.4: device disconnected
    [ 5147.224068] usb 2-1: new high-speed USB device number 32 using ehci_hcd
    [ 5147.360301] scsi96 : usb-storage 2-1:1.0
    [ 5148.361102] scsi 96:0:0:0: Direct-Access Generic Flash-Disk 1.05 PQ: 0 ANSI: 2
    [ 5148.363316] sd 96:0:0:0: Attached scsi generic sg2 type 0
    [ 5148.570937] sd 96:0:0:0: [sdb] Attached SCSI removable disk
    ubuntu@ubuntu-linux:~$ sudo umount /dev/sdb1
    [sudo] password for ubuntu:
    umount: /dev/sdb1: not found
    ubuntu@ubuntu-linux:~$

  5. error synchronizing after initial wipe timed out waiting for object(udisks-error-quark,0)
    I am getting this error while formating my SC card inserted through modem to the computer..plz suggest me a solution…i can read and write the data present in the card but not able to format it

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: