The XFS file system, created by Silicon Graphics in 1993, is a 64-bit, high-performance file system. It can support a maximum of 16 TB file size and file systems as large as 500 TB. Suppose you want to use this file system. You need to learn how to mount XFS, then. This article will teach you everything you need to know.
XFS File System Overview
XFS File System is the primary file system for RedHat Linux 7. But you can mount it on a regular disk partition or a logical volume of other Linux distributions. This journaling file system is very high-performance, able to support files 16 TB big, and the file system can go up to 500 TB!
The allocation group-based design of XFS enables excellent performance in executing parallel input/output (I/O) operations. As such, XFD pushes the maximum file size, file system bandwidth, and I/O threads' scalability to the extreme when spanning multiple physical storage devices. It even does the same to the file system's lifespan.
On top of that, XFS employs metadata journaling and supports write barriers to ensure the consistency of data.
As you can see, XFS has several useful features. So, it's completely understandable when someone wants to use this file system. If you're one of them but don't know how to mount it, you came to the right place. Without further ado, here's how to mount XFS.
Accidentally deleted important files on XFS device?
No worries. Wondershare Recoverit can get back your lost data within 3 steps. The ultimate and professional data recovery tool is totally reliable and 100% safe.
Preparing To Mount XFS
Before mounting an XFS file system in your Linux system, ensuring it is properly prepared and formatted is essential. It involves creating a partition for the file system, formatting it to the XFS file system format, and setting the appropriate mount options.
You need to prepare some things before mounting the XFS file system. Don't worry. We'll help you prepare the prerequisites.
Step 1 Create a Partition to Format
When preparing to mount an XFS file system, the first step is to create a partition that can be formatted with the XFS file system. It involves allocating a specific portion of the storage device for the XFS file system, which can then be mounted and used for storing files and data.
- First of all, you need a partition to format. You need to create one. You can do so using the command:
- That is if you want to start from scratch. Suppose you already have the partition you want to format as XFS on your computer. Ensure it is not mounted. Use this command to do so (replace dev/sdb with the name of the partition):
# umount /dev/sdb
Step 2 Create an XFS File System
Next, you must create an XFS File System that you'll mount. For this, you have to use the mkfs.xfs command. For more details on this, please read this article: link to Article 6.
Mounting the XFS File system
Mounting an XFS file system in a Linux system is a crucial step in accessing and using the files stored on the file system. This involves specifying the file system device, the mount point directory, and the mount options.
So, after all the necessary preparations are done, we can proceed to mount the file system. Here is how you do it.
Step 1 Create a Mount Point
Before you can mount an XFS file system, you need to create a mount point, a directory that serves as a connection point between the file system and the operating system. In this first step of mounting the XFS file system, we will discuss how to create a mount point and prepare it for use with the XFS file system.
- Much like when mounting a real-life object, a mount point is needed for mounting a file system. You need to create a directory with the mkdir command. The syntax for that is:
- The "
mnt/wr/" is our choice. Feel free to change this.
Step 2 Mount the XFS File System
After creating a mount point for the XFS file system, you must mount the file system to the mount point. It involves connecting the XFS file system to the mount point so that the operating system can access and use the files stored within it.
- Finally, you can now mount the XFS file system. Run the following command:
mount /dev/sb1 /mnt/wr
- Again, you should change the
/dev/sb1with the partition name you want to use. Likewise, change the
/mnt/wrto the name of the directory you made.
Checking if the XFS File System Was Mounted
The XFS file system is a high-performance file system commonly used in Linux systems. It is important to check its status to ensure the XFS file system is mounted and functioning properly. It is possible to accomplish this with a few easy commands in the Linux terminal.
Before doing anything, check if the XFS File System was correctly mounted through the following steps:
Method 1. The “mount” Command
You can use the mount command without arguments to check if the XFS file system was mounted. It will display a list of all mounted file systems, including the file system type.
- To get the mounted filesystem’s type, we will first write the “mount” keyword along with “grep” so that we can only get those mounted files we want to display. The syntax for that is:
mount | grep /dev/sdb1
- You can run the "grep" syntax to filter the output to only show XFS file systems. For example, to display only XFS file systems, you can use the following command:
mount | grep xfs
This command will show a list of all mounted XFS file systems.
Method 2. The “findmnt” Command
Aside from the mount command, you will learn how to use "findmnt" instructions in Linux to determine the filesystem's format. All the filesystems mounted on the device will be shown in the “findmnt” command.
- The "findmnt" statement reveals information about the file's destination, its point of origin, its fstype (the file system's type), and its options (whether the file is writable or not). Here, "ext4" serves as the root directory at the very top of the filesystem hierarchy.
- Execute the "findmnt" command:
Another Linux man terminal page will be displayed, detailing the "findmnt" command in further detail. Pressing "q" will get you out of the "man findmnt" terminal and back to the man terminal page.
If you are a Mac user, it's also possible to mount XFS file system on Mac.
How To Unmount XFS File System
Unmounting a file system is crucial before any maintenance or modification tasks can be performed. If you need to unmount an XFS file system in your Linux system, a few simple commands can help you do so.
- After mounting a file system, you can unmount it with the umount command (without the "n"). The command umounts with the device or mount point will unmount the file system.
- For instance, you may use one of the following to unmount a file system (dev/sdd1) that was mounted at /data:
# umount /data
- No program or user may access the file system while it is unmounted. Linux will generate the below error if you try to unmount a file system while it is in use, as the operating system considers it "busy" while it is being used.
# umount /data
umount: /data: target is busy.
Have you mistakenly deleted a file on your XFS file system only to realize you need it back? Don't panic just yet! There are ways to undelete XFS files.
XFS is a high-performance file system commonly used in Linux systems. The "mount" command can be used to mount XFS file systems, and the "umount" command to unmount XFS file systems. Mount and unmount XFS file systems properly to prevent data corruption and ensure optimal performance.