How-to format a pendrive or a USB-HD

First list all available devices and search you pendrive or hdd case (ex.: /dev/sdb1)

user@host:~# sudo fdisk -l

Then format the device with FAT32 file system:

user@host:~# sudo mkfs.vfat -c -v /dev/sdb1

Finally, rename the device (ex.: KINGSTON):

user@host:~# sudo mlabel -i /dev/sdb1 ::KINGSTON

You can experience the following error when renaming the device:

Total number of sectors (7850928) not a multiple of sectors per track (62)!
Add mtools_skip_check=1 to your .mtoolsrc file to skip this test

If you got this error, turn on the skip check flag and then try to rename it again:

user@host:~# sudo echo mtools_skip_check=1 >> ~/.mtoolsrc
user@host:~# sudo mlabel -i /dev/sdb1 ::KINGSTON

If you need to write files larger than 4GB you should not format it as FAT32. NTFS and EXT3 are some alternatives. EXT3 is EXT2 with journaling (a log managed by operating system to fail recovery). For format is as EXT3 you can use mke2fs. Since FAT32 does not provide permission, after format as EXT3 you should define it.

user@host:~# sudo mke2fs -j /dev/sdb1
user@host:~# sudo chmod 777 /media/usb-pen

See ya

Leave a Reply

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

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

Google photo

You are commenting using your Google 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: