Linux的文件系统有点像MySQL的存储引擎,它支持各种各样的文件系统。它最上层是通过 virtual files system虚拟文件系统作为一个抽象接口层来对外提供调用的。然后下层的各种文件系统实现这些调用接口就行了。
1. Linux 中的 日志文件系统和非日志文件系统
文件内容的修改涉及到两部分:实际文件内容的修改 和 文件元(metadata)信息的修改。所以在修改一个成功之后,修改另一个之前,此时系统崩溃,就会导致两者的不一致。所以提出了日志文件系统的概念。
所谓的日志文件系统(Journaling file system),就是在实际修改文件内容和文件元信息之前,将他们的修改先写到一个日志中(journal log)。这样的话,如果发生系统崩溃,就可以使用日志进行恢复。当然,写日志会对文件系统的性能有一定的影响。除了ext2之外,其它文件系统几乎都是日志文件系统。
日志文件系统的处理过程是:1)先写日志;2)然后写实际的文件系统;3)删除日志;
日志文件系统又可以分成三种类型:
1)日志模式(journal): 将所有的元数据和数据改变均写入日志,对性能影响最大;
2)预定模式(ordered): 只记录元数据的变化, 在数据写入磁盘后再修改元数据,对性能影响中等;
3)写回模式(writeback): 只记录元数据的修改变化,对数据修改顺序无要求,对性能影响最小;
我们可以在/etc/fstab 文件中修改文件系统的日志模式。
/dev/sdb1 /testfs ext3 defaults,data=writeback 0 0
Linux 常用文件系统:
ext4, ext4, XFS, ReiserFS, JFS
其中最常用的是 ext4, XFS. 其中redhat7/centos7将XFS作为默认的文件系统。在最新内核的测试中XFS性能也明显超过ext4。所以对于mysql服务器,最好选择使用 XFS 文件系统。
关于 ssd上的ext4和xfs有一个比较:
https://www.percona.com/blog/2012/03/15/ext4-vs-xfs-on-ssd/
在rhel6.4之前ext4性能比xfs好,因为xfs有lock争用的bug。但是6.4开始,xfs的bug被fix了。所以xfs性能比ext4好。
在xfs的锁争用bug没有解决时:
sync async threads throughput throughput XFS ext4 XFS ext4 1 1.90/124k 1.41/92k 1.72/112k 1.41/92k 2 1.01/64k 1.65/108k 0.97/62k 1.65/108k 4 0.27/17k 1.55/102k 0.21/13k 1.55/102k 8 0.13/8k 1.45/95k 0.15/9k 1.45/95k 16 0.12/7k 1.45/95k 0.12/7k 1.45/95k
It’s pretty clear from these results that lock contention is killing XFS as the thread count grows. ext4 performance shows that it uses exclusive locking as well, but it is not degrading like XFS is due to different lock types being used.
但是当xfs的锁争用bug解决之后:
sync async threads throughput throughput vanilla patched vanilla patched 1 1.90/124k 1.83/120k 1.72/112k 1.69/111k 2 1.01/64k 2.85/185k 0.97/62k 2.57/168k 4 0.27/17k 3.68/241k 0.21/13k 3.41/223k 8 0.13/8k 4.42/290k 0.15/9k 4.16/273k 16 0.12/7k 4.95/325k 0.12/7k 4.86/319k
Throughput scales with thread count – each thread runs at 100% CPU utilsation, and XFS gets up to 3x as much throughput as ext4 does. So, basically, XFS is still the file system you want for direct IO。
挂在文件时的优化(noatime,nodiratime):
mount –t ext4 –o rw,noatime,nodiratime /dev/sda6 /data
noatime 会有0-10%的性能提升,一般平均会有3%的性能提升。
noatime:
Do not update inode access times on this filesystem (e.g, for faster access on the news spool to speed up news servers).
nodiratime:
Do not update directory inode access times on this filesystem.
noatime,nodiratime的配置也可以在/etc/fstab中进行。

wpsystem文件夹是windows应用文件夹;创建WpSystem文件夹是为了存储某些特定“Microsoft Store”应用程序的数据,因此建议不要删该文件夹,因为删除之后就无法使用指定的应用。

winreagent是在系统更新或升级的过程中创建的文件夹;该文件夹中通常包含临时文件,当更新或升级失败时,系统将通过还原先前创建的临时文件来回滚到执行更新或升级过程之前的版本。

baidunetdiskdownload是百度网盘默认下载文件的文件夹;百度网盘是百度推出的一项云存储服务,只要下载东西到百度网盘里,都会默认保存到这个文件夹中,并且可跨终端随时随地查看和分享。

“usmt.ppkg”是windows自带的系统还原功能的系统备份文件;Windows系统还原是在不需要重新安装操作系统,也不会破坏数据文件的前提下使系统回到原有的工作状态,PBR恢复功能的备份文件就是“usmt.ppkg”。

mobileEmuMaster是手机模拟大师的安装文件夹。手机模拟大师是PC电脑模拟运行安卓系统的免费模拟器程序,一款可以让用户在电脑上运行手机应用的软件,支持安装安卓系统中常见的apk执行文件,支持QQ、微信等生活常用应用,达到全面兼容的效果。

备份文件的扩展名通常是“.bak”;bak文件是一个备份文件,这类文件一般在'.bak前面加上应该有原来的扩展名,有的则是由原文件的后缀名和bak混合而成,在生成了某种类型的文件后,就会自动生成它的备份文件。

config是软件或者系统中的配置文件,不可以删除;该文件是在用户开机时对计算机进行初始化设置,也就是用户对系统的设置都由它来对计算机进行恢复,因此不能删除软件或者系统中的config配置文件,以免造成错误。

kml是谷歌公司创建的一种地标性文件格式;该文件用于记录某一地点或连续地点的时间、经度、纬度、海拔等地理信息数据,可以被“Google Earth”和“Google Maps”识别并显示。


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

Notepad++7.3.1
Easy-to-use and free code editor

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.