Make Bootable USB stick to act as Storage device again

To make a bootable USB stick to acts as a storage device once again, we will have to use the fdisk command line utility. fdisk command line utility can be used to make modifications in our partition table. Through fdisk utility, we can create, delete, list, print, toggle a bootable flag and many other related operations on our partition table. Furthermore, utility supports GPT, SGI (IRIX), DOS and SUN partition tables.

To make any modification through fdisk command line utility, we need to have superuser privileges. If you don’t have one then contact your system administrator for assistance.

Make changes to the Partition table

Identify you USB device with the help of lsblk command.

lsblk -p

Output may resemble –

/dev/sda 8:0 0 465.8G 0 disk 
├─/dev/sda1 8:1 0 512M 0 part /boot/efi
├─/dev/sda2 8:2 0 4.7G 0 part 
└─/dev/sda3 8:5 0 414.6G 0 part /
/dev/sdc 8:32 1 7.2G 0 disk 
└─/dev/sdc1 8:33 1 1.8G 0 part /media/<username>/UUID-Device
/dev/sr0 11:0 1 1024M 0 rom

The naming scheme for disk devices is /dev/sdX, where X can be a,b,c, etc. It is order in which our disk device was found. It may be different for your USB device, in our case it is /dev/sdc. Furthermore, /dev/sdc1 (of our .iso file size i.e. 1.8G) is the partition already present on our USB stick. The rest of the space i.e. 5.4G is available on our USB stick as free space.

So, in order to make our USB stick as a storage device we have to delete the /dev/sdc1 partition first. Thereafter, we will be utilizing the free space i.e. 7.2G to create a new partition through fdisk command line utility.

Thus, to make modifications through fdisk command line utility, run the following in terminal –

sudo fdisk /dev/sdc

You can press m for help or more options. Press p to print the partition table –

Command (m for help): p

it may return –

Device Boot Start End Sectors Size Id Type
/dev/sdc1 2048 3737599 3735552 1.8G 83 Linux

To delete the partition, press d

command (m for help): d

it will automatically delete the partition if your partition table contains just one partition. Otherwise, enter the partitions number. The output may resemble –

Selected partition 1
Partition 1 has been deleted.

Now, the free space of size 7.2G (may depend on storage size of your USB stick) is available to us. To create a new partition on available free space, use the option n

Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 
First sector (2048-15138815, default 2048): 
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-15138815, default 15138815):

Created a new partition 1 of type 'Linux' and of size 7.2 GiB.

If you want multiple partitions for your USB stick, choose the appropriate options on prompt. Otherwise, default options can be chosen. We just pressed enter when asked for choices. The final outcome is – the fdisk utility has created a new partition of size 7.2GB of type ‘Linux’.

Next, we have to write changes to our partition table. Use the w option accordingly.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

So, far we have created a new partition of size 7.2G which can be verified by lsblk command.

lsblk -p

Output –

/dev/sdc 8:32 1 7.2G 0 disk 
└─/dev/sdc1 8:33 1 7.2G 0 part

Format your Partition /dev/sdc1

Now, to use USB stick as a storage device we will have to format the /dev/sdc1 partition. This can be achieved through mkfs.vfat command line utility. If you want to format it to other types – read the man pages of mkfs command line utility.

 man mkfs

To format the /dev/sdc1 as FAT32 run the following –

sudo mkfs.vfat -F 32 /dev/sdc1

Lastly, use the command partprobe to inform the Operating system for the partition tables changes we just did.

# sudo partprobe

In conclusion, we have made our bootable USB stick to act as storage device through fdisk command line utility.

Similar Posts