How to configure XFS file system for Linux system

  
                

The current system is basically equipped with the XFS file system. The XFS file system is used for many people because of its excellent and rich functions. The following small series will introduce you how to configure XFS files under Linux, and you want to configure XFS. Friends as a reference.

a, XFS File System Introduction

Key features include the following:

data completeness

using XFS file system, when Italian After the unexpected downtime occurs, first of all, because the file system has the logging function enabled, the files on your disk will no longer be accidentally crashed and destroyed. Regardless of the number of files and data stored on the current file system, the file system can quickly recover the contents of the disk file in a short period of time based on the recorded logs.

Transfer Features

The XFS file system uses an optimization algorithm that has minimal impact on overall file operations. XFS queries and allocates storage space very quickly. The xfs file system continuously provides fast response times. I have tested the XFS, JFS, Ext3, and ReiserFS file systems. The performance of the XFS file system is quite outstanding.

Scalability

XFS is a full 64-bit file system that supports millions of Tbytes of storage. Support for mega files and small files is outstanding and supports a very large number of directories. The maximum supported file size is 263 = 9 x 1018 = 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 be quickly searched and quickly allocated. XFS continues to provide high-speed operation, and the performance of the file system is not limited by the number of directories and files in the directory.

Transmission Bandwidth

XFS can store data close to the performance of raw device I/O. In a single file system test, the throughput is up to 7GB per second, and the read and write operations on a single file can reach 4GB per second.

Second, the use of XFS file system

1. Download and compile the kernel

Download the corresponding version of the kernel patch, unzip the patch package, and patch the system kernel

Download: ftp://oss.sgi.com/projects/xfs/Download/Release-1.1/kernel_patches/xfs-1.1-2.4.18-all.patch.bz2

Patch the kernel, download and extract it, and get a file: xfs-1.1-2.4.18-all. Patch file.

Fix the kernel as follows:

The code is as follows:

# cd /usr/src/linux

# patch -p1 " /path/to /xfs-1.1-2.4.18-all.patch

After the patching is complete, the next step is to compile the kernel and compile XFS into the Linux kernel.

First run the following command to select the core support XFS file system:

The code is as follows:

#make menuconfig

in the "file system" menu Select:

"*" SGI XFS filesystem support ##Note: Compile XFS file system support into the kernel

or

"M" SGI XFS filesystem support # #说明: Support XFS file system by dynamically loading modules

There are two other options: Enable XFS DMAPI ## Description: API for disk management, storage management application use

Enable XFS Quota ##Note: Support for Quota to use disk space management for users

After completing the above work, exit and save the core selection configuration

, then compile the kernel and install the kernel: Br>

The code is as follows:

#make bzImage

#make module

#make module_install

#make install

If you have no patience or no work on the above complicated and cumbersome work Grasp, then you can download the patched core directly from the SGI site, the version is 2.4.18. It is a rpm package, you can simply install it. There are two cores submitted by SGI, which are used by smp and single-processor machines.

2. Creating an XFS File System

After completing the compilation of the kernel, you should also download the XFSprogs tool package, the mkfs.xfs tool. Otherwise we can't finish formatting the partition: we can't format a partition into the format of the XFS file system. The name of the package to download: xfsprogs-2.0.3.

Unzip the downloaded XFSProgs tool and install it. mkfs.xfs is automatically installed in the /sbin directory.

The code is as follows:

#tar –xvf xfsprogs-2.0.3.src.tar.gz

#cd xfsprogs-2.0.3src

#./configure

#make

#make install

Use mkfs.xfs to format the disk as an xfs file system as follows:

The code is as follows :

# /sbin/mkfs.xfs /dev/sda6 #Note: Format the partition as an xfs file system. The following is the display:

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 was originally formatted as another file system, you can use the parameter –f to force formatting:

The code is as follows:

#/sbin /mkfs.xfs –f /dev/sda6

3. Loading the XFS file system

The code is as follows:

#mount –t xfs /dev/sda6 /xfs ## where /xfs is a directory under the primary partition/below.

Finally, in order for the system to load automatically after startup, you should change /etc/fstab so that the xfs partition is automatically loaded after the system is started without having to manually load it each time.

One point to note is that the current xfs is limited by the linux memory page. In the x86 version, only the file size of the file system is 4K. In addition, the XFS file system can be mounted in different ways, allowing the file system to be loaded in read mode and also in read-write mode. This is because when the xfs file system is used as the root file system, it is loaded read-only for security.

Third, file system migration

To make other partitions in the system use XFS file system, there is one step is to migrate the file system. It is recommended that when migrating the file system, first back up the data and files on the disk to avoid irreparable damage. It is better to perform a full backup of the entire system between file system conversions. There are many ways to do this step. This article only describes the author's migration method. You can do it the way you are used to.

If you want a pure xfs system (all file systems in the system use the XFS file system), you must also format the root file system as an xfs file system. This is actually a rather complicated step. Because the root file system cannot be umounted, you must first create a partition whose file system is an ext2 file system, then copy all the files and directories on the current root partition to the original partition locally, and then change /etc/The fstab file replaces the original root partition.

The method is as follows:

The code is as follows:

$ mkfs -t ext2 /dev/hda4

$ mkdir /mnt/temp

$ mount -t ext2 /dev/hda4 /mnt/temp

$ cd /

$ tar lcvf - .

Copyright © Windows knowledge All Rights Reserved