Linux创制和挂载XFS文件系统一测量检验试实行,设

XFS文件系统简单介绍

风流倜傥 XFS文件连串简单介绍

XFS是高质量文件系统,SGI为她们的I凯雷德IX平台而设计。自从二零零三年移植到Linux内核上,由于它的高性能,XFS成为了成百上千供销社级系统的首荐,极度是有大气数量,要求构造化伸缩性和安宁的。比如,卡宴HEL/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.

 

二 安装逼FS系统工具集

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 诞生了,并于 1993 年随 I路虎极光IX 5.3 的布告而利用于总结。它到现在仍作为 SGI 基于 ILANDIX 的成品(从职业站到极品Computer)的平底文件系统来接受。现在,XFS 也足以用于 Linux。XFS 的 Linux 版的降临是和颜悦色的,首先因为它为 Linux 社区提供了风流洒脱种健康的、出色的以致功效丰富的文件系统,并且这种文件系统所具备的可伸缩性能够知足最苛刻的储存要求。

ext4 was designed to allow far more larger file systems than ext3. According to wikipedia Linux创制和挂载XFS文件系统一测量检验试实行,设置为XFS文件系统。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、雷斯erFS文件系统实行过测量试验,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

 

  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蓬蓬勃勃种高品质的日志文件系统,最先于1995年,由Silicon Graphics为她们的IRIX操作系统而支出,是I大切诺基IX 5.3版的默许文件系统。2002年十一月,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 树卡塔尔(英语:State of Qatar),保证了文件系统能够高速寻觅与敏捷空间分配。XFS能够持续提供快捷操作,文件系统的品质不受目录中目录及文件数量的约束。

 

8、日志记录

XFS是高质量文件系统,由于它的高质量,XFS成为了众多商店级系统的首要推荐,特别是有雅量数码,供给布局化伸缩性和安乐的。举个例子,SportageHEL/CentOS 7 和Oracle Linux将XFS作为默许文件系统,SUSE/openSUSE已经为XFS做了悠久支撑。

  当然,XFS 也是大器晚成种日志记录文件系统,它同意意外再度指引后的比超级快复苏。象 雷斯erFS 同样,XFS 使用逻辑日志;即,它不象 ext3 那样将文字文件系统块记录到日志,而是选用后生可畏种高效的磁盘格式来记录元数据的变动。

 

9、延迟分配XFS

XFS有为数不菲出奇的品质提高效益使他从过多文件系统中脱颖而出,像可伸缩/并行 IO,元数据日志,热碎片收拾,IO 暂停/复苏,延迟分配等。

  通过将分配进度分成三个步骤来管理。首先,当 XFS 选取到要写入的新数据时,它在 RAM 中记录暂挂事务,并只在底层文件系统上 保留极其空间。

 

图片 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  

 

 

 

参照他事他说加以考查资料:

 

本文由星彩网app下载发布于星彩网app下载,转载请注明出处:Linux创制和挂载XFS文件系统一测量检验试实行,设

TAG标签: 星彩网app下载
Ctrl+D 将本页面保存为书签,全面了解最新资讯,方便快捷。