xfs文件系统
引用http://blog.chinaunix.net/uid-522675-id-4665059.html xfs文件系统使用总结
1.3 xfs相关常用命令
xfs_admin: 调整 xfs 文件系统的各种参数
xfs_copy: 拷贝 xfs 文件系统的内容到一个或多个目标系统(并行方式)
xfs_db: 调试或检测 xfs 文件系统(查看文件系统碎片等)
xfs_check: 检测 xfs 文件系统的完整性
xfs_bmap: 查看一个文件的块映射
xfs_repair: 尝试修复受损的 xfs 文件系统
xfs_fsr: 碎片整理
xfs_quota: 管理 xfs 文件系统的磁盘配额
xfs_metadump: 将 xfs 文件系统的元数据 (metadata) 拷贝到一个文件中
xfs_mdrestore: 从一个文件中将元数据 (metadata) 恢复到 xfs 文件系统
xfs_growfs: 调整一个 xfs 文件系统大小(只能扩展)
xfs_freeze 暂停(-f)和恢复(-u)xfs 文件系统
xfs_logprint: 打印xfs文件系统的日志
xfs_mkfile: 创建xfs文件系统
xfs_info: 查询文件系统详细信息
xfs_ncheck: generate pathnames from i-numbers for XFS
xfs_rtcp: XFS实时拷贝命令
xfs_io: 调试xfs I/O路径
2.2 计算块使用
We want to use mysql on /dev/sda3, but how can we ensure that it is aligned with the RAID stripes? It takes a small amount of math:
Start with your RAID stripe size. Let’s use 64k which is a common default. In this case 64K = 2^16 = 65536 bytes. 默认尺寸是64K
Get your sector size from fdisk. In this case 512 bytes. 扇区大小512b
Calculate how many sectors fit in a RAID stripe. 65536 / 512 = 128 sectors per stripe. 每个条带大小128个扇区。
Get start boundary of our mysql partition from fdisk: 27344896. 查看mysql分区的起始数为27344896
See if the Start boundary for our mysql partition falls on a stripe boundary by dividing the start sector of the partition by the sectors per stripe: 27344896 / 128 = 213632. This is a whole number, so we are good. If it had a remainder, then our partition would not start on a RAID stripe boundary. 查看如果由起始扇区划分的起始边界落到条带的边界,再计算扇区数,得到一个整数。如果有余数,那么我们的分区不会从raid条带边界开始。
Create the Filesystem
XFS requires a little massaging (or a lot). For a standard server, it’s fairly simple. We need to know two things:
RAID stripe size
Number of unique, utilized disks in the RAID. This turns out to be the same as the size formulas I gave above:
RAID 1+0: is a set of mirrored drives, so the number here is num drives / 2.
RAID 5: is striped drives plus one full drive of parity, so the number here is num drives – 1.
In our case, it is RAID 1+0 64k stripe with 8 drives. Since those drives each have a mirror, there are really 4 sets of unique drives that are striped over the top. Using these numbers, we set the ‘su’ and ‘sw’ options in mkfs.xfs with those two values respectively.
2.3 格式化文件系统
通过以上实例总结执行命令 mkfs.xfs -d su=64k,sw=4 /dev/sda3
3. xfs文件系统的创建
3.1 默认方法
#mkfs.xfs /dev/sdc1
meta-data=/dev/sdc1 isize=256 agcount=18, agsize=1048576 blks
data = bsize=4096 blocks=17921788, imaxpct=25
= sunit=0 swidth=0 blks, unwritten=0
naming =version 2 bsize=4096
log =internal log bsize=4096 blocks=2187, version=1
= sunit=0 blks
realtime =none extsz=65536 blocks=0, rtextents=0
3.2 指定块和内部log大小
# mkfs.xfs -b size=1k -l size=10m /dev/sdc1
meta-data=/dev/sdc1 isize=256 agcount=18, agsize=4194304 blks
data = bsize=1024 blocks=71687152, imaxpct=25
= sunit=0 swidth=0 blks, unwritten=0
naming =version 2 bsize=4096
log =internal log bsize=1024 blocks=10240, version=1
= sunit=0 blks
realtime =none extsz=65536 blocks=0, rtextents=0
3.3 使用逻辑卷做为外部日志的卷
# mkfs.xfs -l logdev=/dev/sdh,size=65536b /dev/sdc1
meta-data=/dev/sdc1 isize=256 agcount=4, agsize=76433916
blks
= sectsz=512 attr=2
data = bsize=4096 blocks=305735663,
imaxpct=5
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0
log =/dev/sdh bsize=4096 blocks=65536, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
3.3 目录块
# mkfs.xfs -b size=2k -n size=4k /dev/sdc1
meta-data=/dev/sdc1 isize=256 agcount=4,
agsize=152867832 blks
= sectsz=512 attr=2
data = bsize=2048 blocks=611471327,
imaxpct=5
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0
log =internal log bsize=2048 blocks=298569, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
3.4 扩展文件系统
新增的空间不会使原有文件系统上的文件不会被改动,而且被增加的空间变成可用的附加的文件存储
XVM支持xfs系统的扩展
# xfs_growfs /mnt
meta-data=/mnt isize=256 agcount=30, agsize=262144 blks
data = bsize=4096 blocks=7680000, imaxpct=25
= sunit=0 swidth=0 blks, unwritten=0
naming =version 2 bsize=4096
log =internal bsize=4096 blocks=1200 version=1
= sunit=0 blks
realtime =none extsz=65536 blocks=0, rtextents=0
data blocks changed from 7680000 to 17921788
4. 文件系统的维护
4.1 碎片的整理
查看文件块状况: xfs_bmap -v file.tar.bz2
查看磁盘碎片状况: xfs_db -c frag -r /dev/sda1
整理碎片: xfs_fsr /dev/sda1
mountpoint与device要区别
挂载点
[root@my ~]# xfs_info /root
meta-data=/dev/mapper/centos-root isize=256 agcount=4, agsize=3110656 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0 finobt=0
data = bsize=4096 blocks=12442624, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=0
log =internal bsize=4096 blocks=6075, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
设备名,(下面输出比较多)
[root@my ~]# xfs_logprint /dev/mapper/centos-root|more
[root@my ~]# xfs_bmap /var/log/messages
/var/log/messages:
0: [0..119]: 6304..6423
1: [120..127]: 6440..6447
2: [128..135]: 6464..6471
[root@my ~]# xfs_bmap /var/log/secure
/var/log/secure:
0: [0..7]: 6424..6431
1: [8..15]: 6456..6463
2: [16..23]: 6592..6599
[root@my ~]# xfs_bmap -v /var/log/messages
/var/log/messages:
EXT: FILE-OFFSET BLOCK-RANGE AG AG-OFFSET TOTAL
0: [0..119]: 6304..6423 0 (6304..6423) 120
1: [120..127]: 6440..6447 0 (6440..6447) 8
2: [128..135]: 6464..6471 0 (6464..6471) 8
[root@my ~]# xfs_db -c frag -r /dev/xvda1
actual 326, ideal 324, fragmentation factor 0.61%
[root@my ~]# xfs_db -c frag -r /dev/xvda2
xfs_db: /dev/xvda2 is not a valid XFS filesystem (unexpected SB magic number 0x00000000)
Use -F to force a read attempt.
因为/dev/xvda2是一个pv,它没有包含文件系统
[root@my ~]# xfs_db -c frag -r /dev/mapper/centos-root
actual 20226, ideal 20092, fragmentation factor 0.66%
[root@my ~]# xfs_db -c frag -r /dev/centos/root
actual 20239, ideal 20103, fragmentation factor 0.67%
[root@my ~]# xfs_db -c frag -r /dev/dm-0
actual 20239, ideal 20103, fragmentation factor 0.67%
xfs文件系统的更多相关文章
- 16_用LVM扩展xfs文件系统(当分区空间不够时)
1. 查看当前卷组空间(volume group)使用情况 [root@localhost ~]# vgdisplay 从下面的代码中发现剩余空间为0 --- Volume group --- VG ...
- xfs文件系统磁盘配额
引言 这篇文章简单介绍一下xfs文件系统的磁盘配额配置. 文章目录 0×1.开启分区磁盘配额 0×2.使用xfs_quota命令配置磁盘配额 0×1.开启分区磁盘配额 对于ext4文件以前的文件系统, ...
- Linux高级运维 第四章 文件的基本管理和XFS文件系统备份恢复
4.1 Linux系统目录结构和相对/绝对路径 4.1.1系统目录结构 在windows系统中,查看文件先进入相应的盘符,然后进入文件目录 在windows中,它是多根 c:\ d:\ e ...
- 文件的基本管理和XFS文件系统备份恢复
4.1 Linux系统目录结构和相对/绝对路径 4.1.1系统目录结构 在WIN系统中,查看文件先进入相应的盘符,然后进入文件目录 在WIN中,它是多根 c:\ d:\ e:\ Linux ...
- Ubuntu下创建XFS文件系统的LVM
以前在Linux下面玩LVM,一般都是选择ext3.ext4格式的文件系统,最近在Ubuntu 16.04.5下安装配置一个MySQL数据库服务器,遂测试了一下XFS文件系统的LVM,其实仔细对比下来 ...
- XFS文件系统的备份和恢复
1.工具 XFS文件系统提供了xfsdump和xfsrestore来协助备份.恢复XFS文件系统中的数据,xfsdump按inode顺序来备份XFS文件系统,备份时不需要卸载文件系统,备份和恢复的过程 ...
- Centos 7 LVM xfs文件系统修复
Centos 7 LVM xfs文件系统修复 今天一大早,zabbix开始报警了,一台linux主机出现问题. 登陆控制台查看,报如下错误. 解决方法如下: ls -l /dev/mapper xfs ...
- ext与xfs文件系统比较与总结
centos7.0开始默认文件系统是xfs,centos6是ext4,centos5是ext3 1.EXT2简介 EXT2第二代扩展文件系统(英语:second extended filesystem ...
- 由异常掉电问题---谈xfs文件系统
由异常掉电问题---谈xfs文件系统 本文皆是作者自己的学习总结或感悟(linux环境),如有不对,欢迎提出一起探讨!! 目录结构 一.相关知识 二.问题提出 三.处理方法 四.最终结果 一.相关知识 ...
随机推荐
- ios应用数据存储方式
一.ios应用常用的数据存储方式 1.plist(XML属性列表归档) 2.偏好设置 3.NSKeydeArchiver归档(存储自定义对象) 4.SQLite3(数据库,关系型数据库,不能直接存储对 ...
- php大力力 [003节]php在百度文库的几个基础教程mac环境下文本编辑工具
2015-08-22 php大力力003.mac环境下文本编辑工具 在windows下,使用notepad特别多.在mac下使用“备忘录”app,word,反而没有存储过txt后缀等不同文本. mac ...
- Android的切图标准
最近总是有人在问我,Android怎么切图啊,怎么适配啊,不只是Android同行,还有很多新手ui设计师. 于是我就写篇文章,根据我们平时的开发经验,简单的介绍一下吧. 如果UI设计师以1920*1 ...
- 【转】oracle job相关内容
每天凌晨2点执行是这样的 dbms_job.submit(v_job,'lv;',TRUNC(sysdate+1)+2/24,'TRUNC(sysdate+1)+2/24'); 还有定义JOB最好是这 ...
- LeetCode Pow(x, n) (水题)
题意: 求浮点型x的n次幂结果. 思路: logN直接求,注意n可能为负数!!!当n=-2147483648的时候,千万别直接n=-n,这样的结果是多少?其他求法大同小异. class Solutio ...
- EL 表达式 取值将 < 转成 &1t 问题
因为用JeeCMS,JeeCMS后台会存入<p></p> 内容到数据库中 用play框架取后台值的时候 用的EL表达式在前台展示 出现将< 转成 &1t HTML ...
- 初识mySQL(关系型数据库)
一.数据库修改密码 ①先执行use mysql; ②再执行update mysql.user set password=PASSWORD(要修改的密码) where user='root' ; ...
- android内嵌入webview导致闪退
这里碰到的是各种闪退情况之一,webview退出后,程序里立马需要申请内存空间做别的事情,这时内存不够就会闪退,做法就是延时个几百毫秒,在这段时间内让java把该回收的内存都回收,然后延时到了再做接下 ...
- archlinux下查看机器的ip地址
问题原因 默认archlinux没有安装ifconfig这个在其它发行版中常用的命令,刚开始不知道怎么查看机器的ip. 解决方案 使用archlinux中已经安装的ip命令.在后面跟上addr, ro ...
- 高效而轻松的sed命令
sed(stream editor)是一款高效的流编辑器,它一次只处理一行内容,处理时,把当前处理的行存储在临时缓冲区中,称为“模式空间”(pattern space),接着用sed命令处理缓冲区中的 ...