How to use XFS file system in Linux environment
Introduction | XfS file system is an advanced log file system developed by SGI. XFS is extremely scalable and robust. Fortunately, SGI has ported it to Linux systems. In a linux environment. The latest XFS file system currently available is version 1.2, which works well under the 2.4 core. |
Main features include the following:
Data integrityUsing the XFS file system, when unexpected downtime occurs, first of all, because the file system has the log function enabled, the files on your disk will no longer be destroyed due to unexpected downtime. No matter how many files and data are currently stored in the file system, the file system can quickly restore the disk file contents in a very short time based on the recorded logs.
Transmission characteristicsThe XFS file system uses an optimization algorithm, and logging has very little impact on overall file operations. XFS queries and allocates storage space very quickly. The xfs file system can continuously provide fast response times. The author has tested XFS, JFS, Ext3, and ReiserFS file systems, and the performance of the XFS file system is quite outstanding.
ScalabilityXFS is a full 64-bit file system that can support millions of Tbytes of storage space. The support for both extra-large files and small-sized files is outstanding, and it supports an extremely 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 tall table structure (B-tree) to ensure that the file system can quickly search and allocate space quickly. XFS can continuously provide high-speed operations, and the performance of the file system is not limited by the number of directories and files in the directory.
Transmission bandwidthXFS can store data with performance close to raw device I/O. In the test of a single file system, its throughput can reach up to 7GB per second, and for read and write operations on a single file, its throughput can reach 4GB per second.
Usage of XFS file system Download and compile the kernelDownload the corresponding version of the kernel patch, unzip the patch package, and patch the system core
Download address: ftp://oss.sgi.com/projects/xfs/d ... .4.18-all.patch.bz2
Patch the core. After downloading and decompressing, you will get a file: xfs-1.1-2.4.18-all.patch file.
Patch the core as follows:
# cd /usr/src/linux # patch -p1 <p>After the patching work is completed, the next step is to compile the core and compile XFS into the Linux kernel. </p> <p>First run the following command to select the core support XFS file system:</p> <pre class="brush:php;toolbar:false">#make menuconfig
Select in the "File System" menu:
SGI XFS filesystem support ##Description: Compile XFS file system support into the core or SGI XFS filesystem support ##Description: Support XFS file system by dynamically loading modules
There are two other options:
Enable XFS DMAPI ##说明:对磁盘管理的API,存储管理应用程序使用 Enable XFS Quota ##说明:支持配合Quota对用户使用磁盘空间大小管理
After completing the above work, exit and save the core selection configuration
After that, compile the kernel and install the core:
#make bzImage #make module #make module_install #make install
If you are impatient or unsure about the above complicated and tedious work, you can download the patched core directly from the SGI website, and its version is 2.4.18. It is an rpm package that you simply install. There are two cores submitted by SGI, which are used by SMP and single-processor machines respectively.
Create XFS file systemAfter completing the compilation of the core, you should also download the supporting XFSprogs tool package, that is, the mkfs.xfs tool. Otherwise, we cannot complete the formatting of the partition: that is, we cannot format a partition into the format of the XFS file system. Package name to download: xfsprogs-2.0.3.
Extract the downloaded XFSProgs tool and install it. mkfs.xfs will be 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 mkfs.xfs to format the disk as an xfs file system. The method is as follows:
# /sbin/mkfs.xfs /dev/sda6 #说明:将分区格式化为xfs文件系统,以下为显示内容: 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 to another file system, you can use the parameter -f to force format:
#/sbin/mkfs.xfs –f /dev/sda6Load XFS file system
#mount –t xfs /dev/sda6 /xfs
##/xfs is a directory under the main partition/.
最后,为了让系统启动后就自动加载,应该更改/etc/fstab,这样系统启动后就会自动加载xfs分区而不必每次都手工加载。
要说明的一点是目前的xfs由于受linux内存页限制,在x86版本中,只能实现文件系统的块尺寸为4K。另外,XFS文件系统可以不同的方式 mount,即允许文件系统以读方式加载,也允许以读写方式加载。这是因为xfs文件系统用作根文件系统时,为了安全要以只读方式加载。
文件系统的迁移要使得系统中的其它分区使用XFS文件系统,还有一步是迁移文件系统。建议在迁移文件系统时,首先将磁盘上的数据、文件先备份,以免发生不可挽回的损失,在进行文件系统转换之间,最好能将整个系统进行完全备份。这一步有很多种方法,本文仅就笔者的迁移方法加以描述。各位可以按照自己习惯的方式去完成
如果你想得到一个纯的xfs系统(系统的所有文件系统均采用XFS文件系统)话,还得将根文件系统也格式化为xfs文件系统。这实际上是比较繁杂的一步。因为根文件系统不能被umount,所以,必须首先创建一个分区,其文件系统为ext2文件系统,然后将目前的根分区上的所有文件与目录,原原本本地复制到这一个分区,然后更改/etc/fstab文件,替换原来的根分区。
方法如下:
$ mkfs -t ext2 /dev/hda4 $ mkdir /mnt/temp $ mount -t ext2 /dev/hda4 /mnt/temp $ cd / $ tar lcvf - .|(cd /mnt/temp; tar xpvf - )
以上操作是将根分区上的所有文件打包,复制到新建立的分区。当然,你也可以直接使用以下命令复制文件。
# cp –dpR / /mnt/temp
接着,将下次启动的根分区更改到/dev/hda4分区,更改/etc/fstab文件及/etc/lilo.conf ,然后,运行 lilo.
重新启动后,新的根分区就已经为/dev/hda4。
接下来,创建一个xfs文件系统的分区:
$ mkfs -t xfs /dev/hda2
加载此分区,采用两样的方法,将根分区的内容复制到此分区
$ mount -t xfs /dev/hda2 /mnt/temp
在根分区下,运行
$ cd / $ tar lcvf - .|(cd /mnt/temp; tar xpvf - )
再次更改/etc/fstab、/etc/lilo.conf,用新建的xfs分区替换原来的ext2主分区。如下所示:
/dev/hda2 / xfs defaults 1 1
将新建的xfs分区用作根分区,保存以上设置。再次检查配置文件内容,确认无误后再重新启动系统。如果你的设置全部正确,那么系统成功启动后,你就拥有一个纯XFS文件系统的系统了。
The above is the detailed content of How to use XFS file system in Linux environment. For more information, please follow other related articles on the PHP Chinese website!

The main tasks of Linux system administrators include system monitoring and performance tuning, user management, software package management, security management and backup, troubleshooting and resolution, performance optimization and best practices. 1. Use top, htop and other tools to monitor system performance and tune it. 2. Manage user accounts and permissions through useradd commands and other commands. 3. Use apt and yum to manage software packages to ensure system updates and security. 4. Configure a firewall, monitor logs, and perform data backup to ensure system security. 5. Troubleshoot and resolve through log analysis and tool use. 6. Optimize kernel parameters and application configuration, and follow best practices to improve system performance and stability.

Learning Linux is not difficult. 1.Linux is an open source operating system based on Unix and is widely used in servers, embedded systems and personal computers. 2. Understanding file system and permission management is the key. The file system is hierarchical, and permissions include reading, writing and execution. 3. Package management systems such as apt and dnf make software management convenient. 4. Process management is implemented through ps and top commands. 5. Start learning from basic commands such as mkdir, cd, touch and nano, and then try advanced usage such as shell scripts and text processing. 6. Common errors such as permission problems can be solved through sudo and chmod. 7. Performance optimization suggestions include using htop to monitor resources, cleaning unnecessary files, and using sy

The average annual salary of Linux administrators is $75,000 to $95,000 in the United States and €40,000 to €60,000 in Europe. To increase salary, you can: 1. Continuously learn new technologies, such as cloud computing and container technology; 2. Accumulate project experience and establish Portfolio; 3. Establish a professional network and expand your network.

The main uses of Linux include: 1. Server operating system, 2. Embedded system, 3. Desktop operating system, 4. Development and testing environment. Linux excels in these areas, providing stability, security and efficient development tools.

The Internet does not rely on a single operating system, but Linux plays an important role in it. Linux is widely used in servers and network devices and is popular for its stability, security and scalability.

The core of the Linux operating system is its command line interface, which can perform various operations through the command line. 1. File and directory operations use ls, cd, mkdir, rm and other commands to manage files and directories. 2. User and permission management ensures system security and resource allocation through useradd, passwd, chmod and other commands. 3. Process management uses ps, kill and other commands to monitor and control system processes. 4. Network operations include ping, ifconfig, ssh and other commands to configure and manage network connections. 5. System monitoring and maintenance use commands such as top, df, du to understand the system's operating status and resource usage.

Introduction Linux is a powerful operating system favored by developers, system administrators, and power users due to its flexibility and efficiency. However, frequently using long and complex commands can be tedious and er

Linux is suitable for servers, development environments, and embedded systems. 1. As a server operating system, Linux is stable and efficient, and is often used to deploy high-concurrency applications. 2. As a development environment, Linux provides efficient command line tools and package management systems to improve development efficiency. 3. In embedded systems, Linux is lightweight and customizable, suitable for environments with limited resources.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Dreamweaver Mac version
Visual web development tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Chinese version
Chinese version, very easy to use

WebStorm Mac version
Useful JavaScript development tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.