大网数据广告活动
服务器运维问答

LVM cache in writeback mode is equivalent to external ext4 journal?

· 52CE 我爱测

I am running ext4 filesystems on LVM. The two big speedup options I'm looking at are, LVM cache and the external ext4 journal. It sounds like if I'm using a single SSD for this, LVM cache in writeback mode is the same thing as ha…

问题原文

原帖链接 · RobC · CC BY-SA 3.0

I am running ext4 filesystems on LVM. The two big speedup options I'm looking at are, LVM cache and the external ext4 journal.

It sounds like if I'm using a single SSD for this, LVM cache in writeback mode is the same thing as having your ext4 journal on an external device... basically if anything happens to it, you reset to the pre journal position.

Is this a correct interpretation?

已采纳解答

原帖链接 · Spooler · CC BY-SA 4.0

An external journal isn't the same thing as an LVM cache device at all. An LVM cache on an SSD for writeback wouldn't be volatile, so the concerns with data integrity aren't enormous (except for if that cache device(s) were to suddenly fail - and this cache device can actually be a RAID in of itself via Linux MD or similar).

An EXT4 intent journal consists of many small writes that benefit from a fast low-latency storage device, be it external or the same device that data is stored on. When using rotational media for data disks, this becomes relevant in highly random and transnational workloads.

A writeback cache coalesces writes together so writes are for the most part sequential but makes no distinction between data and metadata, or of the journal in particular. It will stand in front of all writes, caching everything and then queuing writes to the disk in as sequential a manner as possible during a flush given the cached data set. Flush commands are sent at the same time as write barrier commands (at a given interval), ensuring a non-corrupt state on its backing device.

If a writeback cache suddenly and completely dies, you will lose some time on your filesystem but it will still be consistent. (EDIT: this statement is directly disputed in the comments below which warn of severe filesystem corruption.) This can be mitigated with a RAID1 cache device.

If a journal device dies, you will be unable to mount your filesystem until discarding the journal device using # tune2fs -O ^has_journal /path/to/ext4device. In this case, you would have to repair this filesystem with a full fsck scan (which in some cases would take a LOT of time). You would also likely see corruption if this happened during or before a power loss.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-10-10)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。