Creating an XFS File System
To format a partition with the XFS file system, run the following command. In this example,/dev/sdb1 is the target partition:
mkfs command stands for “make file system.” If you prefer an ext4 file system instead, simply change the suffix as shown below:
-L option lets you assign a label to your file system. Consider these examples:
-L, you’ll notice that the label must not exceed 12 characters. To set the label “BackupVolume” on /dev/sdb1, execute:
fdisk:
-i option:
Ensure you have the correct partition selected before using the
-f option, as it will force an overwrite of any existing file system.XFS Administrative Utilities
XFS comes with a suite of administrative utilities. By typingxfs and pressing the Tab key, you can view available XFS-related commands. One of the most useful utilities is xfs_admin, which enables you to modify file system properties. For example, to display the current label for /dev/sdb1, run:
-L), execute:
Creating and Configuring an ext4 File System
Ubuntu and similar distributions often utilize the ext4 file system by default. To view configuration options for ext4, refer to the manual page ofmkfs.ext4, which internally calls the mke2fs program:
/dev/sdb2, use the command:
-N option to specify the exact number of inodes:
Managing ext4 File System Properties
Thetune2fs utility allows you to display and modify ext4 file system properties. To view current properties of /dev/sdb2, run:
tune2fs is not included here, the manual provides detailed guidance for modifying properties, including updating the label to “SecondFS” using the appropriate options.
Finally, tools like cfdisk can be used to inspect the /dev/sdb device, ensuring that partitions have the correct file system types and labels. In our demonstration, the XFS file system was labeled “FirstFS” and the ext4 file system on /dev/sdb2 was set to “SecondFS.”
This concludes our lesson on creating and configuring file systems with XFS and ext4. For detailed reference material and further reading, consider reviewing the following resources: