SOP For Managing Partitions, File Systems and Persistent Mounts On A Linux System
SOP For Managing Partitions, File Systems and Persistent Mounts On A Linux System
Title:
System
Prepared By: Mohd Nazri Bin Mazlan
1. Specify the disk device that used to create a new partition. Execute gdisk command and specify the
disk device name as an argument.
3. Specify the partition number. It serves as the identification number of the partition on the disk for
use in future partition operations. Default value is the lowest unused partition number.
4. Specify the disk location that the new partition will start from. Gdisk allow two different input types,
first input type is an absolute disk sector number representing the first sector of the new partition. The
second input type indicates the partition’s starting sector by its position relative to the first or last
sector of the first contiguous block of free sectors on the disk. Using this relative sector position
format, input specified in units of KiB, MiB, GiB, TiB or PiB.
5. Specify the last sector on the disk which shows the end of the new partition. The default value is the
last of the available unallocated sectors contiguous to the new partition’s first sector. As an example, a
value of +5G signifies an ending partition position that is 5GiB after the first sector.
6. Define partition type. As per default, a new partition created by gdisk is with type Linux file system.
We can choose different partition type by enter the corresponding hex code. A table of hex codes for
all partition types can be displayed with L command.
1|P a g e
SOP for Managing Partitions, File Systems and Persistent Mounts on a Linux
Title:
System
Prepared By: Mohd Nazri Bin Mazlan
af03 Apple label af04 AppleTV recovery af05 Apple Core Storage
be00 Solaris boot bf00 Solaris root bf01 Solaris /usr & Mac Z
bf02 Solaris swap bf03 Solaris backup bf04 Solaris /var
bf05 Solaris /home bf06 Solaris alternate se bf07 Solaris Reserved 1
bf08 Solaris Reserved 2 bf09 Solaris Reserved 3 bf0a Solaris Reserved 4
bf0b Solaris Reserved 5 c001 HP-UX data c002 HP-UX service
ed00 Sony system partitio ef00 EFI System ef01 MBR partition scheme
ef02 BIOS boot partition fb00 VMWare VMFS fb01 VMWare reserved
fc00 VMWare kcore crash p fd00 Linux RAID
Hex code or GUID (L to show codes, Enter = 8300): 8300
Changed type of partition to 'Linux filesystem'
7. Save partition table changes. Issue the w command to finalize the partition creation request by
writing the changes to the disk’s partition table. Enter y for a final confirmation.
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
8. Initiate a kernel re-read of the new partition table. Run partprobe command with the disk device
name as an argument to force a re-read of its partition table.
There are 5 steps required to remove a partition from a disk with GPT partitioning scheme.
2. Identify the partition number of the partition to be deleted. Press p to print the partition table. Do
note the number in number field for the partition to be deleted.
2|P a g e
SOP for Managing Partitions, File Systems and Persistent Mounts on a Linux
Title:
System
Prepared By: Mohd Nazri Bin Mazlan
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
5. Initiate a kernel re-read of the new partition table. Run partprobe command with the disk device
name as an argument to force a re-read of its partition table.
After a block device has been created, next step is applying a file system format to it. A file system
applies a structure to the block device so that data can be stored and retrieved from it.
1. Verify the new partition as per step 8 (Creating GPT disk partitions).
3|P a g e
SOP for Managing Partitions, File Systems and Persistent Mounts on a Linux
Title:
System
Prepared By: Mohd Nazri Bin Mazlan
2. The mkfs command is used to apply a file system to a block device. If no type is specified, an
extended type two (ext2) file system will be used. Specify the file system type with option -t.
Once the file system format has been applied, next is to attach the new file system into the directory
structure. When the file system is attached into the directory hierarchy, user space utilities can access
or write files on the device.
2. Verify the currently mounted file systems, the mount points and options.
3. Create a test file and added it inside the newly mounted file systems.
4. If the file systems required to persistently mounted, a listing for the file systems need to be added to
/etc/fstab. By adding a listing for a device into /etc/fstab file, we can configure a device to be mounted
to a mount point at system boot. Note that /etc/fstab is a white space-delimited file with six fields per
line. The first field specifies the device to be used (eg: the device UUID or the block device path). The
second field is the mount point where the device should be attached into the directory hierarchy. The
third field contains the file system type that has been applied to the block device. The fourth field is the
list of options that should be applied to the device when mounted to customize the behaviour (eg: a
commonly used option is defaults). The last two fields are dump flag and fsck order, dump flag is used
with the dump command to make a backup of the contents of the device, while fsck order determines if
fsck should be run at boot time, in the event that the file system was not mounted cleanly. The value of
the fsck order indicates the order in which file systems should have fsck run on them if multiple file
systems are required to be checked.
4|P a g e
SOP for Managing Partitions, File Systems and Persistent Mounts on a Linux
Title:
System
Prepared By: Mohd Nazri Bin Mazlan
#
# /etc/fstab
# Created by anaconda on Fri May 12 09:53:09 2017
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/rhel-root / xfs defaults 0 0
UUID=dcdf59f9-bd90-4175-9e65-6eb56a2cf523 /boot xfs defaults 0 0
/dev/mapper/rhel-swap swap swap defaults 0 0
4.1 Scan the block devices connected to a machine using blkid command.
4.2 Adding a listing of /dev/sdb1 to /etc/fstab. Refer to step 4 (Mounting File Systems) for the
descriptions.
4.3 Verify the entry in /etc/fstab by unmounting the new file system and following below commands.
If the mount –a command returns an error, it should be corrected before rebooting the machine.
5|P a g e