How to format hard drive using command line on Lubuntu

On previous article i post about formatting hard drive using tool called 'disks' (gnome disk utility) which is a graphical based too... thumbnail 1 summary

On previous article i post about formatting hard drive using tool called 'disks' (gnome disk utility) which is a graphical based tool (GUI), in this article i will show you how to format hard drive using command line.

For people who love using command line, you want everything to be done with command line, including formatting a hard drive, usb stick, sd card, etc.

To format hard drive using command line you can use tool called mkfs, it's already there on your lubuntu installation, so no need to install, you can use it right away.

There are few steps you need to do before running the mkfs command, first you need to know the path of the device that you are going to format, like for example: /dev/sda1, /dev/sdb1, /dev/sdc2, etc.

You can find out the path of the storage device by running df command, like this:

df

kernelpanic@kernelpanic-laptop:~$ df
Filesystem 1K-blocks Used Available Use% Mounted on
udev 2017516 0 2017516 0% /dev
tmpfs 406816 6436 400380 2% /run
/dev/sda6 48270672 3134500 42661116 7% /
tmpfs 2034060 14204 2019856 1% /dev/shm
tmpfs 5120 4 5116 1% /run/lock
tmpfs 2034060 0 2034060 0% /sys/fs/cgroup
tmpfs 406816 16 406800 1% /run/user/1000
/dev/sdb1 976758780 886094812 90663968 91% /media/kernelpanic/Elements
/dev/sdc1 1947636 4 1947632 1% /media/kernelpanic/94CB-0533

If the storage device is listed on df command, then must be it is currently mounted, next step you need to un-mount the storage device you are going to format.

Let's say i'm going to format /dev/sdc1 which is my 2GB kingston usb stick memory, to un-mount it i need to run this command:

unmount /dev/sdc1

After the storage device is un-mounted, you can start formatting using mkfs command, here's an example formatting into FAT32 file system.

sudo mkfs.vfat /dev/sdc1

~ happy formatting ~


Không có nhận xét nào

Đăng nhận xét