Chinaunix首页 | 论坛 | 博客
  • 博客访问: 8167349
  • 博文数量: 595
  • 博客积分: 13065
  • 博客等级: 上将
  • 技术积分: 10334
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-26 16:44
个人简介

推荐: blog.csdn.net/aquester https://github.com/eyjian https://www.cnblogs.com/aquester http://blog.chinaunix.net/uid/20682147.html

文章分类

全部博文(595)

分类: LINUX

2008-08-01 16:06:40

Multiple Journaling Modes in the ext3 Filesystem
Aside from its compatibility with ext2 filesystem utilities and the ease with which you can convert ext2 filesystems to ext3, the ext3 filesystem also offers several different types of journaling. A classic issue in journaling filesystems is whether they only log changes to filesystem metadata or log changes to all filesystem data, including changes to files themselves. The ext3 filesystem supports three different journaling modes, which you can activate in the /etc/fstab entry for an ext3 filesystem. These journaling modes are the following:

journal - logs all filesystem data and metadata changes. The slowest of the three ext3 journaling modes, this journaling mode minimizes the chance of losing the changes you have made to any file in an ext3 filesystem.

ordered - only logs changes to filesystem metadata, but flushes file data updates to disk before making changes to associated filesystem metadata. This is the default ext3 journaling mode.

writeback - only logs changes to filesystem metadata but relies on the standard filesystem write process to write file data changes to disk. This is the fastest ext3 journaling mode.

The differences between these journaling modes are both subtle and profound. Using the "journal" mode requires that an ext3 filesystem write every change to a filesystem twice - once to the journal, and then again to the filesystem itself. This can reduce the overall performance of your filesystem, but is the mode most beloved by users, because it minimizes the chances of losing changes to your files since both metatdata and data updates are recorded in the ext3 journal and can be replayed when a system reboots.

Using the "ordered" mode, only filesystem metadata changes are logged, which reduces redundancy between writing to the filesystem and to the journal and is therefore faster. Though the changes to file data are not logged, they must be done before associated filesystem metadata changes are made by the ext3 journaling daemon, which can slightly reduce the performance of your system. However, using this journaling mode guarantees that files in the filesystem will never be out of sync with any related changes to filesystem metadata.

Using the "writeback" mode is faster than the other two ext3 journaling modes because it only logs changes to filesystem metadata and does not wait for associated changes to file data to be written before updating things like file size and directory information. Because updates to file data are done asynchronously to journaled changes to filesystem metadata, files in the filesystem may exhibit metadata inconsistencies such as owning data blocks to which updated data was not yet written when the system went down. This isn't fatal, but can be disappointing to users.

Specifying the journaling mode used by an ext3 filesystem is done in the /etc/fstab entry for that filesystem. The "ordered" journaling mode is the default journaling mode by ext3 filesystems, but you can specify a different journaling mode by updating the filesystem options portion of an /etc/fstab entry. For example, an /etc/fstab entry that specifies the "writeback" journaling mode would look like the following:


/dev/hda5      /opt            ext3       data=writeback        1 0
阅读(3590) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~