In-depth introduction to XFS File System in Linux

Source: Internet
Author: User

The XFS file system is transplanted from SGI to the Lin ux system. In linux. The latest XFS file system available in the current version is version 1.2, which can work well under the 2.4 core. Here we will introduce the Linux XFS file system and hope to help you.

1. Introduction to XFS File System

The main features include the following:
Data Integrity
When XFS file system is used, when unexpected downtime occurs, first of all, because the file system has enabled the log function, the files on your disk will not be damaged by unexpected downtime. Regardless of the number of files and data stored in the file system, the file system can quickly restore the disk file content according to the recorded logs.
Transmission features
The XFS file system adopts an optimization algorithm. log records have little impact on file operations. XFS queries and allocates storage space very quickly. The xfs file system continuously provides fast response time. I have tested the XFS, JFS, Ext3, and ReiserFS file systems, and the XFS file system has outstanding performance.
Scalability
XFS is a fully 64-bit file system that supports storage of millions of T bytes. The support for ultra-large files and small-sized files is outstanding, and supports ultra-large directories. The maximum supported file size is 263 = 9x1018 = 9 exabytes, and the maximum file system size is 18 exabytes.
XFS uses a high table structure (B + tree) to ensure that the file system can quickly search for and quickly allocate space. XFS provides continuous high-speed operations, and the file system performance is not limited by the number of directories and files in the directory.
Transmission bandwidth
XFS can store data close to bare device I/O performance. In the test of a single file system, the throughput can reach up to 7 GB per second. For read/write operations on a single file, the throughput can reach 4 GB per second.

Ii. Use of XFS File System

1. Download and compile the kernel
Download the corresponding version of the kernel patch, decompress the patch package, and patch the system core
:
Install patches on the core, download and unzip, and get a file: xfs-1.1-2.4.18-all.patch file.
Fix the core as follows:
# Cd/usr/src/linux
# Patch-p1 sgi xfs filesystem support # Note: Compile the XFS file system support into the core
Or
Sgi xfs filesystem support # Description: supports XFS file systems by dynamically loading modules
There are two other options:
Enable xfs dmapi # Description: disk management API, used by storage management applications
Enable XFS Quota # Description: You can use Quota to manage the disk space used by users.
After completing the preceding steps, exit and save the core selection configuration.
Then, compile the kernel and install the core:
# Make bzImage
# Make module
# Make module_install
# Make install
If you are not patient or unsure about the complex and tedious work, you can download the core of the patch from the SGI website. The version is 2.4.18. It is an rpm software package. You only need to install it easily. There are two core SGI submissions for smp and single-processor machines.
2. Create an XFS File System
After compiling the core, you should also download the supporting XFSprogs tool package, that is, mkfs. xfs. Otherwise, the partition format cannot be completed: you cannot format a partition into the XFS file system format. Package name to download: xfsprogs-2.0.3.
Decompress and install the downloaded XFSProgs tool. mkfs. xfs is automatically installed in the/sbin directory.
# Tar-xvf xfsprogs-2.0.3.src.tar.gz
# Cd xfsprogs-2.0.3src
#./Configure
# Make
# Make install
Format the disk as an xfs File System Using mkfs. xfs as follows:
#/Sbin/mkfs. xfs/dev/sda6 # Description: format the partition as an xfs file system. The following content is displayed:
Meta-data =/dev/sda6 isize = 256 agcount = 8, agsize = 128017 blks
Data = bsize = 4096 blocks = 1024135, imaxpct = 25
= Sunit = 0 swidth = 0 blks, unwritten = 0
Naming = version 2 bsize = 4096
Log = internal log bsize = 4096 blocks = 1200
Realtime = none extsz = 65536 blocks = 0, rtextents = 0
When formatting a disk, if mkfs. xfs prompts you That the partition has been formatted as another file system, you can use the-f parameter to forcibly format it:
#/Sbin/mkfs. xfs-f/dev/sda6
3. Load the XFS File System
# Mount-t xfs/dev/sda6/xfs # Where/xfs is a directory under the primary partition.
Finally, to enable automatic loading after the system is started, you should change/etc/fstab so that the system will automatically load the xfs partition after the system is started, instead of manually loading each time.
Note that the current xfs is limited by the linux memory page. In x86 versions, the block size of the file system can only be 4 kb. In addition, the XFS file system can be mounted in different ways, that is, the file system can be loaded in Read mode or read/write mode. This is because when the xfs file system is used as the root file system, read-only loading is required for security purposes.

Iii. File System migration

To make other partitions in the system use the XFS file system, another step is to migrate the file system. We recommend that you back up data and files on the disk before migrating the file system to avoid irreparable losses, it is best to back up the entire system completely. There are many methods in this step. This article only describes the author's migration method. You can do this in the way you are used.
If you want a pure xfs system (all file systems in the system use XFS file systems), you must format the root file system as an xfs file system. This is actually a complicated step. Because the root file system cannot be umount, you must first create a partition, the file system is the ext2 file system, and then all the files and directories on the current root partition, copy the original data to this partition, change the/etc/fstab file, and replace the original root partition.
The method is as follows:
$ Mkfs-t ext2/dev/hda4
$ Mkdir/mnt/temp
$ Mount-t ext2/dev/hda4/mnt/temp
$ Cd/
$ Tar lcvf-. | (cd/mnt/temp; tar xpvf -)
The preceding operations are to package all the files in the root partition and copy them to the newly created partition. Of course, you can also use the following command to copy files.
# Cp-dpR // mnt/temp
Next, change the root partition to the/dev/hda4 partition, change the/etc/fstab file and/etc/lilo. conf, and then run lilo.
After restart, the new root partition is/dev/hda4.
Next, create an xfs file system partition:
$ Mkfs-t xfs/dev/hda2
Load this partition. Copy the content of the root partition to this partition in two ways.
$ Mount-t xfs/dev/hda2/mnt/temp
In the root partition, run
$ Cd/
$ Tar lcvf-. | (cd/mnt/temp; tar xpvf -)
Change/etc/fstab and/etc/lilo. conf again, and replace the original ext2 primary partition with the newly created xfs partition. As follows:
/Dev/hda2/xfs defaults 1 1
Use the newly created xfs partition as the root partition and save the preceding settings. Check the configuration file again, and then restart the system. If all your settings are correct, you will have a pure XFS file system after the system is successfully started.

  1. Common LinuxYUM commands
  2. A Brief Introduction to the use of Linux Operators
  3. One of the methods to modify the default Linux Startup System
  4. Parsing Linux Process status T, Z, and X
  5. Analysis of Linux Process status: R, S, and D

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.