One Day One Cmd

Place for playing with commands…

Day 68: $ Format Your USB stick to ext4 or FAT32

ODOC: Formatting Your pendrive or USB to Ext4 or FAT32 in 2 simple commands. 1. Identify your device path using fdisk -l command.

Ex:
root@bala-desktop:~# fdisk -l

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xb9e8b9e8

 Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        3060    24579418+   7  HPFS/NTFS
/dev/sda2            3061       19456   131700839+   f  W95 Ext'd (LBA)
/dev/sda5            3061        8159    40957686    7  HPFS/NTFS
/dev/sda6            8160       11346    25599546    7  HPFS/NTFS
/dev/sda7           13259       19456    49785403+   7  HPFS/NTFS
/dev/sda8           11347       11596     1999872   82  Linux swap / Solaris
/dev/sda9           11596       13258    13356032   83  Linux

Partition table entries are not in disk order

Disk /dev/sdb: 4016 MB, 4016046080 bytes
124 heads, 62 sectors/track, 1020 cylinders
Units = cylinders of 7688 * 512 = 3936256 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

 Device Boot      Start         End      Blocks   Id  System

You can Identify your device with the help of your USB’s Size. Here my pendrive is memory of 4.GB note that device path for mine it is /dev/sdb. Unmount your device before proceeding this you done it by the following command.

root@bala-desktop:~# umount /media/KRISH/

2. Syntax for the command mkfs.ext4 -n “<label>” -I <device_path>
Type the following command to format as Ext4:

root@bala-desktop:~# mkfs.ext4 -n "Tux" -I /dev/sdb

Type the following command to format as fat32:

root@bala-desktop:~# mkfs.vfat -n "Tux" -I /dev/sdb

With Regards,
V.BalaKrishnan.

Advertisements

2 responses to “Day 68: $ Format Your USB stick to ext4 or FAT32

  1. ne0 April 22, 2011 at 4:17 pm

    I wonder how to make an USB with 2 partitions with 2 type of file system: ext4 and NTFS?
    ext4: a bootable Ubuntu
    NTFS: data
    I have this one and it works good in my Ubuntu, but it can not work with Windows.
    How can I figure it?

  2. gnubala April 25, 2011 at 2:21 am

    Hi,

    Ext2Read is an explorer like utility to explore ext2/ext3/ext4 files. But i haven’t tried it myself.

    I found one link may be it is useful to you, Here it is…

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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: