[Linux]Ext4 커널 문서

Ext4 Filesystem
===============

This is a development version of the ext4 filesystem, an advanced level
of the ext3 filesystem which incorporates scalability and reliability
enhancements for supporting large filesystems (64 bit) in keeping with
increasing disk capacities and state-of-the-art feature requirements.

Mailing list: linux-ext4@vger.kernel.org


1. Quick usage instructions:
===========================

  - Grab updated e2fsprogs from
    ftp://ftp.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs-interim/
    This is a patchset on top of e2fsprogs-1.39, which can be found at
    ftp://ftp.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/

  - It's still mke2fs -j /dev/hda1

  - mount /dev/hda1 /wherever -t ext4dev

  - To enable extents,

        mount /dev/hda1 /wherever -t ext4dev -o extents

  - The filesystem is compatible with the ext3 driver until you add a file
    which has extents (ie: `mount -o extents', then create a file).

    NOTE: The "extents" mount flag is temporary.  It will soon go away and
    extents will be enabled by the "-o extents" flag to mke2fs or tune2fs

  - When comparing performance with other filesystems, remember that
    ext3/4 by default offers higher data integrity guarantees than most.  So
    when comparing with a metadata-only journalling filesystem, use `mount -o
    data=writeback'.  And you might as well use `mount -o nobh' too along
    with it.  Making the journal larger than the mke2fs default often helps
    performance with metadata-intensive workloads.

2. Features
===========

2.1 Currently available

* ability to use filesystems > 16TB
* extent format reduces metadata overhead (RAM, IO for access, transactions)
* extent format more robust in face of on-disk corruption due to magics,
* internal redunancy in tree

2.1 Previously available, soon to be enabled by default by "mkefs.ext4":

* dir_index and resize inode will be on by default
* large inodes will be used by default for fast EAs, nsec timestamps, etc

2.2 Candidate features for future inclusion

There are several under discussion, whether they all make it in is
partly a function of how much time everyone has to work on them:

* improved file allocation (multi-block alloc, delayed alloc; basically done)
* fix 32000 subdirectory limit (patch exists, needs some e2fsck work)
* nsec timestamps for mtime, atime, ctime, create time (patch exists,
  needs some e2fsck work)
* inode version field on disk (NFSv4, Lustre; prototype exists)
* reduced mke2fs/e2fsck time via uninitialized groups (prototype exists)
* journal checksumming for robustness, performance (prototype exists)
* persistent file preallocation (e.g for streaming media, databases)

Features like metadata checksumming have been discussed and planned for
a bit but no patches exist yet so I'm not sure they're in the near-term
roadmap.

The big performance win will come with mballoc and delalloc.  CFS has
been using mballoc for a few years already with Lustre, and IBM + Bull
did a lot of benchmarking on it.  The reason it isn't in the first set of
patches is partly a manageability issue, and partly because it doesn't
directly affect the on-disk format (outside of much better allocation)
so it isn't critical to get into the first round of changes.  I believe
Alex is working on a new set of patches right now.

3. Options
==========

When mounting an ext4 filesystem, the following option are accepted:
(*) == default

extents                 ext4 will use extents to address file data.  The
                           file system will no longer be mountable by ext3.

journal=update          Update the ext4 file system's journal to the current
                              format.

journal=inum            When a journal already exists, this option is ignored.
                             Otherwise, it specifies the number of the inode which
                             will represent the ext4 file system's journal file.

journal_dev=devnum      When the external journal device's major/minor numbers
                                   have changed, this option allows the user to specify
                                  the new journal location.  The journal device is
                                  identified through its new major/minor numbers encoded
                                  in devnum.

noload                        Don't load the journal on mounting.

data=journal                All data are committed into the journal prior to being
                                 written into the main file system.

data=ordered    (*)     All data are forced directly out to the main file
                               system prior to its metadata being committed to the
                               journal.

data=writeback          Data ordering is not preserved, data may be written
                               into the main file system after its metadata has been
                              committed to the journal.

commit=nrsec    (*)     Ext4 can be told to sync all its data and metadata
                        every 'nrsec' seconds. The default value is 5 seconds.
                        This means that if you lose your power, you will lose
                        as much as the latest 5 seconds of work (your
                        filesystem will not be damaged though, thanks to the
                        journaling).  This default value (or any low value)
                        will hurt performance, but it's good for data-safety.
                        Setting it to 0 will have the same effect as leaving
                        it at the default (5 seconds).
                        Setting it to very large values will improve
                        performance.

barrier=1               This enables/disables barriers.  barrier=0 disables
                           it, barrier=1 enables it.

orlov           (*)     This enables the new Orlov block allocator. It is
                           enabled by default.

oldalloc                This disables the Orlov block allocator and enables
                           the old block allocator.  Orlov should have better
                           performance - we'd like to get some feedback if it's
                           the contrary for you.

user_xattr              Enables Extended User Attributes.  Additionally, you
                           need to have extended attribute support enabled in the
                           kernel configuration (CONFIG_EXT4_FS_XATTR).  See the
                           attr(5) manual page and http://acl.bestbits.at/ to
                           learn more about extended attributes.

nouser_xattr          Disables Extended User Attributes.

acl                     Enables POSIX Access Control Lists support.
                        Additionally, you need to have ACL support enabled in
                        the kernel configuration (CONFIG_EXT4_FS_POSIX_ACL).
                        See the acl(5) manual page and http://acl.bestbits.at/
                        for more information.

noacl                   This option disables POSIX Access Control List
                            support.

reservation

noreservation

bsddf           (*)        Make 'df' act like BSD.
minixdf                     Make 'df' act like Minix.

check=none              Don't do extra checking of bitmaps on mount.
nocheck

debug                       Extra debugging information is sent to syslog.

errors=remount-ro(*)  Remount the filesystem read-only on an error.
errors=continue         Keep going on a filesystem error.
errors=panic            Panic and halt the machine if an error occurs.

grpid                     Give objects the same group ID as their creator.
bsdgroups

nogrpid         (*)    New objects have the group ID of their creator.
sysvgroups

resgid=n              The group ID which may use the reserved blocks.

resuid=n              The user ID which may use the reserved blocks.

sb=n                    Use alternate superblock at this location.

quota
noquota
grpquota
usrquota

bh              (*)    ext4 associates buffer heads to data pages to
nobh                  (a) cache disk block mapping information
                         (b) link pages into transaction to provide
                         ordering guarantees.
                        "bh" option forces use of buffer heads.
                        "nobh" option tries to avoid associating buffer
                         heads (supported only for "writeback" mode).


Data Mode
---------
There are 3 different data modes:

* writeback mode
In data=writeback mode, ext4 does not journal data at all.  This mode provides
a similar level of journaling as that of XFS, JFS, and ReiserFS in its default
mode - metadata journaling.  A crash+recovery can cause incorrect data to
appear in files which were written shortly before the crash.  This mode will
typically provide the best ext4 performance.

* ordered mode
In data=ordered mode, ext4 only officially journals metadata, but it logically
groups metadata and data blocks into a single unit called a transaction.  When
it's time to write the new metadata out to disk, the associated data blocks
are written first.  In general, this mode performs slightly slower than
writeback but significantly faster than journal mode.

* journal mode
data=journal mode provides full data and metadata journaling.  All new data is
written to the journal first, and then to its final location.
In the event of a crash, the journal can be replayed, bringing both data and
metadata into a consistent state.  This mode is the slowest except when data
needs to be read from and written to disk at the same time where it
outperforms all others modes.

References
==========

kernel source:  <file:fs/ext4/>
                      <file:fs/jbd2/>

programs:       http://e2fsprogs.sourceforge.net/
                     http://ext2resize.sourceforge.net

useful links:   http://fedoraproject.org/wiki/ext3-devel
                    http://www.bullopensource.org/ext4/
  

크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기(0) 이올린에 추천하기(0)

Posted by 삐꾸강아쥐

2008/03/07 00:37 2008/03/07 00:37
, ,
Response
0 Trackbacks , 2 Comments
RSS :
http://blog.blog.n-nuri.com/rss/response/511

Trackback URL : http://blog.blog.n-nuri.com/trackback/511

Comments List

  1. 랜덤여신 2008/03/08 17:42 # M/D Reply Permalink

    벌써 ext4를 바라보는 단계가 되었군요. 세월 참 빨라요~

    1. 삐꾸강아쥐 2008/03/08 22:28 # M/D Permalink

      ^^ 뭐... 아직은... 좀 이르지 싶구요... 조만간...

      ext4 기반으로 가지 싶습니다.

Leave a comment
[로그인][오픈아이디란?]
출처 : http://www.ffnn.nl/media/articles/linux/serverwide-benchmark/serverwide-benchmark.pdf
저작권자의 요청이 있을경우 자삭 합니다.


^^ 유용한 자료 같아서... 참고 하시라고... 펌질해 봅니다...
실력이 없어서... 펌질만 하는구녀...ㅠㅠ

크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기

Posted by 삐꾸강아쥐

2008/03/06 23:49 2008/03/06 23:49
, ,
Response
0 Trackbacks , 0 Comments
RSS :
http://blog.blog.n-nuri.com/rss/response/508

Trackback URL : http://blog.blog.n-nuri.com/trackback/508

Leave a comment
[로그인][오픈아이디란?]
출처 : http://www.ibm.com/developerworks/kr/linux/library/l-fs8.html
저자 : Daniel Robbins, President/CEO, Gentoo Technologies, Inc
본 자료는 저작권자의 요청이 있을경우 자삭 합니다.

Linux 2.4에는 Reiserfs, XFS, GFS와 같은 새로운 파일시스템 기능이 추가되었다. 파일시스템은 좋은 것이긴 하지만 실제 생산환경에 적용하는 방법에 대해서는 정확히 모르고 있는 것도 사실이다. 이 시리즈를 통해 필자는 Linux 2.4에 새롭게 향상된 파일시스템을 설치하는 과정을 설명한다. 이번에도 계속해서 ext3을 연구한다. ext3의 “모든 것”을 밝힌다

이 글을 통해서 ext3을 설치하여 실행시키는 방법을 설명하고자 했었다. 하지만 그럴 필요가 없다. Andrew Morton의 "2.4 커널에서 ext3 파일시스템 사용하기 (Using the ext3 filesystem in 2.4 kernels)"(참고자료)에는 이미 ext3 실행 방법에 대해 훌륭하게 설명하고 있다. 굳이 설명을 반복할 필요는 없지 않은가? 대신, ext3의 핵심적이고 유용한 요소를 설명하겠다.

2.4 커널 업데이트

우선, 2.4 커널 업데이트로 시작해보자. ReiserFS를 다루면서 2.4 커널의 안정성에 대해서도 언급한 바 있다. 안정적인 2.4 커널을 찾는 것은 도전이 되는 건 사실이다. 생산환경에서 ReiserFS 파일시스템을 사용할 계획이 있다면 최신의 2.4.4-ac9 커널을 사용할 것을 권한다. 2.4.4-ac9 이후 많은 변화가 있었다. 새로운 커널을 검토 할 절호의 기회이다.

2.4.10 커널은 퍼포먼스와 확장성에 있어서 새로운 차원에 도달했다. 그 중 하나가 VM이다. Linus는 2.4 시리즈가 놀랍게 작동하지 않는다는 것을 인식하고 문제가 많은 리눅스의 VM 코드를 없애고 이것을 Andrea Archangeli의 VM 구현으로 대체했다. Andrea의 새로운 VM 구현(2.4.10에 처음 도입)은 정말로 대단하다. 커널의 속도를 높이고 반응성이 좋은 시스템으로 만든다. 2.4.10은 2.4 리눅스 커널 개발에 있어서 주요한 전환점은 아니였다. 2.4의 안정적인 커널 시스템에 주요한 변화를 이룩한 Linus의 용기에 감사해야 한다.

Andrea의 새로운 VM 코드가 커널의 나머지 부분과 완벽히 통합되기 위해서는 시간이 좀 더 필요하기 때문에 2.4.13+를 사용해야 한다. ext3 파일시스템 코드가 마침내 2.4.15-pre2 로 시작하는 공식적인 Linus의 커널에 통합되었기 때문에 2.4.16+를 사용해도 좋다. 2.4.16+ 커널을 사용하지 않을 이유가 없다. ext3을 좀더 쉽게 실행할 수 있다. 2.4.16+ 커널을 사용하려면 Andrew의 페이지(참고자료)에 설명되어 있는 대로 ext3 패치를 적용시킬 필요가 없다. Linus는 이것을 이미 추가했다 :)

2.4.15+ 보다 2.4.16+를 권장한다는 것에 주목하라. 합당한 이유가 있다. 2.4.15-pre9 커널에는 고약한 파일시스템 손상 버그도 나타났다. 2.4.16+ 커널을 사용하면 이를 피할 수 있다.

랩톱(laptop)

Ext3은 튼튼한 파일시스템이라는 명성을 얻고 있음에도 상당히 많은 랩톱 사용자들이 ext3으로 전환할 때 파일시스템 손상 문제를 경험하고 있다는 사실에 놀랐다. 이럴 경우 사람들은 ext3의 사용을 기피함으로서 이러한 종류의 보고에 대한 반응을 하곤 한다; 하지만, 사람들이 겪는 디스크 손상 문제들은 ext3 자체와는 아무런 관계가 없으며 특정 랩톱 하드웨어 드라이브에서 기인한다는 것을 알아냈다.

write cache

대부분의 드라이브는 "write chche"를 갖고 있다. 보류중인 쓰기 작동을 모으기 위해 하드 드라이브가 사용하는 것이다. 보류중인 쓰기를 cache에 놓음으로서 하드 드라이브 펌웨어(firmware)는 그들을 리오더(reorder)하고 그룹핑 하여 가능한 빠르게 디스크에 쓰여질 수 있도록 한다. write cache는 일반적으로 좋은 기능으로 간주된다 (참고자료).

불행하게도 특정 랩톱 하드 드라이브는 write cache를 디스크에 플러싱(flush)하는 모든 공식적인 ATA 요청을 무시하는 특징이 있다. 이러한 유형의 드라이브에는 특정한 블록이 실제로 디스크 플래터(platter)에 기록되었다는 것을 보장하는 방식이 없다. 비록 많은 문제가 있는 것처럼 들리지만 이러한 특정 문제 자체가 사람들이 경험하는 데이터 파손 문제의 원인은 아닐 것이다.

하지만 상황은 더욱 악화되었다. 몇몇 랩톱 하드 드라이브들은 시스템이 재부팅되거나 중지될 때마다 write cache를 버리는 고약한 습성이 있다. 분명히, 하드 드라이브가 이러한 문제를 가지고 있다면 규칙적인 데이터 손상을 리눅스가 막을 방법은 없다.

그렇다면 해결방법은 무엇인가? 랩톱을 사용하고 있다면 조심스럽게 다루길 바란다. 파일시스템에 큰 변경 작업을 수행하기 전에 중요한 파일을 백업하라. ext3 으로 인해 앞서 언급한 유형의 데이터 파손 문제를 경험했다면 랩톱 하드 드라이브에 문제가 있을 수 있다는 것도 염두하라. 그럴 경우, 랩톱 제조자와 상의하여 드라이브를 바꾸어야 한다. 이러한 약한 하드 드라이브들이 시장에서 사라지고 이러한 문제들 때문에 더이상 걱정 하지 않아도 되는 날이 오길 바란다.

이제부터, ext3의 다양한 데이터 저널링 옵션을 살펴보자.

저널링 옵션과 쓰기 레이턴시(write latency)

Ext3은 파일시스템을 마운트 할 때, 세 개의 데이터 저널링 모드 중 하나를 선택할 수 있다: data=writeback, data=ordered, data=journal.

저널 모드를 지정하기 위해서 적당한 스트링 (예를 들어, data=journal)을 /etc/fstab의 옵션 섹션에 추가할 수 있고 또는 mount를 직접 호출 할 때 -o data=journal 명령행 옵션을 지정할 수 있다. root 파일시스템에 사용 할 데이터 저널링 메소드를 지정하려면(data=ordered는 디폴트이다), rootflags 라는 특별한 커널 부트 옵션을 사용할 수 있다. root 파일시스템을 완전히 데이터 저널링 모드로 하고 싶다면 rootflags=data=journal을 커널 부트 옵션에 추가한다.

data=writeback 모드

data=writeback 모드에서, ext3은 데이터 저널링을 전혀 수행하지 않는다. XFS, JFS, ReiserFS 파일시스템과 유사한 저널링을 제공한다(metadata only). Part 7 에서 설명했지만, 이로인해 최근에 변경된 파일이 예견치 못한 재부팅의 경우에 손상된다. 이러한 단점에도 불구하고, data=writeback 모드는 대부분의 조건하에서 최상의 ext3 퍼포먼스를 제공한다.

data=ordered 모드

data=ordered 모드에서, ext3 만이 공식적으로 메타데이터를 저널링하지만 논리적으로 메타데이터와 데이터 블록을 트랜잭션이라는 하나의 단위로 그룹핑한다. 새로운 메타데이터를 디스크에 쓸 때, 연관된 데이터 블록들이 우선 쓰여진다. data=ordered 모드는 data=writeback mode와 대부분의 다른 저널 파일시스템의 손상 문제를 효과적으로 해결한다. 그리고 완전한 데이터 저널링 없이도 수행된다. 일반적으로, data=ordered ext3 파일시스템들은 data=writeback 파일시스템 보다 약간 느리게 수행되지만 전체 데이터 저널링에 있어서는 훨씬 빠르다.

데이터를 파일에 추가할 때, data=ordered 모드는 ext3의 전체 데이터 저널링 모드에서 제공되는 통합성을 제공한다. 하지만 파일의 일부가 겹쳐쓰기가 되거나 시스템 충돌이 될 때, 쓰여지고 있는 부분에는 원래 블록의 조합에 업데이트 된 블록이 포함된다. data=ordered가 어떤 블록이 먼저 겹쳐쓰기가 되는 지에 대해 보장할 수 업기 때문에 겹쳐쓰기가 된 블록 x가 업데이트 되었다고 해서 겹쳐쓰기가 된 블록 x-1 역시 업데이트 되었다는 것을 알 수 없다. 대신, data=ordered 는 쓰기 순서를 하드 드라이브의 write cache 까지 남겨놓는다. 일반적으로 이러한 제한은 부정적인 영향을 끼치지 않는다. 파일 추가는 일반적으로 파일 겹쳐쓰기 보다는 훨씬 더 일반적이기 때문이다. 이러한 이유로 인해서, data=ordered 모드는 전체 데이터 저널링의 훌륭한 대안이다.

data=journal 모드

data=journal 모드는 전체 데이터 및 메타데이터 저널링을 제공한다. 모든 새로운 데이터는 저널에 우선 먼저 쓰여지고 그런 다음 마지막 위치에 쓰여진다. 충돌이 일어날 때, 저널은 다시 작동될 수 있고 데이터와 메타데이터 모두를 영속적인 상태가 되도록 한다.

이론적으로는, data=journal 모드는 가장 느린 저널링 모드이다. 데이터는 디스크에 한 번이 아닌 두번 쓰여지기 때문이다. 하지만 특정 상황에서는, data=journal 모드는 놀랍도록 빠르다. ext3 data=journal 파일시스템이 사람들에게 믿을 수 없을 정도로 놀라운 퍼포먼스를 제공한다는 LKML 보고서를 접한 후 Andrew Morton은 작은 테스트를 수행했다. 우선 테스트 파일시스템에 데이터를 작성할 수 있는 간단한 쉘 스크립트를 만들었다:

Rapid writing


while true
do
	dd if=/dev/zero of=largefile bs=16384 count=131072
done

데이터가 테스트 파일시스템에 쓰여지는 동안 같은 디스크 상의 ext2 파일시스템에서 16Mb의 데이터 읽기를 시도하면서 시간을 쟀다:




16Mb 파일 읽기

time cat 16-meg-file > /dev/null

결과는 놀라웠다. data=journal 모드에서 16-meg-file은 다른 ext3 모드, ReiserFS, 심지어 ext2 (저널링 오버헤드가 없다) 보다 9 에서 13 배 정도 빠르게 읽혔다:

파일시스템 16-meg 읽기 시간 (초)
ext2 78
ReiserFS 67
ext3 data=ordered 93
ext3 data=writeback 74
ext3 data=journal 7

Andrew는 이 테스트를 반복하여 테스트 파일시스템에서16Mb 파일 읽기를 시도했다. 같은 결과가 나왔다. 이것은 무엇을 의미하는가? ext3's data=journal 모드는 데이터가 디스크에서 읽혀지고 디스크에 작성될 필요가 있는 곳에 알맞다. 따라서 ext3의 data=journal 모드는, 거의 모든 조건에서 모든 ext3 모드 중 가장 느린 것으로 간주된다. 실제로 인터랙티브 IO 퍼포먼스가 극대화되어야 하는 분주한 환경에서 중요한 퍼포먼스 이점을 가지고 있다. 무엇보다도, data=journal 모드는 그렇게 느리지 않다!

Andrew는 여전히 data=journal 모드가 다른 것 보다 훨씬 나은 퍼포먼스를 보이는 정확한 이유를 분석하고 있다. 필요한 트윅을 나머지 ext3에 추가하여 data=writebackdata=ordered 모드도 효과를 볼 수 있도록 할 것이다.

data=journal 트윅(tweak)

어떤 사람들은 분주한 NFS 서버에서 ext3의 data=journal 모드를 사용할 때 특별한 퍼포먼스 문제를 겪게된다. 30초 마다 서버는 disk-writing 작동이라는 "거대한 폭풍"을 경험한다. 이것은 시스템을 정지 시킬 정도의 위력을 갖고 있다. 여러분이 이러한 문제를 경험하고 있다면 픽스하는 것도 쉽다. root 로서 다음의 명령어를 입력하여 리눅스의 버퍼-플러싱(buffer-flushing) 알고리즘을 손보는 것이다:


Tweaking bdflush

echo 40 0 0 0 60 300 60 0 0 > /proc/sys/vm/bdflush

bdflush 설정을 새롭게 하면 kupdate가 0.6 초 마다 실행된다. 게다가, 그들은 커널에 30초가 아닌 3초 후에 버퍼를 플러싱하도록 명령한다. 최근에 변경된 데이터를 좀더 주기적으로 디스크에 플러시함으로서 이러한 "쓰기 폭풍"을 피할 수 있다. 이러한 방식으로 일을 수행하는 것은 효과적이지 않다. 커널이 write를 조합 할 기회가 적어지기 때문이다. 하지만 분주한 서버의 경우, write는 좀 더 지속적으로 발생하며 인터랙티브 퍼포먼스는 놀랍게 향상된다.

결론

ext3을 이것으로 끝마치려 한다. 다음 글에서 더욱 놀라운 파일시스템을 같이 연구해보도록 하자!

참고
developerWorks worldwide 사이트에서 이 기사에 관한 영어원문.

크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기(0) 이올린에 추천하기(0)

Posted by 삐꾸강아쥐

2008/03/06 23:14 2008/03/06 23:14
, , , , ,
Response
0 Trackbacks , 0 Comments
RSS :
http://blog.blog.n-nuri.com/rss/response/506

Trackback URL : http://blog.blog.n-nuri.com/trackback/506

Leave a comment
[로그인][오픈아이디란?]

블로그 이미지

http://blog.n-nuri.com 이 접속이 안 될경우 http://x2x.dnip.net 으로 접속해 주세요 공유하지 않는 지식은 썩은 물과 같다~~~!!!

- 삐꾸강아쥐

Archives

Recent Trackbacks

Calendar

«   2009/01   »
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

Site Stats

Total hits:
227690
Today:
41
Yesterday:
279
free counters