Use XFS file System _unix Linux in Linux environment

Source: Internet
Author: User
Tags file size

XFS file system is the Advanced log file system developed by SGI, and XFS is very scalable and robust. Fortunately, SGI transplanted it into the Lin UX system. In the Linux environment. The current version of the latest XFS file system available for version 1.2, can work well under 2.4 core.

Introduction of XFS File system
The main features include the following points:

Data complete

With XFS file system, when unexpected downtime occurs, first of all, because the file system turned on the log function, so the file on your disk will no longer accidentally downtime and be destroyed. Regardless of the number of files and data that are currently stored on the file system, the file system can quickly recover the contents of the disk files in a very short period of time based on the logs logged.

Transmission characteristics

The XFS file system uses the optimization algorithm, the log record has very little influence on the whole file operation. XFS query and allocate storage space very quickly. The XFS file system provides a fast response time continuously. The author has tested XFS, JFS, EXT3, ReiserFS file system, the performance of XFS file system is quite outstanding.

Scalability

XFS is a 64-bit file system that can support millions of T-byte storage space. Support for oversize files and small size files is outstanding and supports a large number of catalogs. The maximum supported file size is 263 = 9 x 1018 = 9 Exabytes, the maximum file system size is exabytes.

XFS uses a high table structure (b + tree), which ensures that the file system can be quickly searched and quickly allocated to space. XFS continues to provide high-speed operations, and file system performance is not limited by the number of directories and files in the directory.

Transmission bandwidth

XFS can store data with near-naked device I/O performance. In a single file system test, the throughput is up to 7GB per second, and the throughput of a single file is up to 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, the core of the system to patch

Download Address:

To the core patching, download decompression, get a file: Xfs-1.1-2.4.18-all.patch file.
The core is patched as follows:

# Cd/usr/src/linux
# PATCH-P1 </path/to/xfs-1.1-2.4.18-all.patch

After the patch is complete, the next step is to compile the core and compile XFS into the Linux core.
First, run the following command to select the core support XFS file system:

#make Menuconfig

From the File System menu, select:

<*> SGI XFS FileSystem support # #说明: Compiling XFS file system support into the core
Or
<M> SGI XFS FileSystem support # #说明: Supporting XFS file systems in a dynamic loading module

There are two other options:

Enable XFS DMAPI # #说明: An API for Disk Management that storage management applications use
Enable XFS Quota # #说明: Support Quota for users using disk space size management

When you are done, exit and save the core selection configuration.

After that, then compile the kernel and install the core:

#make Bzimage
#make Module
#make Module_install
#make Install

If you are not patient or unsure of the complicated work above, you can download the core of the patch from SGI's site directly, with a version of 2.4.18. It is an RPM software package that you simply install. There are two core SGI submissions, which are used by SMP and single processor machines respectively.

2. Creating XFS File Systems

After compiling the core, you should also download the matching Xfsprogs tool package, also known as the Mkfs.xfs tool. Otherwise we cannot complete the format of the partition: that is, a partition cannot be formatted as an XFS file system. Name of package to download: xfsprogs-2.0.3.


The downloaded Xfsprogs tool is unzipped, installed, and MKFS.XFS automatically installed in the/sbin directory.


#tar –XVF xfsprogs-2.0.3.src.tar.gz
#cd XFSPROGS-2.0.3SRC
#./configure
#make
#make Install

Use the MKFS.XFS format disk as the XFS file system by using the following methods:

#/sbin/mkfs.xfs/dev/sda6 # Description: Format the partition as a XFS file system, as shown below:

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 you format a disk, if MKFS.XFS prompts you that the partition has been formatted as another file system, you can use the parameter –f to force the formatting:

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

3. Load XFS File system

#mount –t XFS/DEV/SDA6/XFS # #其中/XFS is a primary partition/directory below.

Finally, to automatically load the system after it is started, you should change the/etc/fstab so that the XFS partition is automatically loaded after the system is started without having to be manually loaded each time.

One point to note is that the current XFS is limited by the Linux memory page, and in the x86 version, only the block size of the file system can be implemented as 4K. In addition, the XFS file system can mount in a different way, allowing the file system to be read-loaded and read-write. This is because the XFS file system, when used as the root file system, is loaded in a read-only fashion for security purposes.

Iii. migration of the file system

To enable other partitions in the system to use the XFS file system, another step is to migrate the file system. It is recommended that when migrating the file system, first the data on the disk, the file first backup to avoid irreparable damage, in the file system conversion, it is best to complete the entire system backup. There are many methods in this step, this article only describes the author's migration methods. You can do it in the way you're used to.

If you want a pure XFS system (the system is all file systems using XFS file system), you have to also format the root file system into the XFS file system. This is actually a more complicated step. Because the root file system cannot be umount, you must first create a partition whose file system is a ext2 file system, and then copy all the files and directories on the current root partition to this partition, and then change the/etc/fstab file to 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 above procedure is to package all the files on the root partition and copy them to the newly established partition. Of course, you can also use the following command to copy files directly.


# CP–DPR//mnt/temp

Then, change the next boot root partition to the/DEV/HDA4 partition, change the/etc/fstab file and/etc/lilo.conf, and then run Lilo.

After the reboot, the new root partition is already/dev/hda4.

Next, create a partition for the XFS file system:

$ mkfs-t Xfs/dev/hda2

Load this partition, using two methods to copy the contents of the root partition to this partition

$ mount-t Xfs/dev/hda2/mnt/temp

Under the root partition, run the

$ CD/
$ tar lcvf-. | (Cd/mnt/temp tar XPVF-)

Change/etc/fstab,/etc/lilo.conf again, and replace the original EXT2 primary partition with the new XFS partition. As shown below:

/DEV/HDA2/XFS Defaults 1 1

Use the new XFS partition as the root partition to save the settings above. Check the contents of the configuration file again, and then reboot the system after confirming the error. If your settings are all correct, you will have a system with a pure XFS file system after the system is successfully started.

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.