Raspberry Pi_Eng_15.1.2 Formatting Disk


Published Book on Amazon


All of IOT Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 1
All of IOT Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 2


출판된 한글판 도서


최신 라즈베리파이(Raspberry Pi)로 시작하는 사물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (상)
최신 라즈베리파이(Raspberry Pi)로 시작하는 사물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (하)


Original Book Contents


15.1.2  Formatting Disk

 

15.1.2.1    What Is Formatting Disk?

 

After a partition is created for a disk, the partition must be initialized to a specific file-system, and this initializing process is format. When you format a partition, a specific file-system is determined for that partition, and a master directory is created that manages all the directorys and files that will be stored on that partition.

 

You should be careful that formatting partitions with existing data will delete all data.

 


 

15.1.2.2    "mkfs" Command Format Disk

 

The "mkfs" command performs format operation to make the Linux filesystem for partition on disk device.

 

[Command Format]

mkfs          [ options ]  < -t  type  fs-options >  device

 

Here is the command to format in a specific filesystem

 

[Command Format]

mkfs.<fstype>    [ options ]   device

 

[Command Overview]

   This performs a format operation to create a filesystem for a partition on a disk device

   User privilege          -- Super user. 

 

[Detail Description]

You usually specify a partition device such as "/dev/hda1" or "/dev/sdb2" to device. If you specify a disk device, you will format it for all the partitions in it.

 

There are several internal commands in the form of "mkfs.fstype" that can be used to create various types of filesystem on Linux. The "mkfs" command is a common command that appears externally to these internal commands. If you are familiar with internal commands, you can use them immediately.

 

Internally executed commands include mke2fs, mkfs.bfs, mkfs.ext2, mkfs.ext3, mkfs.ext4, mkfs.minix, mkfs.msdos, mkfs.vfat, mkfs.xfs, and mkfs.xiafs.

 

[Main Option]

-h, --help

Display help and exit.

-t, --type type fs-options

Specify the type of filesystem to be built. If not specified, the default filesystem type (currently ext2) is used.

fs-options is filesystem-specific options to be passed to the real filesystem builder. Although not guaranteed, the following options are supported by most filesystem builders.