FreeBSD 101 : Storage devices (disks) and partition creation - gpart and newfs-

Hard drives and filesystems:

A hard drive is divided into partitions. Each partition could hold one filesystem.
A filesystem can't span multiple partitions.
The filesystem is a bunch of files, some of these file are directories and may point to other files (subdirectories) for example.
Each file is represented by a structure called inode. The inode contains all the information regarding a file, access permissions,
Who owns the file, time indicating the last access or modification made to the file,...

Device nodes:

Device nodes are special files that represent the hardware installed on the system. They live in the /dev directory. They act as intermediary between user programs that use these devices and the drivers in the kernel.

Device node naming convention:

FreeBSD divides the disk into partitions on which you can create filesystems.
We could use da0 for SCSI, SAS, USB and Flash storage or ad0 for ATA or SATA disks for example.

Wiping a disk:

The below command wipes the drive and write zeros(0) to it.

Apply the GPT partition scheme (-s) to the drive: 

Show partitions(ad0 drive):

Create a (UFS) partition: 

The command gpart add fills out the entire disk if we don't use
 the -s size argument ( five Gigs in the above example).

 Deleting the partition "ad0p":

-i 1: delete first partition of the disk (index 1).

Format the new UFS partition:

The command below formats the partition /dev/da0p1:
Mounting the partition:

To be able to use the partition, we need to mount it on an 
existing directory called mount point.
Mounts the formatted partition /dev/da0p1 on the directory /mountpoint.


Leave as a comment: