In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to use the XFS file system under Linux. It is very detailed and has a certain reference value. Friends who are interested must read it!
XFS is a high-performance file system. Because of its high performance, XFS has become the first choice for many enterprise systems, especially those with large amounts of data that require structured scalability and stability. For example, RHEL/CentOS 7 and Oracle Linux use XFS as the default file system, and SUSE/openSUSE has long supported XFS.
Introduction to XFS file system
The main features include the following:
Data completeness
With the XFS file system, when an unexpected downtime occurs, first of all, because the file system enables logging, the files on your disk will no longer be destroyed by accidental downtime. No matter how many files and data are stored on the current file system, the file system can quickly recover the contents of disk files in a very short time according to the recorded logs.
Transmission characteristics
The XFS file system uses an optimization algorithm, and logging has little impact on the overall file operation. XFS queries and allocates storage space very quickly. The xfs file system provides continuous fast response time. The author has tested the XFS, JFS, Ext3 and ReiserFS file systems, and the performance of the XFS file system is quite outstanding.
Expandability
XFS is a 64-bit file system that supports millions of terabytes of storage. Support for both large and small files is outstanding, supporting a 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), which ensures that the file system can quickly search and allocate space quickly. XFS can continuously 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 at a performance similar to that of the bare device Ibank O. In the test of a single file system, its throughput can reach up to 7GB per second, and the throughput of read and write operations to a single file can reach 4GB per second.
Downloading and compiling kernel using XFS file system
Download the corresponding version of the kernel patch, extract 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, download and extract it, and get a file: xfs-1.1-2.4.18-all.patch file.
The core is patched as follows:
# cd / usr/src/linux# patch-p1
After the patch is complete, the next step is to compile the core and compile the XFS into the Linux core.
First run the following command to select the core to support the XFS file system:
# make menuconfig
From the File system menu, select:
SGI XFS filesystem support # # description: compiles XFS file system support into the core or SGI XFS filesystem support # # description: supports XFS file system by dynamically loading modules
There are two other options:
Enable XFS DMAPI # # description: for disk management API, storage management applications use Enable XFS Quota # # description: support with Quota to manage the size of disk space for users
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 of the above complex and tedious tasks, you can download the patched core, version 2.4.18, directly from SGI's site. It is a rpm package that you can simply install. There are two core types of SGI submission, one for smp and one for uniprocessor machines.
Create a XFS file system
After compiling the core, you should also download the XFSprogs tool package that comes with it, 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. The name of the package to download: xfsprogs-2.0.3.
Unpack the downloaded XFSProgs tools, install them, and install mkfs.xfs automatically 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 a xfs file system as follows:
# / sbin/mkfs.xfs / dev/sda6 # description: format the partition as a xfs file system, and the following is the display: meta-data=/dev/sda6 isize=256 agcount=8, agsize=128017 blksdata = bsize=4096 blocks=1024135, imaxpct=25= sunit=0 swidth=0 blks, unwritten=0naming = version 2 bsize=4096log = internal log bsize=4096 blocks=1200realtime = none extsz=65536 blocks=0, rtextents=0
When formatting a disk, if mkfs.xfs prompts you that the partition has been formatted into another file system, you can use the parameter-f to forcibly format it:
# / sbin/mkfs.xfs-f / dev/sda6 load XFS file system # mount-t xfs / dev/sda6 / xfs
# # where / xfs is a directory under the main partition.
Finally, in order for the system to load automatically after boot, you should change / etc/fstab so that the xfs partition will be loaded automatically after boot instead of manually each time.
It is important to note that the current xfs can only achieve a block size of 4K in the x86 version due to the limitation of linux memory pages. In addition, the XFS file system can be mount in different ways, allowing the file system to be loaded either read or write. This is because when the xfs file system is used as the root file system, it is mounted read-only for security.
Migration of file system
Another step to get other partitions in the system to use the XFS file system is to migrate the file system. It is recommended that when migrating the file system, the data and files on the disk should be backed up first to avoid irreparable losses. During the file system conversion, it is best to back up the whole system completely. There are many methods for this step, and this paper only describes the author's migration method. You can do it in 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 also have to format the root file system as the xfs file system. This is actually a rather complicated step. Because the root file system cannot be umount, you must first create a partition whose file system is the ext2 file system, 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 methods are 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 operation is to package and copy all the files on the root partition to the newly created partition. Of course, you can also use the following command to copy the file directly.
# cp-dpR / / mnt/temp
Next, change the root partition of the next boot to the / dev/hda4 partition, change the / etc/fstab file and / etc/lilo.conf, and then run lilo.
After reboot, the new root partition is already / dev/hda4.
Next, create a partition of the xfs file system:
$mkfs-t xfs / dev/hda2
Load this partition and copy the contents of the root partition to this partition in a different way
$mount-t xfs / dev/hda2 / mnt/temp
Under the root partition, run
$cd / $tar lcvf -. | (cd / mnt/temp; tar xpvf -)
Change / etc/fstab, / etc/lilo.conf again to replace the original xfs primary partition with the new ext2 partition. As follows:
/ dev/hda2 / xfs defaults 1 1
Use the newly created xfs partition as the root partition and save the above settings. Check the contents of the configuration file again, make sure it is correct, and then restart the system. If your settings are all correct, then after the system boots successfully, you will have a pure XFS file system.
The above is all the contents of the article "how to use the XFS file system under Linux". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.