In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "the configuration method of using XFS file system in Linux". In the daily operation, I believe that many people have doubts about the configuration method of using XFS file system in Linux. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "configuration method of using XFS file system in Linux". Next, please follow the editor to study!
I. brief introduction of 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.
II. The use of the XFS file system
1. Download and compile the kernel
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/download/Release-1.1/kernel_patches/xfs-1.1-2.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:
The code is 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 the XFS into the Linux core.
First run the following command to select the core to support the XFS file system:
The code is as follows:
# 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 the management of disk space size with Quota.
After completing the above work, exit and save the core selection configuration
After that, compile the kernel and install the core:
The code is as follows:
# 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.
2. 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.
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 a xfs file system as follows:
The code is 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 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 into another file system, you can use the parameter-f to forcibly format it:
The code is as follows:
# / sbin/mkfs.xfs-f / dev/sda6
3. Load the XFS file system
The code is as follows:
# mount-t xfs / dev/sda6 / xfs # # where / xfs is a directory under the primary 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.
III. 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 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:
The code 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 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.
The code is as follows:
# 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:
The code is as follows:
$mkfs-t xfs / dev/hda2
Load this partition and copy the contents of the root partition to this partition in a different way
The code is as follows:
$mount-t xfs / dev/hda2 / mnt/temp
Under the root partition, run
The code is as follows:
$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:
The code is 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.
At this point, the study on "the configuration method of using XFS file system in Linux" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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: 232
*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.