当前位置: 澳门新濠3559 > 操作系统 > 正文

Graphics为他们的IRIX操作系统而开发澳门新濠3559:

时间:2019-10-07 14:50来源:操作系统
XFS文件系统简介 一 XFS文件系统简介 XFS是高性能文件系统,SGI为他们的IRIX平台而设计。自从2001年移植到Linux内核上,由于它的高性能,XFS成为了许多企业级系统的首选,特别是有大量数

XFS文件系统简介

一 XFS文件系统简介

XFS是高性能文件系统,SGI为他们的IRIX平台而设计。自从2001年移植到Linux内核上,由于它的高性能,XFS成为了许多企业级系统的首选,特别是有大量数据,需要结构化伸缩性和稳定性的。例如,RHEL/CentOS 7 和Oracle Linux将XFS作为默认文件系统,SUSE/openSUSE已经为XFS做了长期支持。
XFS有许多独特的性能提升功能使他从众多文件系统中脱颖而出,像可伸缩/并行 IO,元数据日志,热碎片整理,IO 暂停/恢复,延迟分配等。

一、XFS 简介及特性

File systems do have limits. Thats no surprise. ext3 had a limit at 16 TB file system size. If you needed more space you´d have to use another file system for instance XFS or JFS or spilt the capacity into multiple mount points.

 

二 安装XFS系统工具集

Debian, Ubuntu , Linux Mint系统:

$ sudo apt-get install xfsprogs
Fedora, CentOS, RHEL系统:

$ sudo yum install xfsprogs
其他版本Linux:

$ sudo pacman -S xfsprogs

XFS 最初是由 Silicon Graphics,Inc. 于 90 年代初开发的。那时,SGI 发现他们的现有文件系统(existing filesystem,EFS)正在迅速变得不适应当时激烈的计算竞争。为解决这个问题,SGI 决定设计一种全新的高性能 64 位文件系统,而不是试图调整 EFS在先天设计上的某些缺陷。因此,XFS 诞生了,并于 1994 年随 IRIX 5.3 的发布而应用于计算。它至今仍作为 SGI 基于 IRIX 的产品(从工作站到超级计算机)的底层文件系统来使用。现在,XFS 也可以用于 Linux。XFS 的 Linux 版的到来是激动人心的,首先因为它为 Linux 社区提供了一种健壮的、优秀的以及功能丰富的文件系统,并且这种文件系统所具有的可伸缩性能够满足最苛刻的存储需求。

ext4 was designed to allow far more larger file systems than ext3. According to wikipedia ext4 has a maximum file system size of 1 EiB (approx. one exabyte or 1024 TB).

维基百科关于XFS的简介如下:

三创建分区

  1. 查看下是否有分区
    <code><p>
    root@HWPKI-TEST-98:~# fdisk -l
    Disk /dev/sda: 500.1 GB, 500107862016 bytes
    255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00083283
    Device Boot Start End Blocks Id System
    /dev/sda1 * 2048 968601599 484299776 83 Linux
    /dev/sda2 968603646 976771071 4083713 5 Extended
    /dev/sda5 968603648 976771071 4083712 82 Linux swap / Solaris
    Disk /dev/sdb: 3000.6 GB, 3000592982016 bytes
    255 heads, 63 sectors/track, 364801 cylinders, total 5860533168 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 4096 bytes
    I/O size (minimum/optimal): 4096 bytes / 4096 bytes
    Disk identifier: 0x3ab14c4d
    Device Boot Start End Blocks Id System
    </p></code>

  2. 开始分区
    <code>
    root@HWPKI-TEST-98:~# fdisk /dev/sdb
    WARNING: The size of this disk is 3.0 TB (3000592982016 bytes).
    DOS partition table format can not be used on drives for volumes
    larger than (2199023255040 bytes) for 512-byte sectors. Use parted(1) and GUID
    partition table format (GPT)
    The device presents a logical sector size that is smaller than
    the physical sector size. Aligning to a physical sector (or optimal
    I/O) size boundary is recommended, or performance may be impacted.
    Command (m for help):
    </code>

  3. 输入m,查看命令:
    <code>
    Command (m for help): m
    Command action
    a toggle a bootable flag
    b edit bsd disklabel
    c toggle the dos compatibility flag
    d delete a partition
    l list known partition types
    m print this menu
    n add a new partition
    o create a new empty DOS partition table
    p print the partition table
    q quit without saving changes
    s create a new empty Sun disklabel
    t change a partition's system id
    u change display/entry units
    v verify the partition table
    w write table to disk and exit
    x extra functionality (experts only)

Command (m for help):
</code>

  1. 输入n新建一个分区,输入p 建立分区,输入分区编号 1
    然后一路默认
  2. 输入w保存

XFS具有如下特点:

Now if you´d try to create one single large file system with ext4 on every linux distribution out there (including OEL 6.1; as of 18th August 2011) you will end up with:

 

四 格式化分区

1.格式化分区为XFS,使用mkfs.xfs命令。如果已有其他文件系统创建在此分区,必须加上"-f"参数来覆盖它。
sudo mkfs.xfs -f /dev/sdb1
2.格式化后分区来挂载。假设/mnt是XFS本地挂载点。使用下述命令挂载
sudo mount -t xfs /dev/sdb1 /mnt
3.验证XFS挂载是否成功:
df -Th /storage
4.如果你想要启动时自动挂载XFS分区在/storage上,加入下列行到/etc/fstab:
/dev/sdb1 /storage xfs defaults 0 0

参考文章:
Linux有问必答-如何创建和挂载XFS文件系统
linux 硬盘分区,分区,删除分区,格式化,挂载,卸载笔记

1、数据完全性

[root@localhost ~]# mkfs.ext4 /dev/iscsi/test mke4fs 1.41.9 (22-Aug-2009)
mkfs.ext4: Size of device /dev/iscsi/test too big to be expressed in 32 bit susing a blocksize of 4096.

XFS is a high-performance 64-bit journaling file system created by Silicon Graphics, Inc (SGI) in 1993.[6] It was the default file system in SGI's IRIX operating system starting with its version 5.3. XFS was ported to the Linux kernel in 2001; as of June 2014, XFS is supported by most Linux distributions, some of which use it as the default file system.

  采用XFS文件系统,当意想不到的宕机发生后,首先,由于文件系统开启了日志功能,所以你磁盘上的文件不再会意外宕机而遭到破坏了。不论目前文件系统上存储的文件与数据有多少,文件系统都可以根据所记录的日志在很短的时间内迅速恢复磁盘文件内容。

This post is about how to solve the issue.

 

2、传输特性

 

XFS excels in the execution of parallel input/output (I/O) operations due to its design, which is based on allocation groups (a type of subdivision of the physical volumes in which XFS is used- also shortened to AGs). Because of this, XFS enables extreme scalability of I/O threads, file system bandwidth, and size of files and of the file system itself when spanning multiple physical storage devices. XFS ensures the consistency of data by employing metadata journaling and supporting write barriers. Space allocation is performed via extents with data structures stored in B trees, improving the overall performance of the file system, especially when handling large files. Delayed allocation assists in the prevention of file system fragmentation; online defragmentation is also supported. A feature unique to XFS is the pre-allocation of I/O bandwidth at a pre-determined rate; this is suitable for many real-time applications. However, this feature was supported only on IRIX, and only with specialized hardware.

  XFS文件系统采用优化算法,日志记录对整体文件操作影响非常小。XFS查询与分配存储空间非常快。xfs文件系统能连续提供快速的反应时间。笔者曾经对XFS、JFS、Ext3、ReiserFS文件系统进行过测试,XFS文件文件系统的性能表现相当出众。

The demo system

My demo system consists of one large LUNof 18 TB encapsulated in LVM with a logical volume of 17 TB on a Oracle Enterprise Linux (OEL 5.5):

[root@localhost ~]# uname -a
Linux localhost.localdomain 2.6.18-194.el5 #1 SMP Mon Mar 29 22:10:29 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux

[root@localhost ~]# cat /etc/redhat-release Red Hat Enterprise Linux Server release 5.5 (Tikanga)

[root@localhost ~]# fdisk -l /dev/sdb
Disk /dev/sdb: 19791.2 GB, 19791209299968 bytes
255 heads, 63 sectors/track, 2406144 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table 

[root@localhost ~]# vgdisplay iscsi
--- Volume group ---
VG Name               iscsi
System ID
Format                lvm2
Metadata Areas        1
Metadata Sequence No  2
VG Access             read/write
VG Status             resizable
MAX LV                0
Cur LV                1
Open LV               0
Max PV                0
Cur PV                1
Act PV                1
VG Size               18.00 TB
PE Size               4.00 MB
Total PE              4718591
Alloc PE / Size       4456448 / 17.00 TB
Free  PE / Size       262143 / 1024.00 GB
VG UUID               tdi4f2-3ZYr-c1P0-NuSl-i3w2-5qQl-K75guj

[root@localhost ~]# lvdisplay iscsi
--- Logical volume ---
LV Name                /dev/iscsi/test
VG Name                iscsi
LV UUID                8q1UrT-ludC-FEkT-NExO-4Gzd-cn5H-FYJcB1
LV Write Access        read/write
LV Status              available
# open                 0
LV Size                17.00 TB
Current LE             4456448
Segments               1
Allocation             inherit
Read ahead sectors     auto
- currently set to     256
Block device           253:2

A notable XFS user, NASA Advanced Supercomputing Division, takes advantage of these capabilities deploying two 300 terabyte XFS filesystems on two SGI Altix archival storage servers, each of which is directly attached to multiple Fibre Channel disk arrays.[7]

3、可扩展性

Creating file systems  larger than 16TB with ext4:

If you try to create a ext4 file system on the 17 TB logical volume:

[root@localhost ~]# mkfs.ext4 /dev/iscsi/test mke4fs 1.41.9 (22-Aug-2009)
mkfs.ext4: Size of device /dev/iscsi/test too big to be expressed in 32 bit susing a blocksize of 4096.

OK. Maybe with ext4dev:

[root@localhost ~]# mkfs.ext4dev /dev/iscsi/test mke4fs 1.41.9 (22-Aug-2009)
mkfs.ext4dev: Size of device /dev/iscsi/test too big to be expressed in 32 bits using a blocksize of 4096.

Nope – no success. The reason behind that are the e2fsprogs (or how they are called on OEL: e4fsprogs) are not able to deal with file systems larger than ~ 16 TB.

To be specific: Even with the most recent e2fsprogs 1.41.14 there is no way to create file systems larger than 16 TB.

But: According to this post it should work since June:

It’s taken way too long, but I’ve finally finished integrating the 64-bit patches into e2fsprogs’s mainline repository. All of the necessary patches should now be in the master branch for e2fsprogs. The big change from before is that I replaced Val’s changes for fixing up how mke2fs picked the correct fs-type profile from mke2fs.conf with something that I think works much better and leaves the code much cleaner. With this change you need to add the following to your /etc/mke2fs.conf file if you want to enable the 64-bit feature flag automatically for a big disk:

[fs_types] ext4 = {
features = has_journal,extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize
auto_64-bit_support = 1 # <—- add this line
inode_size = 256
}

Alternatively you can change the features line to include the feature “64bit”; this will force the use of the 64-bit fields, and double the size of the block group descriptors, even for smaller file systems that don’t require the 64-bit support. (This was one of my problems with Val’s implementation; it forced the mke2fs.conf file to always enable the 64-bit feature flag, which would cause backwards compatibility issues.) This might be a good thing to do for debugging purposes, though, so this is an option which I left open, but the better way of doing things is to use the auto_64-bit-support flag.

So the change must be there. A short look at the ‘WIP’ (work-in-progress) branch of the e2fsprogrs confirmed the integration.

So i tried to build the most recent e2fsprogs (Remeber: This are *development* tools – use at your OWN RISK):

[root@vm-mkmoel ~] git clone git://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
[root@vm-mkmoel ~]# cd e2fsprogs
[root@vm-mkmoel e2fsprogs]# mkdir build ; cd build/
[root@vm-mkmoel build]# ../configure
[root@vm-mkmoel build]# make
[root@vm-mkmoel build]# make install

So let´s try to create a file system:

[root@vm-mkmoel misc]# ./mke2fs -O 64bit,has_journal,extents,huge_file,flex_bg, 
uninit_bg,dir_nlink,extra_isize -i 4194304 /dev/iscsi/test 

mke2fs 1.42-WIP (02-Jul-2011)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
4456448 inodes, 4563402752 blocks
228170137 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=6710886400
139264 block groups
32768 blocks per group, 32768 fragments per group
32 inodes per group

Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848, 512000000, 550731776, 644972544, 1934917632,
2560000000, 3855122432
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 0 mounts or 0 days,
whichever comes first.  Use tune2fs -c or -i to override.

OK. Seems to have worked. Lets check it:

[root@vm-mkmoel misc]# mount /dev/iscsi/test /mnt

[root@vm-mkmoel misc]# df -h
Filesystem                          Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00     18G  2.6G   14G  16% /
/dev/sda1                           99M  13M  82M    14% /boot
tmpfs                               502M 0    502M   0% /dev/shm
/dev/mapper/iscsi-test              17T  229M   17T   1% /mnt

[root@vm-mkmoel misc]# mount | grep mnt
/dev/mapper/iscsi-test on /mnt type ext4 (rw)

As you can see: With the most recent development e2fsprogrs it is possible to create ext4 file systems larger than 16 TB.

I even tried it with a 50 TB file system (because thats what i needed i my use case):

[root@vm-mkmoel misc]# df -h
Filesystem                          Size Used Avail Use% Mounted on
/dev/mapper/iscsi-test              50T  237M   48T   1% /mnt

 

澳门新濠3559,  XFS 是一个全64-bit的文件系统,它可以支持上百万T字节的存储空间。对特大文件及小尺寸文件的支持都表现出众,支持特大数量的目录。最大可支持的文件大小为263 = 9 x 1018 = 9 exabytes,最大文件系统尺寸为18 exabytes。

Update:

Today i tested some more user space tools.

 

4、传输带宽

fsck

Maybe the most important tool in case the journaling fails. I copied some data to the file system (roughly about 2 TB) and had 73% of my 6.5 million inodes (one inode per 8 MB) allocated. Running fsck on my demo system with 1 GB memory yields:

[root@vm-mkmoel ~]# fsck.ext4 -f /dev/iscsi/test
e2fsck 1.42-WIP (02-Jul-2011)
Pass 1: Checking inodes, blocks, and sizes
Error allocating block bitmap (4): Memory allocation failed

fsck is some kind of messy with memory. Increasing the memory to 8 GB did it. While running fsck i noticed a memory consumption of up to 3.4 GB! So large file systems require a lot of memory for fscking. It requires even more memory with more inodes!

百度百科上关于XFS的简介:

XFS 能以接近裸设备I/O的性能存储数据。在单个文件系统的测试中,其吞吐量最高可达7GB每秒,对单个文件的读写操作,其吞吐量可达4GB每秒。

resize2fs

After fscking my file system i tried to resize it:

[root@localhost sbin]# lvresize -l  7199 /dev/iscsi/test
  Extending logical volume test to 50.00 TB
  Logical volume test successfully resized

[root@localhost sbin]# resize2fs /dev/iscsi/test
resize2fs 1.42-WIP (02-Jul-2011)
resize2fs: New size too large to be expressed in 32 bits

As you can see resizing the file system is not yet supported/implemented. So it would be wise to create the file system with the final size from start since growing is NOT possible!

 

5、分配组(allocation groups)

tune2fs

tune2fs seems to work – at least it dumps the suberblock contents:

[root@localhost sbin]# tune2fs -l /dev/iscsi/test
tune2fs 1.42-WIP (02-Jul-2011)
Filesystem volume name:   <none>
Last mounted on:          /mnt/mnt
Filesystem UUID:          a754e947-8b89-415d-909d-000e6c95c44a
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery extent 64bit flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
Filesystem flags:         signed_directory_hash
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              6550000
Block count:              13414400000
Reserved block count:     670720000
Free blocks:              13394134177
Free inodes:              1484526
First block:              0
Block size:               4096
Fragment size:            4096
Reserved GDT blocks:      1024
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         16
Inode blocks per group:   1
Flex block group size:    16
Filesystem created:       Wed Oct 19 17:09:06 2011
Last mount time:          Wed Oct 19 18:45:47 2011
Last write time:          Wed Oct 19 18:45:47 2011
Mount count:              1
Maximum mount count:      20
Last checked:             Wed Oct 19 18:35:36 2011
Check interval:           0 (<none>)
Lifetime writes:          2511 MB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               256
Required extra isize:     28
Desired extra isize:      28
Journal inode:            8
Default directory hash:   half_md4
Directory Hash Seed:      ea117174-a04a-412e-a067-7972804f83d7
Journal backup:           inode blocks

Setting properties works as well:

[root@localhost sbin]# tune2fs -L test /dev/iscsi/test
tune2fs 1.42-WIP (02-Jul-2011)

[root@localhost sbin]# tune2fs -l /dev/iscsi/test | head -10
tune2fs 1.42-WIP (02-Jul-2011)
Filesystem volume name:   test
Last mounted on:          /mnt/mnt
[...]

XFS一种高性能的日志文件系统,最早于1993年,由Silicon Graphics为他们的IRIX操作系统而开发,是IRIX 5.3版的默认文件系统。2000年5月,Silicon Graphics以GNU通用公共许可证发布这套系统的源代码,之后被移植到Linux 内核上。XFS 特别擅长处理大文件,同时提供平滑的数据传输。

    当创建 XFS 文件系统时,底层块设备被分割成八个或更多个大小相等的线性区域(region)。分配组是唯一的,因为每个分配组管理自己的索引节点(inode)和空闲空间,实际上,是将这些分配组转化为一种文件子系统,这些子系统正确地透明存在于 XFS 文件系统内。

e4defrag

e4defrag is a new tool to defragment the ext4 file system. According to the man page:

e4defrag  reduces  fragmentation of extent based file. The file targeted by e4defrag is created on ext4 filesystem made with “-O extent” option (see  mke2fs(8)).   The  targeted  file gets more contiguous blocks and improves the file access speed.

I am not yet sure how this affects file systems used for oracle datafiles. All i can say is that e4defrag seems to work with >16 TB file systems:

 

[root@localhost sbin]# e4defrag /mnt/
ext4 defragmentation for directory(/mnt/)
[....]
        Success:                        [ 4772040/5065465 ]
        Failure:                        [ 293425/5065465 ]

The failures are from directories which cannot be defragmented.

 

 

6、分配组与可伸缩性

Conclusion

With the most recent e2fstools (1.42-WIP) it is possible to create ext4 file system larger than 16 TB.

If you do so remember the following:

  • the tool is still in development – use at your own risk!
  • tune the values for autocheck (after x mounts / after y days)
  • adjust the “-i” switch which defnes the bytes/inode ratio; in the example above one inode is created for every 8 MB
  • the more inodes you create the longer fsck takes and the more memory it needs
  • Resizing the file system (growing / shrinking) is NOT possible at the moment

 

 

  那么,XFS 到底为什么要有分配组呢?主要原因是,XFS 使用分配组,以便能有效地处理并行 IO。将 XFS 与某些高端硬件相结合,您将获得高端性能而不会使文件系统成为瓶颈。分配组还有助于在多处理器系统上优化并行 IO 性能,因为可以同时有多个元数据更新处于“在传输中”。

XFS相比于其它文件系统(ext3、ext4等)的优缺点:

7、B 树

 

    XFS使用高的表结构(B 树),保证了文件系统可以快速搜索与快速空间分配。XFS能够持续提供高速操作,文件系统的性能不受目录中目录及文件数量的限制。

 

8、日志记录

XFS是高性能文件系统,由于它的高性能,XFS成为了许多企业级系统的首选,特别是有大量数据,需要结构化伸缩性和稳定性的。例如,RHEL/CentOS 7 和Oracle Linux将XFS作为默认文件系统,SUSE/openSUSE已经为XFS做了长期支持。

  当然,XFS 也是一种日志记录文件系统,它允许意外重新引导后的快速恢复。象 ReiserFS 一样,XFS 使用逻辑日志;即,它不象 ext3 那样将文字文件系统块记录到日志,而是使用一种高效的磁盘格式来记录元数据的变动。

 

9、延迟分配XFS

XFS有许多独特的性能提升功能使他从众多文件系统中脱颖而出,像可伸缩/并行 IO,元数据日志,热碎片整理,IO 暂停/恢复,延迟分配等。

  通过将分配过程分成两个步骤来处理。首先,当 XFS 接收到要写入的新数据时,它在 RAM 中记录暂挂事务,并只在底层文件系统上 保留适当空间。

 

澳门新濠3559 1

XFS 文件系统有一些缺陷,例如它不能压缩,删除大量文件时性能低下

 

 

 

创建XFS文件系统

 

 

如果系统没有XFS系统工具集,那就必须必须安装(命令如下):

 

#sudo yum install xfsprogs

 

其实很多Linux系统将XFS作为默认文件系统,所以无需安装,如下所示, Centos 7.3就无需安装

 

[root@mylnx008 ~]# more /etc/redhat-release

CentOS Linux release 7.3.1611 (Core)

 

 

创建XFS格式分区,如下测试所示, 新增了一个300多G的磁盘

 

 

[root@mylnx008 ~]# fdisk -l

 

Disk /dev/sdb: 323.2 GB, 323196289024 bytes, 631242752 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

 

 

Disk /dev/sda: 33.3 GB, 33285996544 bytes, 65011712 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk label type: dos

Disk identifier: 0x000c1fec

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *        2048     1026047      512000   83  Linux

/dev/sda2         1026048    62914559    30944256   83  Linux

 

Disk /dev/sdc: 145.0 GB, 144955146240 bytes, 283115520 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 4096 bytes

I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk label type: dos

Disk identifier: 0x034b6e5c

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdc1            2048   283113471   141555712   83  Linux

 

[root@mylnx008 ~]# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.23.2).

 

Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.

 

Device does not contain a recognized partition table

Building a new DOS disklabel with disk identifier 0xafc7c358.

 

Command (m for help): n

Partition type:

   p   primary (0 primary, 0 extended, 4 free)

   e   extended

Select (default p): p

Partition number (1-4, default 1): 1

First sector (2048-631242751, default 2048): 

Using default value 2048

Last sector,  sectors or  size{K,M,G} (2048-631242751, default 631242751): 

Using default value 631242751

Partition 1 of type Linux and of size 301 GiB is set

 

Command (m for help): w

The partition table has been altered!

 

Calling ioctl() to re-read partition table.

Syncing disks.

 

格式化分区为XFS,使用mkfs.xfs命令。如果已有其他文件系统创建在此分区,必须加上"-f"参数来覆盖它。

 

[root@mylnx008 ~]# mkfs.xfs -f  /dev/sdb

meta-data=/dev/sdb               isize=512    agcount=4, agsize=19726336 blks

         =                       sectsz=512   attr=2, projid32bit=1

         =                       crc=1        finobt=0, sparse=0

data     =                       bsize=4096   blocks=78905344, imaxpct=25

         =                       sunit=0      swidth=0 blks

naming   =version 2              bsize=4096   ascii-ci=0 ftype=1

log      =internal log           bsize=4096   blocks=38528, version=2

         =                       sectsz=512   sunit=0 blks, lazy-count=1

realtime =none                   extsz=4096   blocks=0, rtextents=0

 

[root@mylnx008 ~]# df -T /dev/sdb

Filesystem     Type     1K-blocks  Used Available Use% Mounted on

devtmpfs       devtmpfs   1746644     0   1746644   0% /dev

[root@mylnx008 ~]# 

 

 

挂载XFS文件系统

 

 

[root@mylnx008 ~]# mkdir /mysql

[root@mylnx008 ~]# mount  -t  xfs  /dev/sdb  /mysql

[root@mylnx008 ~]#  df -T /dev/sdb

Filesystem     Type 1K-blocks  Used Available Use% Mounted on

/dev/sdb       xfs  315467264 32944 315434320   1% /mysql

[root@mylnx008 ~]# 

[root@mylnx008 ~]# df -h

Filesystem      Size  Used Avail Use% Mounted on

/dev/sda2        30G   22G  8.2G  73% /

devtmpfs        1.7G     0  1.7G   0% /dev

tmpfs           1.7G     0  1.7G   0% /dev/shm

tmpfs           1.7G   25M  1.7G   2% /run

tmpfs           1.7G     0  1.7G   0% /sys/fs/cgroup

/dev/sda1       497M   62M  436M  13% /boot

/dev/sdc1       133G  4.2G  122G   4% /mnt/resource

tmpfs           344M     0  344M   0% /run/user/1000

/dev/sdb        301G   33M  301G   1% /mysql

 

上面命令只对当前环境有效,如果要在启动时自动挂载XFS分区在/mysql上,必须配置/etc/fstab配置文件

 

[root@mylnx008 ~]# vi /etc/fstab

 

#

# /etc/fstab

# Created by anaconda on Mon Sep 25 21:44:42 2017

#

# Accessible filesystems, by reference, are maintained under '/dev/disk'

# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info

#

UUID=b7559ac5-b3a4-4b00-b98a-a2a2611806d0 /                       xfs     defaults        0 0

UUID=b98659b2-5f8c-493e-9304-658905ef1391 /boot                   xfs     defaults        0 0

/dev/sdb                                  /mysql                  xfs     defaults        0 0 

 

当如你也可以使用UUID替换对应的设备,如下所示,先找到对应设备的UUID,然后修改/etc/fastab

 

[root@mylnx008 ~]# blkid  /dev/sdb

/dev/sdb: UUID="6fcc5417-3c1b-4c71-aac7-344bac7654a4" TYPE="xfs" 

[root@mylnx008 ~]# blkid  /dev/sda2

/dev/sda2: UUID="b7559ac5-b3a4-4b00-b98a-a2a2611806d0" TYPE="xfs" 

[root@mylnx008 ~]# 

[root@mylnx008 ~]# vi /etc/fstab 

 

#

# /etc/fstab

# Created by anaconda on Mon Sep 25 21:44:42 2017

#

# Accessible filesystems, by reference, are maintained under '/dev/disk'

# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info

#

UUID=b7559ac5-b3a4-4b00-b98a-a2a2611806d0 /                       xfs     defaults        0 0

UUID=b98659b2-5f8c-493e-9304-658905ef1391 /boot                   xfs     defaults        0 0

UUID=6fcc5417-3c1b-4c71-aac7-344bac7654a4 /mysql                  xfs     defaults        0 0  

 

 

 

参考资料:

 

编辑:操作系统 本文来源:Graphics为他们的IRIX操作系统而开发澳门新濠3559:

关键词: 澳门新濠3559