Linux创建和挂载XFS文件系统测试实践
XFS文件系统简介
维基百科关于XFS的简介如下:
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 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.
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]
百度百科上关于XFS的简介:
XFS一种高性能的日志文件系统,最早于1993年,由Silicon Graphics为他们的IRIX操作系统而开发,是IRIX 5.3版的默认文件系统。2000年5月,Silicon Graphics以GNU通用公共许可证发布这套系统的源代码,之后被移植到Linux 内核上。XFS 特别擅长处理大文件,同时提供平滑的数据传输。
XFS相比于其它文件系统(ext3、ext4等)的优缺点:
XFS是高性能文件系统,由于它的高性能,XFS成为了许多企业级系统的首选,特别是有大量数据,需要结构化伸缩性和稳定性的。例如,RHEL/CentOS 7 和Oracle Linux将XFS作为默认文件系统,SUSE/openSUSE已经为XFS做了长期支持。
XFS有许多独特的性能提升功能使他从众多文件系统中脱颖而出,像可伸缩/并行 IO,元数据日志,热碎片整理,IO 暂停/恢复,延迟分配等。
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
参考资料:
https://linux.cn/article-4245-1.html
Linux创建和挂载XFS文件系统测试实践的更多相关文章
- linux 创建你的 /proc 文件
一旦你有一个定义好的 read_proc 函数, 你应当连接它到 /proc 层次中的一个入口项. 使用一个 creat_proc_read_entry 调用: struct proc_dir_ent ...
- Linux 系统磁盘挂载信息文件
设置文件系统挂载信息的文件(etc/fstab),使得开机能够自动挂载磁盘分区 文件系统挂载 方法一: 直接挂在,临时生效 # 格式化系统(没有格式化就没有文件系统,放不了数据) dd if=/dev ...
- Linux - 创建用户的相关文件
创建一个用户会与 6 个文件相关 /etc/passwd 储存了所有用户的相关信息 第一行中,从左往右 root 为用户名,: 为分隔符,x 为密码,0 为 uid,0 为 gid,root 为用户的 ...
- linux创建指定大小的文件
一.生成文件大小和实际占空间大小一样的文件 dd if=/dev/zero of=50M.file bs=1M count=50 dd if=/dev/zero of=20G.file bs=1G c ...
- linux使用mount挂载iso文件
mount -t iso9660 -o loop /home/user/XXX.iso /mnt/iso
- 如何在 Linux 中挂载 ISO 文件
在 Windows 中,我们常常使用 Daemon Tools 和 Virtual CloneDrive 等虚拟光驱软件挂载光盘镜像,下面我们一起来学习在 Linux 中如何挂载 ISO 文件. 在 ...
- Linux 系统必须掌握的文件_【all】
0.Linux 系统文件的详解 1.Linux 系统的网络配置文件 2.Linux 系统的DNS配置文件 3.Linux 系统的IP与域名解析文件[局域网的DNS] 4.Linux 系统的主机别名文件 ...
- 文件系统管理 之 Linux 创建文件系统及挂载文件系统流程详解
阅读此文,必须具备知识点:<Linux 查看磁盘分区.文件系统.使用情况的命令和相关工具介绍><实例解说 fdisk 使用方法><合理规划您的硬盘分区><Fe ...
- Linux文件系统测试工具
一.文件系统测试工具简介 1.LTP 参考网站:http://oss.sgi.com/projects/ltp/ LTP(Linux Test Project)是由SGI和IBM联合发起的项目,提供一 ...
随机推荐
- Saiku设置展示table数据不隐藏空的行数据信息(二十六)
Saiku设置展示table数据不隐藏空的行数据信息 saiku有个 非空的字段 按钮,点击这个后,会自动的把空的行数据信息给隐藏掉,这里我们来设置一下让其行数据不隐藏,为空的就为空. 主要更改两个文 ...
- spring统一错误响应设置
在类入口增加 @RestControllerAdvice注解.可以用于定义@ExceptionHandler.@InitBinder.@ModelAttribute,并应用到所有@RequestMap ...
- 剖析项目多个logback配置(下)
来源:http://www.cnblogs.com/guozp/p/5973038.html 上篇大概描述了logback的加载顺序以及加载的源码,本篇将分析如果在你的Maven或者其他多模块的项目中 ...
- 理解JavaScript的临时包装对象
Javascript语言中的对象和基础类型string.number.boolean都可以使用"."符号访问属性和方法,但是本质上只有对象才可以使用".",那么 ...
- spark能传递外部命名参数给main函数吗?
查了资料好像都没有办法.只能通过: def main(args: Array[String]): Unit = { // 读取参数 var city = args(0) var input = arg ...
- AspNetCore 文件上传(模型绑定、Ajax) 两种方式 get到了吗?
就目前来说,ASP.NET Core2.1了,已经相当成熟了,希望下个项目争取使用吧!! 上传文件的三种方式("我会的,说不定还有其他方式") 模型绑定 Ajax WebUploa ...
- 使用Spring Cloud搭建高可用服务注册中心
我们需要的,不仅仅是一个服务注册中心而已,而是一个高可用服务注册中心. 上篇博客[使用Spring Cloud搭建服务注册中心]中我们介绍了如何使用Spring Cloud搭建一个服务注册中心,但是搭 ...
- 带着萌新看springboot源码11(springboot启动原理 源码上)
通过前面这么多讲解,springboot原理应该也大概有个轮廓了,一些基本的配置,从客户端url到controller(配置一些要用的组件,servlet三大组件,处理器映射器,拦截器,视图解析器这些 ...
- CPU的load和使用率傻傻分不清
1. 什么是Cpu的Load 使用uptime.top或者查看/proc/loadavg都可以看到CPU的load统计,这里有三个值,分别代表1分钟.5分钟和15分钟的CPU Load情况.大部分人认 ...
- Asp.Net SignalR GlobalHost外部通知
GlobalHost 外部通知 之前都是在集线器类中进行服务器对客户端的通知操作,但是在开发中往往会有需求监控某个系统 ,比如OA系统 上级领导在上面宣布下午两点要开会 那么就要通知到其他的人.这里 ...