[AIX 운영 체제와 장치 관리 42] 파일 시스템 형식 — JFS와 JFS2 비교, 조각과 블록, i-node, 크기 제한, 희소 파일, 데이터 압축, 온라인 백업과 스냅숏, CD-ROM·UDF

핵심 정리

  • JFS2는 AIX 6.1의 기본 파일 시스템으로 최대 파일 시스템 32TB, 최대 파일 16TB, 동적 i-node, B-트리 디렉터리를 지원합니다. JFS는 최대 1TB, 파일 약 63.876GB, 고정 i-node, 선형 디렉터리이며 압축을 지원합니다.
  • JFS는 디스크 공간을 5124096바이트 조각(fragment)으로, JFS2는 5124096바이트 블록으로 나눕니다. 작은 단위는 공간 낭비를 줄이지만 할당 작업과 할당 맵 부담이 늘어납니다.
  • JFS의 i-node 수는 NBPI와 할당 그룹 크기로 정해지며 최대 16M(2의 24제곱)개입니다. JFS2는 i-node를 필요할 때 할당합니다.
  • cp, mv(다른 파일 시스템), tar, cpio는 희소 파일을 보존하지 않고 backup, restore, pax는 보존합니다.
  • JFS2 스냅숏은 별도 논리 볼륨의 외부 스냅숏과 같은 논리 볼륨 안 .snapshot 디렉터리의 내부 스냅숏(6.1부터)이 있습니다. 내부 스냅숏은 fsck가 수리하면 지워지고 defragfs와 DMAPI를 쓸 수 없습니다.
항목 내용
버전 AIX 6.1 (내부 스냅숏, CD-ROM·UDF 절이 더해짐)
원문 Operating system and device management — 5.3판 117129쪽, 6.1판 444458쪽
관련 명령어 crfs, mkfs, lsfs, chfs, defragfs, fileplace, logform, fsck, logredo, backup, restore, pax, cdmount, smit mklvcopy, smit cplv
관련 서브루틴 statfs, stat, mmap, fsync, sync, readdir, link

AIX는 여러 파일 시스템 형식을 지원합니다.

다음과 같습니다.

JFS(Journaled File System) 또는 JFS2(Enhanced Journaled File System)

파일 시스템 의미 체계 전체를 지원합니다. 이 파일 시스템은 데이터베이스 저널링 기법으로 구조 일관성을 유지합니다. 그래서 시스템이 비정상으로 멈출 때 파일 시스템이 손상되지 않습니다.

각 JFS나 JFS2는 별도 논리 볼륨에 있습니다. 운영 체제는 초기화 때 파일 시스템을 마운트합니다. 이런 다중 파일 시스템 구성은 파일 트리 일부를 떼어 내 작업할 수 있게 하므로 백업, 복원, 수리 같은 시스템 관리 기능에 쓸모 있습니다.

JFS는 파일 시스템 명령 전체를 지원하는 기본 파일 시스템 형식입니다.

JFS2는 파일 시스템 명령 전체를 지원하는 기본 파일 시스템 형식입니다.

JFS와 JFS2의 차이 하나는 JFS2가 큰 파일과 큰 파일 시스템을 지원하도록 설계됐다는 점입니다.

NFS(Network File System)

원격 컴퓨터에 있는 파일과 디렉터리에 접근해 로컬처럼 쓸 수 있게 하는 분산 파일 시스템입니다. 예를 들어 사용자는 운영 체제 명령으로 원격 파일과 디렉터리를 만들고, 지우고, 읽고, 쓰고, 파일 속성을 설정할 수 있습니다.

CDRFS(CD-ROM File System)

일반 파일 시스템 인터페이스(open, read, close)로 CD-ROM 내용에 접근하게 합니다.

UDFS(DVD-ROM File System)

일반 파일 시스템 인터페이스로 DVD 내용에 접근하게 합니다.

관련 정보

  • 네트워크 파일 시스템

JFS와 JFS2

JFS(journaled file system)와 JFS2(enhanced journaled file system)는 기본 운영 체제에 들어 있습니다. 두 파일 시스템 형식 모두 파일과 디렉터리 데이터를 AIX LVM(Logical Volume Manager)이 저장과 검색에 쓰는 구조에 연결합니다.

차이 하나는 JFS2가 64비트 커널과 더 큰 파일을 수용하도록 설계됐다는 점입니다.

다음 절에서 이 파일 시스템을 설명합니다. 따로 적지 않는 한 다음 절은 JFS와 JFS2에 똑같이 적용됩니다.

JFS와 JFS2 기능

JFS2(Enhanced Journaled File System)는 기존 JFS(Journaled File System)보다 훨씬 큰 파일을 저장할 수 있는 파일 시스템입니다.

JFS와 JFS2 가운데 골라 구현할 수 있습니다. AIX 6.1의 기본 파일 시스템은 JFS2입니다.

참고: JFS와 달리 JFS2 파일 시스템은 디렉터리 형식 파일에 link() API를 쓰지 못하게 합니다. 이 제한 때문에 JFS 파일 시스템에서 바르게 동작하는 일부 응용 프로그램이 JFS2 파일 시스템에서 실패할 수 있습니다.

다음 표는 JFS와 JFS2 기능을 요약합니다.

기능 JFS2 JFS
조각과 블록 크기 블록 크기(바이트) 512, 1024, 2048, 4096 / 최대 파일 시스템 크기(TB) 4, 8, 16, 32 조각 크기(바이트) 512, 1024, 2048, 4096 / 최대 파일 시스템 크기(GB) 128, 256, 512, 1024
최대 파일 시스템 크기 32TB 1TB
최소 파일 시스템 크기 16MB 해당 없음
최대 파일 크기 16TB 약 63.876GB
i-node 수 동적, 디스크 공간에 따라 제한 고정, 파일 시스템 생성 때 설정
디렉터리 구성 B-트리 선형
압축 아니요 예
할당량 예 예
오류 기록 예 예

참고

  1. 32비트 커널에서 쓰면 최대 파일 크기와 최대 파일 시스템 크기는 (1TB - (물리 파티션 크기))로 제한됩니다. 예를 들어 볼륨 그룹의 물리 파티션 크기가 64MB이면 최대 파일 시스템 크기는 (1TB - 64MB) = (1048576MB - 64MB) = 1048512MB입니다. 32비트 커널에서 논리 볼륨 최대 크기에 걸린 기본 제한 때문입니다.
  2. JFS2는 표준 AIX 오류 기록 체계를 지원합니다. AIX 오류 기록에 관한 자세한 내용은 General Programming Concepts: Writing and Debugging Programs의 Error-Logging Overview를 봅니다.

JFS와 JFS2 디스크 공간 분할

많은 UNIX 파일 시스템은 파일과 디렉터리를 논리적으로 나누는 데 쓰는 논리 블록과 같은 크기 단위로만 연속 디스크 공간을 할당합니다. 이 할당 단위를 보통 디스크 블록이라 하며, 디스크 블록 하나는 파일이나 디렉터리의 논리 블록 하나에 든 데이터를 저장하는 데만 씁니다.

비교적 큰 논리 블록 크기(예: 4096바이트)를 쓰고 디스크 블록 할당을 논리 블록과 같은 크기로 유지하면 파일 시스템 작업 하나가 해야 하는 디스크 I/O 횟수가 줄어 유리합니다. 파일이나 디렉터리 데이터가 작은 디스크 블록 여럿이 아니라 큰 디스크 블록 몇 개에 저장됩니다. 예를 들어 논리 블록 크기가 4096바이트이면 4096바이트 이하 파일에는 4096바이트 디스크 블록 하나가 할당됩니다. 따라서 읽기나 쓰기 작업은 디스크 I/O 한 번으로 디스크 데이터에 접근합니다. 논리 블록 크기가 더 작아 같은 양의 데이터에 할당이 여러 번 필요하면 데이터 접근에 디스크 I/O가 여러 번 필요합니다. 큰 디스크 블록은 데이터를 더 많이 담으므로, 큰 논리 블록과 같은 디스크 블록 크기는 파일과 디렉터리에 새 데이터를 더할 때 해야 하는 디스크 공간 할당 작업량을 줄이는 데도 유리합니다.

그러나 디스크 공간 할당 단위를 논리 블록 크기로 제한하면 작은 파일과 디렉터리가 많은 파일 시스템에서 디스크 공간이 낭비될 수 있습니다. 파일이나 디렉터리의 부분 논리 블록에 논리 블록만큼의 디스크 공간을 할당하면 낭비가 생깁니다. 부분 논리 블록은 늘 논리 블록보다 적은 데이터를 담으므로 할당된 디스크 공간의 일부만 씁니다. 다른 파일이나 디렉터리는 이미 할당된 디스크 공간에 내용을 쓸 수 없으므로 나머지는 쓰이지 않습니다. 작은 파일과 디렉터리가 아주 많은 파일 시스템에서는 낭비되는 디스크 공간 총량이 클 수 있습니다.

JFS(journaled file system)는 디스크 공간을 조각(fragment)이라는 할당 단위로 나눕니다. JFS2(enhanced journaled file system)는 디스크 공간을 블록으로 나눕니다. 목적은 같습니다. 데이터를 효율적으로 저장하는 것입니다.

JFS 조각은 기본 디스크 할당 크기 4096바이트보다 작습니다. 조각은 파일이나 디렉터리의 부분 논리 블록 데이터를 더 효율적으로 저장해 디스크 공간 낭비를 줄입니다. JFS 조각 지원의 기능 동작은 BSD(Berkeley Software Distribution)의 조각 지원을 바탕으로 합니다.

JFS2는 512, 1024, 2048, 4096의 여러 파일 시스템 블록 크기를 지원합니다. 블록 크기가 작으면 파일이나 디렉터리의 부분 논리 블록 데이터를 더 효율적으로 저장해 디스크 공간 낭비를 줄입니다. 작은 블록 크기는 추가 운영 부담도 가져옵니다. JFS2의 블록 크기는 생성할 때 지정합니다. 파일 시스템마다 블록 크기가 다를 수 있지만 파일 시스템 하나 안에서는 블록 크기 하나만 쓸 수 있습니다.

관련 개념

  • JFS 데이터 압축 — JFS는 논리 블록을 전체 블록 크기 4096바이트보다 작은 단위, 곧 조각으로 디스크에 저장해 디스크 공간을 아끼는 조각화·압축 파일 시스템을 지원합니다.

JFS 조각

JFS에서는 디스크 공간 할당 단위를 조각이라 하며 논리 블록 크기 4096바이트보다 작을 수 있습니다.

4096바이트보다 작은 조각을 쓰면 부분 논리 블록 안 데이터를 담는 데 필요한 만큼의 조각만 써서 더 효율적으로 저장할 수 있습니다. 예를 들어 500바이트만 있는 부분 논리 블록에는 (조각 크기가 512바이트라면) 512바이트 조각 하나를 할당할 수 있어 낭비되는 디스크 공간을 크게 줄입니다. 부분 논리 블록의 저장 요구가 늘면 조각을 하나 이상 더 할당합니다.

파일 시스템의 조각 크기는 생성할 때 지정합니다. JFS(journaled file system)에 허용되는 조각 크기는 512, 1024, 2048, 4096바이트입니다. 파일 시스템마다 조각 크기가 다를 수 있지만 파일 시스템 하나 안에서는 조각 크기 하나만 쓸 수 있습니다. 사용자가 파일 시스템마다 가장 알맞은 조각 크기를 고를 수 있도록 한 시스템(기계)에 서로 다른 조각 크기가 함께 있을 수도 있습니다.

JFS 조각 지원은 파일 시스템을 디스크 블록의 연속이 아니라 조각의 연속으로 보여 줍니다. 그러나 디스크 작업 효율을 유지하려고 디스크 블록, 곧 할당 단위가 논리 블록과 같은 크기가 되도록 디스크 공간을 4096바이트 단위로 할당하는 경우가 많습니다. 이 경우 디스크 블록 할당은 연속 조각 4096바이트의 할당으로 볼 수 있습니다.

파일 시스템의 조각 크기가 작아질수록 운영 부담(추가 디스크 탐색, 데이터 전송, 할당 작업)과 디스크 공간 활용도가 모두 늘어납니다. 늘어난 부담과 늘어난 쓸 수 있는 디스크 공간 사이 최적 균형을 위해 JFS 조각 지원에는 다음이 적용됩니다.

  • 가능하면 파일이나 디렉터리 논리 블록에는 조각 4096바이트 할당을 유지합니다.
  • 32KB보다 작은 파일이나 디렉터리의 부분 논리 블록만 4096바이트보다 적은 조각을 할당받을 수 있습니다.

파일 시스템 안 파일과 디렉터리가 32KB를 넘게 자라면 부분 논리 블록에 4096바이트보다 적은 디스크 공간 할당을 유지하는 이점이 줄어듭니다. 전체 파일 시스템 공간 대비 디스크 공간 절약 비율은 작아지지만 작은 할당을 유지하는 추가 성능 비용은 그대로입니다. 4096바이트보다 적은 할당은 작은 파일과 디렉터리에 쓸 때 디스크 공간 활용이 가장 효과적이므로, 32KB 이상인 파일과 디렉터리의 논리 블록에는 늘 조각 4096바이트를 할당합니다. 그런 큰 파일이나 디렉터리의 부분 논리 블록에도 조각 4096바이트를 할당합니다.

JFS2 블록

JFS2(enhanced journaled file system)는 디스크 공간을 블록으로 나눕니다. JFS2는 512, 1024, 2048, 4096의 여러 파일 시스템 블록 크기를 지원합니다.

파일 시스템마다 블록 크기가 다를 수 있지만 파일 시스템 하나 안에서는 블록 크기 하나만 쓸 수 있습니다.

블록 크기가 작으면 파일이나 디렉터리의 부분 논리 블록 데이터를 더 효율적으로 저장해 디스크 공간 낭비를 줄입니다. 작은 블록 크기는 추가 운영 부담도 가져올 수 있습니다. 또 장치 드라이버는 파일 시스템 블록 크기와 같거나 더 작은 디스크 블록 주소 지정을 제공해야 합니다.

블록 크기가 4096바이트가 아닌 파일 시스템은 디스크 공간을 더 작은 단위로 할당하므로 파일이나 디렉터리 크기가 거듭 늘 때 할당 작업이 더 자주 일어날 수 있습니다. 예를 들어 블록 크기가 512바이트라면 길이 0인 파일을 512바이트 늘리는 쓰기 작업은 파일에 블록 하나를 할당합니다. 512바이트를 한 번 더 써서 늘리면 블록을 하나 더 할당해야 합니다. 같은 예를 4096바이트 블록 파일 시스템에 적용하면 디스크 공간 할당은 첫 쓰기 작업에서 한 번만 일어납니다. 처음 할당한 4096바이트 블록이 두 번째 쓰기가 더한 데이터를 담을 만큼 크므로 두 번째 쓰기에서는 추가 할당 작업이 없습니다.

파일 시스템 블록 크기는 파일 시스템을 만들 때 Web-based System Manager, SMIT(System Management Interface Tool), crfs와 mkfs 명령으로 지정합니다. 어떤 블록 크기를 고를지는 파일 시스템에 담길 파일의 예상 크기를 바탕으로 정해야 합니다.

파일 시스템 블록 크기는 Web-based System Manager, SMIT, lsfs 명령으로 알 수 있습니다. 응용 프로그램은 statfs 서브루틴으로 파일 시스템 블록 크기를 알 수 있습니다.

블록은 디스크 공간 할당의 기본 단위이며, 파일 시스템 안 각 블록의 할당 상태는 파일 시스템 블록 할당 맵에 기록됩니다. 블록 크기가 4096바이트보다 작은 파일 시스템은 블록 할당 맵을 담느라 가상 메모리와 파일 시스템 디스크 공간이 더 필요할 수 있습니다.

가변 i-node 수

디스크 공간을 4096바이트보다 작게 나누면 디스크 공간 활용이 최적화되지만, 파일 시스템 안에 저장할 수 있는 작은 파일과 디렉터리 수가 늘어납니다.

그러나 디스크 공간은 파일과 디렉터리에 필요한 파일 시스템 자원 가운데 하나일 뿐입니다. 파일이나 디렉터리마다 디스크 i-node도 필요합니다.

JFS와 i-node

JFS에서는 기본 디스크 i-node 수보다 많거나 적게 원할 때 파일 시스템 안에 만들 디스크 i-node 수를 지정할 수 있습니다.

파일 시스템 생성 때 디스크 i-node 수는 i-node당 바이트 수, 곧 NBPI라는 값으로 지정합니다. 예를 들어 NBPI 값이 1024이면 파일 시스템 디스크 공간 1024바이트마다 디스크 i-node 하나가 만들어집니다. 달리 보면 NBPI 값이 작으면(예: 512) i-node가 많고, 크면(예: 16,384) i-node가 적습니다.

JFS 파일 시스템에서는 파일 시스템에 할당된 할당 그룹 공간 NBPI바이트마다 i-node 하나를 만듭니다. 파일 시스템의 전체 i-node 수가 전체 파일 수와 파일 시스템 전체 크기를 제한합니다. 할당 그룹은 일부만 할당될 수 있지만 할당 그룹당 i-node는 전부 할당됩니다. NBPI는 파일 시스템의 전체 i-node 수에 반비례합니다.

JFS는 모든 파일 시스템의 i-node를 16M(2의 24제곱)개로 제한합니다.

허용되는 NBPI 값은 할당 그룹 크기(agsize)에 따라 다릅니다. 기본값은 8MB입니다. agsize가 8MB일 때 허용되는 NBPI 값은 512, 1024, 2048, 4096, 8192, 16,384입니다. 더 큰 agsize를 쓸 수 있습니다. agsize에 허용되는 값은 8, 16, 32, 64입니다. agsize가 커지면 허용되는 NBPI 범위도 함께 커집니다. agsize를 16MB로 두 배로 늘리면 NBPI 범위도 두 배가 됩니다. 1024, 2048, 4096, 8192, 16384, 32768입니다.

조각 크기와 NBPI 값은 파일 시스템을 만들 때 Web-based System Manager, SMIT, crfs와 mkfs 명령으로 지정합니다. 조각 크기와 만들 i-node 수는 파일 시스템에 담길 파일의 예상 수와 크기를 바탕으로 정합니다.

조각 크기와 NBPI 값은 Web-based System Manager, SMIT, lsfs 명령으로 알 수 있습니다. 응용 프로그램은 statfs 서브루틴으로 파일 시스템 조각 크기를 알 수 있습니다.

JFS2와 i-node

JFS2는 i-node를 필요할 때 할당합니다.

파일 시스템에 i-node를 더 둘 자리가 있으면 자동으로 할당됩니다. 따라서 쓸 수 있는 i-node 수는 파일 시스템 크기 자체로 제한됩니다.

JFS와 JFS2 크기 제한

JFS의 최대 크기는 파일 시스템을 만들 때 정합니다. JFS 크기를 얼마로 정할지는 몇 가지 중요한 문제를 바탕으로 결정합니다.

JFS2의 권장 최대 크기는 16TB입니다. JFS2의 최소 파일 시스템 크기는 16MB입니다.

할당 단위가 4096바이트보다 작은 파일 시스템은 기본 할당 단위 4096바이트를 쓰는 것보다 디스크 공간이 훨씬 적게 들지만, 작은 조각은 성능 비용을 부를 수 있습니다.

파일 시스템 안 각 조각(JFS)이나 블록(JFS2)의 할당 상태는 파일 시스템 할당 맵에 기록됩니다. 조각이나 블록 크기가 4096바이트보다 작은 파일 시스템은 할당 맵을 담느라 가상 메모리와 파일 시스템 디스크 공간이 더 필요할 수 있습니다.

조각(JFS)이나 블록(JFS2) 크기가 4096바이트가 아닌 파일 시스템은 디스크 공간을 더 작은 단위로 할당하므로 파일이나 디렉터리 크기가 거듭 늘 때 할당 작업이 더 자주 일어날 수 있습니다. 예를 들어 길이 0인 파일을 512바이트 늘리는 쓰기 작업은 파일 시스템 형식에 따라 512바이트 조각이나 블록 하나를 파일에 할당합니다. 512바이트를 한 번 더 써서 늘리면 조각이나 블록을 하나 더 할당해야 합니다. 같은 예를 4096바이트 조각이나 블록 파일 시스템에 적용하면 디스크 공간 할당은 첫 쓰기 작업에서 한 번만 일어납니다. 처음 할당한 4096바이트가 두 번째 쓰기가 더한 데이터를 담을 만큼 크므로 두 번째 쓰기에서는 추가 할당 작업이 필요 없습니다. 파일을 한 번에 4096바이트씩 늘리면 할당 작업을 최소화할 수 있습니다.

크기 관련 문제 하나는 파일 시스템 로그 크기입니다.

JFS에서는 대부분 여러 파일 시스템이 4MB로 구성된 공통 로그를 씁니다. 예를 들어 처음 설치한 뒤 루트 볼륨 그룹 안 모든 파일 시스템은 논리 볼륨 hd8을 공통 JFS 로그로 씁니다. 기본 논리 볼륨 파티션 크기는 4MB이고 기본 로그 크기는 파티션 하나이므로 루트 볼륨 그룹에는 보통 4MB JFS 로그가 있습니다. 파일 시스템이 2GB를 넘거나 로그 하나를 쓰는 파일 시스템 공간 총량이 2GB를 넘으면 기본 로그 크기가 모자랄 수 있습니다. 어느 경우든 파일 시스템 크기가 커지면 로그 크기도 늘립니다.

로그 논리 볼륨 크기를 바꾸면 새 공간을 쓰기 전에 logform 명령을 실행해 로그를 다시 초기화해야 합니다. JFS 로그는 최대 256MB로 제한됩니다.

JFS 로그 하나가 지원할 수 있는 파일 시스템 합계 크기에는 실질적 한계가 있습니다. 지침으로 JFS 로그 하나에는 전체 파일 시스템 용량 1조 바이트가 권장 한계입니다. 이 지침을 넘거나 거의 넘을 때, 또는 (fsck 명령이 부르는) logredo 명령에서 메모리 부족 오류가 나면 JFS 로그를 하나 더하고 두 JFS 로그 파일에 부하를 나눕니다.

JFS2에서도 대부분 여러 파일 시스템이 공통 로그를 씁니다. 파일 시스템이 2GB를 넘거나 로그 하나를 쓰는 파일 시스템 공간 총량이 2GB를 넘으면 기본 로그 크기가 모자랄 수 있습니다. 어느 경우든 파일 시스템 크기가 커지면 로그 크기를 늘리거나, JFS2 로그를 하나 더하고 두 JFS2 로그 파일에 부하를 나눌 수 있습니다.

JFS 크기 제한

JFS의 최대 크기는 파일 시스템을 만들 때 정합니다. NBPI, 조각 크기, 할당 그룹 크기가 결정 요인입니다.

파일 시스템 크기 한계는 다음 가운데 작은 값입니다.

  • NBPI * 2^24
  • 또는 FragmentSize * 2^28

예를 들어 NBPI 비율로 512를 고르면 파일 시스템 크기는 8GB(512 × 2의 24제곱 = 8GB)로 제한됩니다. JFS는 NBPI 값 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072를 지원합니다.

JFS는 모든 파일 시스템의 i-node를 16M(2의 24제곱)개로 제한합니다.

파일 시스템에 할당된 할당 그룹 공간 NBPI바이트마다 i-node 하나가 만들어집니다. 할당 그룹은 일부만 할당될 수 있지만 할당 그룹당 i-node는 전부 할당됩니다. NBPI는 파일 시스템의 전체 i-node 수에 반비례합니다.

JFS는 파일 시스템 공간을 i-node와 사용자 데이터용 디스크 블록 묶음으로 나눕니다. 이 묶음을 할당 그룹이라 합니다. 할당 그룹 크기는 파일 시스템을 만들 때 지정할 수 있습니다. 할당 그룹 크기는 8M, 16M, 32M, 64M입니다. 할당 그룹 크기마다 NBPI 범위가 있습니다. 범위는 다음 표와 같습니다.

할당 그룹 크기(MB) 허용 NBPI
8M 512, 1024, 2048, 4096, 8192, 16384
16M 1024, 2048, 4096, 8192, 16384, 32768
32M 2048, 4096, 8192, 16384, 32768, 65536
64M 4096, 8192, 16384, 32768, 65536, 131072

JFS는 연속 디스크 공간 512, 1024, 2048, 4096바이트 단위의 네 가지 조각 크기를 지원합니다. JFS는 i-node와 간접 블록에 조각 주소를 28비트 숫자로 유지합니다. 각 조각은 0부터 (2의 28제곱)까지의 숫자로 주소를 지정할 수 있어야 합니다.

JFS2 크기 제한

시험 결과 아주 큰 파일이 든 아주 큰 JFS2 파일 시스템이 작은 파일이 아주 많은 것보다 유지 보수하기 더 실용적이었습니다. 큰 파일 시스템에 작은 파일이 많으면 fsck 명령과 다른 파일 시스템 유지 보수 작업이 오래 걸립니다.

권장 크기 제한은 다음과 같습니다.

  • 최대 JFS2 파일 시스템 크기 — 32TB
  • 최대 JFS2 파일 크기 — 16TB
  • 최소 JFS2 파일 시스템 크기 — 16MB

JFS 빈 공간 조각화

JFS 파일 시스템에서 4096바이트보다 작은 조각을 쓰면 디스크 빈 공간이 더 심하게 조각날 수 있습니다.

예를 들어 512바이트 조각 여덟 개로 나뉜 디스크 영역을 생각해 봅니다. 512바이트씩 필요한 서로 다른 파일이 이 영역의 첫째, 넷째, 다섯째, 일곱째 조각에 써서 둘째, 셋째, 여섯째, 여덟째 조각이 비었다고 합시다. 2048바이트에 해당하는 조각 네 개가 비었지만, 할당 하나의 조각은 연속이어야 하므로 조각 네 개(2048바이트)가 필요한 부분 논리 블록에 이 빈 조각을 할당하지 않습니다.

파일이나 디렉터리 논리 블록에 할당하는 조각은 연속이어야 하므로, 빈 공간 전체 양이 충분해도 빈 공간 조각화 때문에 새 디스크 공간을 요청하는 파일 시스템 작업이 실패할 수 있습니다. 예를 들어 길이 0인 파일을 논리 블록 하나만큼 늘리는 쓰기 작업에는 연속 디스크 공간 4096바이트를 할당해야 합니다. 파일 시스템 빈 공간이 조각나 서로 떨어진 512바이트 조각 32개, 합계 16KB만 있다면 연속 조각 여덟 개(연속 디스크 공간 4096바이트)가 없으므로 쓰기 작업은 실패합니다.

다룰 수 없을 만큼 빈 공간이 조각난 JFS 파일 시스템은 defragfs 명령으로 조각 모음할 수 있습니다. defragfs 명령을 실행하면 성능에 좋은 영향을 줍니다.

희소 파일

파일은 색인된 블록의 연속입니다. 블록은 i-node에서 블록이 나타내는 파일의 논리 오프셋으로 매핑됩니다.

데이터 블록에 매핑되지 않은 색인이 하나 이상 있는 파일을 희소 할당 파일, 곧 희소 파일이라 합니다. 희소 파일에는 크기가 있지만 그 크기를 채우는 데이터 블록이 모두 할당되지는 않습니다. 파일이 희소 할당됐는지 알려면 fileplace 명령을 씁니다. 지금 할당되지 않은 파일 블록을 모두 보여 줍니다.

참고: 대부분의 경우 du로도 파일에 할당된 데이터 블록 수가 그 크기의 파일을 담는 데 필요한 수와 맞지 않는지 알 수 있습니다. 압축 파일 시스템에서는 희소 할당되지 않은 파일도 같은 모습을 보일 수 있습니다.

희소 파일은 응용 프로그램이 지금 할당된 색인 밖 위치로 탐색해 파일을 늘렸지만 쓴 데이터가 새로 지정한 색인을 다 차지하지 않을 때 만들어집니다. 새 파일 크기는 파일 안 가장 먼 쓰기를 반영합니다.

데이터 블록이 할당되지 않은 파일 부분을 읽으면 0으로 채운 버퍼가 돌아옵니다. 데이터 블록이 할당되지 않은 파일 부분에 쓰면 필요한 데이터 블록이 할당되고 데이터가 쓰입니다.

이 동작은 파일 조작이나 보관 명령에 영향을 줄 수 있습니다. 예를 들어 다음 명령은 파일의 희소 할당을 보존하지 않습니다.

  • cp
  • mv
  • tar
  • cpio

참고: mv는 파일을 다른 파일 시스템으로 옮길 때만 해당합니다. 같은 파일 시스템 안에서 옮기면 희소 상태가 유지됩니다.

위 명령으로 복사하거나 복원한 파일은 데이터 블록이 모두 할당되므로 희소 특성이 없습니다. 그러나 다음 보관 명령은 희소 특성을 보존하거나 파일을 적극적으로 희소하게 만듭니다.

  • backup
  • restore
  • pax

희소 파일로 파일 시스템 자원을 초과 약정할 수 있으므로 이런 파일을 쓰고 관리할 때 주의해야 합니다.

JFS와 큰 파일

JFS 파일 시스템 형식으로 큰 파일을 만들 수 있습니다.

모든 JFS2 파일 시스템은 큰 파일을 지원합니다.

큰 파일을 쓸 수 있는 파일 시스템은 crfs와 mkfs 명령으로 만들 수 있습니다. 두 명령 모두 큰 파일을 쓸 수 있는 파일 시스템을 지정하는 옵션(bf=true)이 있습니다. SMIT나 Web-based System Manager로도 이런 파일 시스템을 만들 수 있습니다.

큰 파일을 쓸 수 있는 파일 시스템에서 파일 오프셋 4MB 앞에 저장하는 파일 데이터는 4096바이트 블록으로 할당합니다. 파일 오프셋 4MB 뒤에 저장하는 파일 데이터는 128KB 크기의 큰 디스크 블록으로 할당합니다. 큰 디스크 블록은 실제로는 연속한 4096바이트 블록 32개입니다.

예를 들어 일반 파일 시스템에서 132MB 파일은 4KB 디스크 블록 33K개(4KB 디스크 주소 1024개씩 채운 단일 간접 블록 33개)가 필요합니다. 큰 파일을 쓸 수 있는 파일 시스템의 132MB 파일은 4KB 디스크 블록 1024개와 128KB 디스크 블록 1024개를 가집니다. 큰 파일 구조에서는 132MB 파일에 단일 간접 블록이 두 개만 필요합니다. 큰 파일과 일반 파일 형식 모두 이중 간접 블록 하나가 필요합니다.

큰 디스크 블록에는 연속한 4KB 블록 32개가 필요합니다. 파일 시스템에 쓰지 않은 연속 4KB 블록 32개가 없으면 파일 오프셋 4MB 너머 큰 파일에 쓰는 작업은 ENOSPC로 실패합니다.

참고: 파일 시스템에 빈 블록이 수천 개 있어도 그 가운데 32개가 연속하지 않으면 할당은 실패합니다.

defragfs 명령은 디스크 블록을 재구성해 더 큰 연속 빈 블록 영역을 마련합니다.

JFS는 모든 새 디스크 할당을 초기화해야 합니다. JFS는 시스템에서 큰 파일을 쓸 수 있는 첫 파일 시스템을 마운트할 때 처음 파일 할당을 0으로 채우는 데 쓰는 커널 kproc 프로시저를 시작합니다. kproc 프로시저는 큰 파일을 쓸 수 있는 파일 시스템의 마운트를 제대로 푼 뒤에도 남습니다.

JFS 데이터 압축

JFS는 논리 블록을 전체 블록 크기 4096바이트보다 작은 단위, 곧 조각으로 디스크에 저장해 디스크 공간을 아끼는 조각화·압축 파일 시스템을 지원합니다.

JFS2는 데이터 압축을 지원하지 않습니다.

조각화 파일 시스템에서는 32KB 이하 파일의 마지막 논리 블록만 이렇게 저장하므로, 조각 지원은 작은 파일이 많은 파일 시스템에만 이롭습니다. 그러나 데이터 압축은 크기와 상관없이 파일의 모든 논리 블록을 연속 조각 하나 이상으로 저장하게 합니다. 평균적으로 데이터 압축은 디스크 공간을 절반쯤 아낍니다.

그러나 조각과 데이터 압축을 쓰면 디스크 빈 공간이 조각날 가능성이 커집니다. 논리 블록에 할당하는 조각은 디스크에서 연속해야 합니다. 빈 공간이 조각난 파일 시스템은 빈 조각 총수가 논리 블록 요구를 넘더라도 논리 블록 할당에 필요한 연속 조각을 찾기 어려울 수 있습니다. JFS는 연속 빈 공간을 늘려 파일 시스템을 조각 모음하는 defragfs 프로그램으로 빈 공간 조각화를 완화합니다. 이 유틸리티는 조각화 파일 시스템과 압축 파일 시스템에 쓸 수 있습니다. 조각과 데이터 압축으로 얻는 디스크 공간 절약은 상당할 수 있으며 빈 공간 조각화 문제는 다룰 만한 수준으로 남습니다.

현재 JFS의 데이터 압축은 이 운영 체제의 이전 버전과 호환됩니다. 모든 시스템 호출로 이루어진 API는 두 버전의 JFS에서 같습니다.

관련 개념

  • JFS와 JFS2 디스크 공간 분할 — 많은 UNIX 파일 시스템은 논리 블록과 같은 크기 단위로만 연속 디스크 공간을 할당합니다.

JFS 데이터 압축 구현

데이터 압축은 crfs나 mkfs 명령으로 파일 시스템을 만들 때 지정하는 파일 시스템 속성입니다. Web-based System Manager나 SMIT로도 데이터 압축을 지정할 수 있습니다.

주의: 루트 파일 시스템(/)은 압축하면 안 됩니다. installp가 갱신과 새 설치를 위해 크기를 정확히 계산할 수 있어야 하므로 /usr 파일 시스템 압축은 권장하지 않습니다.

압축은 그런 파일 시스템의 일반 파일과 긴 심볼릭 링크에만 적용됩니다. 압축하지 않는 디렉터리와 메타데이터에는 계속 조각 지원이 적용됩니다. 파일의 각 논리 블록은 디스크에 쓰기 전에 따로 압축됩니다. 이렇게 압축하면 더 큰 단위로 압축할 때보다 확보하는 디스크 공간을 조금만 잃으면서 임의 탐색과 갱신이 쉬워집니다.

압축한 뒤 논리 블록은 보통 4096바이트보다 적은 디스크 공간이 필요합니다. 압축한 논리 블록은 디스크에 쓰이고 저장에 필요한 연속 조각 수만큼만 할당받습니다. 논리 블록이 압축되지 않으면 압축하지 않은 형태로 디스크에 쓰이고 연속 조각 4096바이트를 할당받습니다.

lsfs -q 명령은 압축의 현재 값을 보여 줍니다. Web-based System Manager나 SMIT로도 데이터 압축 여부를 알 수 있습니다.

JFS 데이터 압축의 암묵적 동작

파일을 쓰는 프로그램은 쓰기(매핑된 파일이면 저장)가 성공한 뒤 공간 부족(ENOSPC) 상황이 생기리라 예상하지 않으므로, 논리 블록을 디스크에 쓸 때 공간이 있음을 보장해야 합니다.

이를 위해 논리 블록을 처음 수정할 때 4096바이트를 할당해 블록이 압축되지 않아도 디스크 공간이 있게 합니다. 4096바이트 할당을 할 수 없으면 압축한 논리 블록을 담을 디스크 공간이 있더라도 시스템은 ENOSPC나 EDQUOT 오류를 돌려줍니다. 공간 부족을 너무 일찍 보고하는 일은 디스크 할당량 한계 가까이에서 동작하거나 파일 시스템이 거의 찼을 때 가장 잘 생깁니다.

압축 파일 시스템은 다음 동작도 보일 수 있습니다.

  • 논리 블록에 처음에 4096바이트를 할당하므로 일부 시스템 호출이 ENOSPC나 EDQUOT 오류를 받을 수 있습니다. 예를 들어 mmap 시스템 호출로 오래된 파일을 매핑하고, 이전에 쓴 위치에 저장하는 작업이 ENOSPC 오류를 낼 수 있습니다.
  • 데이터 압축에서는 수정한 블록이 디스크에 쓰일 때까지 전체 디스크 블록이 할당된 채 남습니다. 블록에 이전에 전체 블록보다 적은 할당이 확정돼 있었다면 블록이 묶어 두는 디스크 공간은 둘의 합이며, 이전 할당은 파일(i-node)이 확정될 때까지 풀리지 않습니다. 일반 조각도 마찬가지입니다. 파일에서 이전 확정 할당을 가질 수 있는 논리 블록 수는 일반 조각에서는 많아야 하나지만 압축에서는 파일의 블록 수만큼 될 수 있습니다.
  • 논리 블록의 이전 확정 자원은 응용 프로그램이 fsync나 sync 시스템 호출을 실행할 때까지 하나도 풀리지 않습니다.
  • stat 시스템 호출은 파일에 할당된 조각 수를 알려 줍니다. 보고하는 수는 수정했지만 쓰지 않은 블록에 할당한 4096바이트와 수정하지 않은 블록의 압축 크기를 바탕으로 합니다. 이전 확정 자원은 stat 시스템 호출이 세지 않습니다. 수정한 블록이 하나도 압축되지 않았다면 stat 시스템 호출은 i-node 확정 작업 뒤 할당된 조각 수를 바르게 보고합니다. 마찬가지로 디스크 할당량은 현재 할당에 대해 부과됩니다. 파일의 논리 블록이 디스크에 쓰이면서 압축되면 할당된 조각 수가 줄어 디스크 할당량과 stat 결과가 바뀝니다.

관련 개념

  • JFS 데이터 압축 구현 — 데이터 압축은 crfs나 mkfs 명령으로 파일 시스템을 만들 때 지정하는 속성입니다.

JFS 데이터 압축 알고리즘

압축 알고리즘은 LZ의 IBM 버전입니다. 일반적으로 LZ 알고리즘은 어떤 문자열이 두 번째부터 나올 때 첫 출현 위치와 길이를 가리키는 포인터로 나타내 데이터를 압축합니다.

압축을 시작할 때는 찾은 문자열이 없으므로 적어도 첫 바이트는 9비트(0,byte)가 필요한 "원시" 문자로 나타내야 합니다. 어느 만큼의 데이터, 예를 들어 N바이트를 압축한 뒤 압축기는 다음에 처리할 바이트부터 시작하는 문자열과 맞는 가장 긴 문자열을 N바이트 안에서 찾습니다. 가장 긴 일치의 길이가 0이나 1이면 다음 바이트를 "원시" 문자로 인코딩합니다. 그렇지 않으면 문자열을 (pointer,length) 쌍으로 나타내고 처리한 바이트 수를 length만큼 늘립니다. 구조적으로 IBM LZ는 N 값으로 512, 1024, 2048을 지원합니다. IBM LZ는 (pointer,length) 쌍과 원시 문자의 인코딩을 정합니다. pointer는 크기가 log2 N인 고정 길이 필드이고 length는 가변 길이 필드로 인코딩합니다.

JFS 데이터 압축의 성능 비용

데이터 압축은 조각 지원의 확장이므로 조각에 관련된 성능이 데이터 압축에도 적용됩니다.

압축 파일 시스템은 다음과 같이 성능에도 영향을 줍니다.

  • 데이터를 압축하고 풀 때 시간이 많이 걸릴 수 있어 일부 사용자 환경에서는 압축 파일 시스템의 쓸모가 제한될 수 있습니다.
  • 대부분의 UNIX 일반 파일은 한 번만 쓰지만 일부는 제자리에서 갱신됩니다. 후자에서 데이터 압축은 논리 블록을 처음 수정할 때 4096바이트를 할당하고 논리 블록을 디스크에 쓴 뒤 다시 할당해야 하는 추가 성능 비용이 있습니다. 압축하지 않은 파일 시스템의 일반 파일에는 이런 추가 할당 작업이 필요 없습니다.
  • 데이터 압축은 프로세서 주기를 늘립니다. 소프트웨어 압축기는 압축에 바이트당 약 50주기, 풀기에 바이트당 약 10주기가 듭니다.

JFS 온라인 백업과 JFS2 스냅숏

JFS 파일 시스템이나 JFS2 파일 시스템의 특정 시점 이미지를 만들어 백업에 쓸 수 있습니다. 그러나 이 이미지의 요구 사항과 동작은 파일 시스템 형식마다 다릅니다.

JFS 파일 시스템에서는 파일 시스템 미러 사본의 읽기 전용 정적 사본을 떼어 낼 수 있습니다. 보통 미러 사본은 원래 파일 시스템이 갱신될 때마다 갱신되지만 이 시점 사본은 바뀌지 않습니다. 사본을 만든 시점의 안정된 이미지로 남습니다. 이 이미지를 백업에 쓰면 이미지 생성 절차를 시작한 뒤 시작한 수정은 백업 사본에 없을 수 있습니다. 따라서 분리하는 동안 파일 시스템 활동을 최소로 하는 것이 좋습니다. 분리한 뒤 생긴 변경은 백업 사본에 없습니다.

JFS2 파일 시스템에서는 시점 이미지를 스냅숏이라 합니다. 스냅숏은 정적으로 남으며 스냅숏을 만들 때 원래 파일 시스템(snappedFS라 함)이 가졌던 보안 권한을 그대로 유지합니다. 또 파일 시스템 마운트를 풀거나 멈추지 않고 JFS2 스냅숏을 만들 수 있습니다. JFS2 스냅숏은 파일 시스템의 온라인 백업으로, 스냅숏을 찍을 때 있던 파일이나 디렉터리에 접근하는 데, 이동식 매체로 백업하는 데 쓸 수 있습니다. JFS2 스냅숏에 관해 다음을 알아 둡니다.

  • 루트(/)나 /usr 파일 시스템의 스냅숏 이미지는 시스템을 다시 부팅하면 덮어씁니다. 다른 파일 시스템의 스냅숏은 다시 부팅하기 전에 파일 시스템 마운트를 풀어 보존할 수 있습니다. AIX 5.2 with 5200-01에서 만든 스냅숏은 복구할 수 있습니다. AIX 5.2 with 5200-01에서 만든 스냅숏이 있는 JFS2 파일 시스템에 fsck나 logredo를 실행하면 스냅숏이 보존됩니다. AIX 5.2에서 만든 스냅숏이 있고 마운트를 깨끗이 푼 파일 시스템도 AIX 5.2 with 5200-01 시스템에 마운트하면 복구할 수 있습니다.
  • 스냅숏이 있는 파일 시스템에 defragfs 명령을 실행하는 것은 권장하지 않습니다. 조각 모음 중 옮기는 블록마다 스냅숏에도 복사해야 하므로 시간이 걸리고 스냅숏 논리 볼륨 공간도 낭비합니다.
  • 스냅숏 공간이 다 차면 그 snappedFS의 스냅숏이 모두 지워집니다. 이 실패는 오류 로그에 항목을 씁니다.
  • 스냅숏 쓰기가 실패하면 그 snappedFS의 스냅숏이 모두 지워집니다. 이 실패는 오류 로그에 항목을 씁니다.
  • AIX 5.2 with 5200-01 시스템에서 만들거나 접근한 스냅숏은 AIX 5.2 시스템에서 접근할 수 없습니다. 파일 시스템을 마운트하기 전에 이 스냅숏을 지워야 합니다.
  • AIX 5.3에서 스냅숏이 있는 JFS2 파일 시스템은 AIX 5.2 with 5200-01 이전 릴리스에서 접근할 수 없습니다. 시스템을 되돌리려면 먼저 스냅숏을 지워야 파일 시스템에 접근할 수 있습니다.

JFS 온라인 백업

JFS 파일 시스템의 특정 시점 이미지를 만들어 백업에 쓸 수 있습니다.

JFS 파일 시스템에서는 파일 시스템 미러 사본의 읽기 전용 정적 사본을 떼어 낼 수 있습니다. 보통 미러 사본은 원래 파일 시스템이 갱신될 때마다 갱신되지만 이 시점 사본은 바뀌지 않습니다. 사본을 만든 시점의 안정된 이미지로 남습니다. 이 이미지를 백업에 쓰면 이미지 생성 절차를 시작한 뒤 시작한 수정은 백업 사본에 없을 수 있습니다. 따라서 분리하는 동안 파일 시스템 활동을 최소로 하는 것이 좋습니다. 분리한 뒤 생긴 변경은 백업 사본에 없습니다.

JFS2 스냅숏

JFS2 파일 시스템의 특정 시점 이미지를 만들어 백업에 쓸 수 있습니다.

JFS2 파일 시스템의 시점 이미지를 스냅숏이라 합니다. 스냅숏은 정적으로 남으며 스냅숏을 만들 때 원래 파일 시스템(snappedFS)이 가졌던 보안 권한을 그대로 유지합니다. 또 파일 시스템 마운트를 풀거나 멈추지 않고 JFS2 스냅숏을 만들 수 있습니다. JFS2 스냅숏으로 다음을 할 수 있습니다.

  • 스냅숏을 찍을 때 있던 파일이나 디렉터리에 접근합니다.
  • 이동식 매체로 백업합니다.

JFS2 스냅숏에는 내부와 외부 두 종류가 있습니다. JFS2 외부 스냅숏은 파일 시스템과 별도 논리 볼륨에 만들어집니다. 외부 스냅숏은 파일 시스템과 따로 고유한 마운트 지점에 마운트할 수 있습니다.

JFS2 내부 스냅숏은 파일 시스템과 같은 논리 볼륨에 만들어지며 파일 시스템에서 블록을 할당합니다. 내부 스냅숏은 스냅숏이 있는 JFS2 파일 시스템 루트의 보이지 않는 .snapshot 디렉터리에서 접근할 수 있습니다. JFS2 파일 시스템은 만들 때 내부 스냅숏을 지원하도록 설정해야 합니다.

JFS2 스냅숏은 파일 시스템 할당량 확인을 지원하지 않습니다. 스냅숏에 repquota 명령을 써서 할당량 상태를 알 수 없습니다. 파일 시스템 이미지를 스냅숏 이미지로 되돌리면 시점의 할당량 정보가 보존됩니다. JFS2 외부 스냅숏과 내부 스냅숏에 특유한 다음 고려 사항을 알아 둡니다.

  • AIX 5.2 with 5200-01 시스템에서 만들거나 접근한 외부 스냅숏은 AIX 5.2 시스템에서 접근할 수 없습니다. 파일 시스템을 마운트하기 전에 이 스냅숏을 지워야 합니다.
  • AIX 5.3에서 스냅숏이 있는 JFS2 파일 시스템은 AIX 5.2 with 5200-01 이전 릴리스에서 접근할 수 없습니다. 시스템을 되돌리려면 먼저 스냅숏을 지워야 파일 시스템에 접근할 수 있습니다.
  • 외부 스냅숏이 있는 JFS2 파일 시스템에 defragfs 명령을 실행하는 것은 권장하지 않습니다. 조각 모음 중 옮기는 블록마다 스냅숏에도 복사해야 하므로 시간이 걸리고 스냅숏 논리 볼륨 공간도 낭비합니다.
  • 외부 스냅숏 공간이 다 차거나 외부 스냅숏이 실패하면 그 snappedFS의 외부 스냅숏이 모두 무효로 표시됩니다. 이후 스냅숏 접근은 실패합니다. 이 실패는 오류 로그에 항목을 씁니다.

내부 JFS2 스냅숏 고려 사항

  • 내부 스냅숏이 있는 JFS2 파일 시스템에 logredo 명령을 실행하면 내부 스냅숏은 보존됩니다.
  • fsck 명령이 JFS2 파일 시스템을 수리하려고 고쳐야 하면 내부 스냅숏은 지워집니다.
  • 내부 스냅숏 공간이 다 차거나 내부 스냅숏 쓰기가 실패하면 그 snappedFS의 내부 스냅숏이 모두 무효로 표시됩니다. 이후 내부 스냅숏 접근은 실패합니다. 이 실패는 오류 로그에 항목을 씁니다.
  • 내부 스냅숏은 따로 마운트할 수 없습니다. 내부 스냅숏은 만든 즉시 파일 시스템 루트의 .snapshot 디렉터리에서 접근할 수 있습니다. 그래서 스냅숏용 마운트 지점을 따로 내보내지 않고도 NFS 서버를 거쳐 내부 스냅숏에 접근할 수 있습니다.
  • 내부 스냅숏은 AIX 6.1 이전 릴리스와 호환되지 않습니다. 내부 스냅숏을 지원하도록 만든 JFS2 파일 시스템은 이전 AIX 릴리스에서 수정할 수 없습니다.
  • 내부 스냅숏을 지원하도록 만든 JFS2 파일 시스템은 확장 속성 버전 2(Extended Attributes Version 2)도 지원합니다.
  • 내부 스냅숏이 있는 JFS2 파일 시스템은 DMAPI(Data Management Application Programming Interface)와 함께 쓸 수 없습니다.
  • 내부 스냅숏이 있는 JFS2 파일 시스템에는 defragfs 명령을 쓸 수 없습니다.
  • .snapshot 디렉터리는 readdir() 시스템 호출이 돌려주지 않습니다. 그래서 의도치 않게 스냅숏을 돌아다니지 않습니다. readdir() 시스템 호출에 의존하는 시스템 호출이나 명령은 .snapshot 디렉터리에서 실패합니다(예: .snapshot 디렉터리에서 /bin/pwd 명령과 getcwd() 시스템 호출은 부모 디렉터리를 찾지 못합니다).

호환성과 이전

JFS 파일 시스템은 AIX 5.1과 AIX 5.2 안에서 완전히 호환됩니다. 운영 체제의 이전 지원 버전은 현재 JFS와 호환되지만, 기본값이 아닌 조각 크기, NBPI 값, 할당 그룹 크기를 쓰는 파일 시스템은 이전 버전으로 옮길 때 특별히 주의해야 할 수 있습니다.

참고: JFS 파일 시스템은 섹터 크기가 4KB인 디스크에서 지원하지 않습니다. 따라서 파일 시스템을 만들거나 백업 작업을 할 때 디스크 섹터 크기가 4KB가 아닌지 확인합니다.

JFS2 파일 시스템은 스냅숏을 빼면 AIX 5.1과 AIX 5.2 안에서 호환되지만 운영 체제의 그보다 이전 버전과는 호환되지 않습니다. 스냅숏이 있는 JFS2 파일 시스템은 AIX 5.1에서 지원하지 않습니다. logredo 명령이 이후 릴리스용으로 만든 파일 시스템에 꼭 실행되는 것은 아니므로, 이전 AIX 버전으로 되돌리기 전에 늘 모든 JFS2 파일 시스템의 마운트를 깨끗이 풉니다.

참고: v2 형식으로 만들거나 변환한 JFS2 파일 시스템은 이전 AIX 릴리스에서 접근할 수 없습니다.

다음은 운영 체제의 이전 버전에서 만든 파일 시스템에서 문제를 일으킬 수 있는 점입니다.

JFS 파일 시스템 이미지

기본 조각 크기와 NBPI 값 4096바이트, 기본 할당 그룹 크기(agsize) 8로 만든 JFS 파일 시스템 이미지는 특별한 이전 작업 없이 AIX 4.3 이후 버전에서 만든 JFS 파일 시스템 이미지와 서로 바꿔 쓸 수 있습니다.

참고: JFS2 스냅숏 — AIX 5L Version 5.2 with the 5200-01 Recommended Maintenance package에서 만들거나 접근한 JFS2 스냅숏은 이전 릴리스에서 접근할 수 없습니다. 파일 시스템을 마운트하기 전에 이 스냅숏을 지워야 합니다.

JFS 파일 시스템 사이 백업과 복원

블록 크기가 다른 JFS 파일 시스템 사이에서도 백업과 복원을 할 수 있지만, 원본 파일 시스템 블록 크기가 대상 파일 시스템 블록 크기보다 작으면 디스크 사용량이 늘어 빈 블록이 모자라 복원 작업이 실패할 수 있습니다. 이 점은 파일 시스템 전체 백업과 복원에서 특히 중요하며, 대상 파일 시스템 전체 크기가 원본보다 커도 생길 수 있습니다.

압축 파일 시스템에서 압축하지 않은 파일 시스템으로, 또는 조각 크기가 다른 압축 파일 시스템 사이에서도 백업과 복원을 할 수 있지만, 압축 파일 시스템은 디스크를 더 알뜰하게 쓰므로 디스크 공간이 모자라 복원 작업이 실패할 수 있습니다. 이 점은 파일 시스템 전체 백업과 복원에서 특히 중요하며, 대상 파일 시스템 전체 크기가 원본보다 커도 생길 수 있습니다.

JFS와 JFS2 장치 드라이버 제한

장치 드라이버는 JFS 파일 시스템 조각 크기나 JFS2 블록 크기와 같거나 더 작은 디스크 블록 주소 지정을 제공해야 합니다. 예를 들어 사용자가 제공한 RAM 디스크 장치 드라이버에 JFS 파일 시스템을 만들었다면, 512바이트 조각을 쓰는 파일 시스템을 담으려면 드라이버가 512바이트 블록을 허용해야 합니다. 드라이버가 페이지 단위 주소 지정만 허용하면 조각 크기가 4096바이트인 JFS만 쓸 수 있습니다.

JFS를 다른 물리 볼륨으로 복사

파일 시스템 무결성을 유지하면서 JFS 파일 시스템을 다른 물리 볼륨으로 복사할 수 있습니다.

다음 시나리오는 파일 시스템 무결성을 유지하면서 JFS 파일 시스템을 다른 물리 볼륨으로 복사하는 방법을 설명합니다.

이 방법 시나리오의 정보는 특정 AIX 버전으로 시험했습니다. 얻는 결과는 AIX 버전과 수준에 따라 크게 다를 수 있습니다.

파일 시스템 무결성을 유지하면서 JFS를 다른 물리 볼륨으로 복사하려면 다음을 합니다.

  1. 복사할 파일 시스템의 활동을 멈춥니다. 파일 시스템을 쓰는 응용 프로그램이 멈춰 있거나 파일 시스템이 알고 있는 상태가 아니면 백업 데이터에 무엇이 들었는지 알 수 없습니다.
  2. 명령행에 다음 SMIT 빠른 경로를 입력해 논리 볼륨을 미러합니다.
text
smit mklvcopy
  1. 다음 명령으로 파일 시스템을 복사합니다.
text
chfs -a splitcopy=/backup -a copy=2 /testfs

-a 플래그의 splitcopy 매개변수는 명령이 파일 시스템의 미러 사본을 떼어 내 새 마운트 지점에 읽기 전용으로 마운트하게 합니다. 이렇게 하면 백업에 쓸 수 있는 일관된 저널 메타데이터를 가진 파일 시스템 사본이 생깁니다. 4. 미러 사본을 다른 마운트 지점으로 옮기려면 다음 SMIT 빠른 경로를 씁니다.

text
smit cplv

이제 파일 시스템 사본을 쓸 수 있습니다.

관련 정보

  • mklv 명령

CD-ROM 파일 시스템과 UDF 파일 시스템

CD-ROM 파일 시스템(CDRFS)은 CD-ROM 매체, 쓰기 방지한 CD-RW 매체, DVD-ROM 매체에 저장할 수 있는 읽기 전용 로컬 파일 시스템 구현입니다. CDRFS 최대 파일 크기는 매체와 상관없이 2GB입니다. UDF(Universal Disk Format) 파일 시스템은 DVD-ROM 매체에는 읽기 전용으로, DVD-RAM 매체에는 읽기·쓰기로 저장할 수 있는 쓰기 가능한 로컬 파일 시스템 구현입니다.

CD는 기본으로 자동 마운트되지만 이 기능을 끌 수 있습니다. 기능을 껐다면 cdmount 명령으로 CDRFS 파일 시스템을 마운트합니다.

AIX는 다음 CDRFS 볼륨과 파일 구조 형식을 지원합니다.

  • ISO 9660:1988(E) 표준 — CDRFS는 ISO 9660 교환 수준 3과 구현 수준 1을 지원합니다.
  • High Sierra Group Specification — ISO 9660보다 앞선 것으로 이전 CD-ROM과의 하위 호환성을 제공합니다.
  • Rock Ridge Group Protocol — ISO 9660 표준을 완전히 따르는 ISO 9660 확장을 정하며, SUSP(System Use Sharing Protocol)와 RRIP(Rock Ridge Interchange Protocol)를 바탕으로 POSIX 파일 시스템 의미 체계를 모두 제공해 다른 UNIX 파일 시스템처럼 CD-ROM을 마운트하고 접근하게 합니다.
  • CD-ROM eXtended Architecture File Format(Mode 2 Form 1 섹터 형식만) — CD-ROM XA(eXtended Architecture) 파일 형식은 Photo CD 같은 CD-ROM 기반 멀티미디어 응용 프로그램에 쓰는 ISO 9660 확장을 정합니다.

모든 볼륨과 파일 구조 형식에 다음 제한이 적용됩니다.

  • 단일 볼륨 볼륨 세트만
  • 인터리브하지 않은 파일만

CDRFS는 물리 섹터 형식(CD-ROM Mode 1과 CD-ROM XA Mode 2 Form 1)과 디스크의 다중 세션 형식(마지막 세션의 볼륨 인식 영역에서 볼륨 설명자 세트를 매핑)을 투명하게 처리하는 일을 기반 CD-ROM 장치 드라이버에 의존합니다.

참고: CD-ROM 매체를 꺼내려면 먼저 시스템에서 CDRFS 마운트를 풀어야 합니다.

지원하는 또 다른 파일 시스템 형식으로 DVD-ROM 매체에 저장하는 읽기 전용 파일 시스템인 UDFS가 있습니다. 매체를 꺼내려면 먼저 시스템에서 UDFS 마운트를 풀어야 합니다. AIX는 UDFS 형식 버전 1.50, 2.00, 2.01을 지원합니다.

UDFS는 NFS로 읽기 전용 모드로 내보내야 합니다. NFS로 마운트한 UDFS에 쓰는 것은 지원하지 않습니다.

cdmount 명령으로 읽기·쓰기 UDFS를 자동 마운트하려면 cdromd.conf 파일을 편집합니다. mount 명령으로 읽기·쓰기 UDFS를 수동으로 마운트할 수도 있습니다.

영어 원문

File system types

AIX supports multiple file system types.

These include the following:

Journaled File System (JFS) or Enhanced Journaled File System (JFS2)

Supports the entire set of file system semantics. These file systems use database journaling techniques to maintain structural consistency. This prevents damage to the file system when the system is halted abnormally.

Each JFS or JFS2 resides on a separate logical volume. The operating system mounts the file system during initialization. This multiple file system configuration is useful for system management functions such as backup, restore, and repair, because it isolates a part of the file tree so that you can work on it.

JFS is the basic file system type that supports the entire set of file system commands.

JFS2 is the basic file system type that supports the entire set of file system commands.

A difference between JFS and JFS2 is that JFS2 is designed to support large files and large file systems.

Network File System (NFS)

Is a distributed file system that allows users to access files and directories located on remote computers and use those files and directories as if they were local. For example, users can use operating system commands to create, remove, read, write, and set file attributes for remote files and directories.

CD-ROM File System (CDRFS)

Allows access to the contents of a CD-ROM through the normal file system interfaces (open, read, and close).

DVD-ROM File System (UDFS)

Allows access to the contents of a DVD through the normal file system interfaces.

Related information

Network file system

JFS and JFS2

The journaled file system (JFS) and the enhanced journaled file system (JFS2) are built into the base operating system. Both file system types link their file and directory data to the structure used by the AIX Logical Volume Manager for storage and retrieval.

A difference is that JFS2 is designed to accommodate a 64-bit kernel and larger files.

The following sections describe these file systems. Unless otherwise noted, the following sections apply equally to JFS and JFS2.

JFS and JFS2 functions:

Enhanced Journaled File System (JFS2) is a file system that provides the capability to store much larger files than the existing Journaled File System (JFS).

You can choose to implement either JFS or JFS2. JFS2 is the default file system in AIX 6.1.

Note: Unlike the JFS file system, the JFS2 file system will not allow the link() API to be used on files of type directory. This limitation may cause some applications that operate correctly on a JFS file system to fail on a JFS2 file system.

The following table provides a summary of JFS and JFS2 functions:

Functions JFS2 JFS
Fragments and block size Block sizes (bytes): 512, 1024, 2048, 4096 Maximum file system size in terabytes (TBs): 4, 8, 16, 32 Fragment sizes (bytes): 512, 1024, 2048, 4096 Maximum file system size in gigabytes (GBs): 128, 256, 512, 1024
Maximum file system size 32 TBs 1 TB
Minimum file system size 16 MBs Not Applicable
Maximum file size 16 TBs Approximately 63.876 GBs
Number of i-nodes Dynamic, limited by disk space Fixed, set at file system creation
Directory organization B-tree Linear
Compression No Yes
Quotas Yes Yes
Error logging Yes Yes

Note

  1. The maximum file size and maximum file system size is limited to (1 TB - (physical partition size)) when used with the 32-bit kernel. For example, if the physical partition size for the volume group is 64 MB, then the maximum file system size is (1 TB - 64 MB) = (1048576 MB - 64 MB) = 1048512 MB. This is due to an underlying limitation on the maximum size of a logical volume when using the 32-bit kernel.

  2. JFS2 supports the standard AIX error logging scheme. For more information on AIX error logging, please see Error-Logging Overview in General Programming Concepts: Writing and Debugging Programs.

JFS and JFS2 disk space segmentation:

Many UNIX file systems only allocate contiguous disk space in units equal in size to the logical blocks used for the logical division of files and directories. These allocation units are typically referred to as disk blocks and a single disk block is used exclusively to store the data contained within a single logical block of a file or directory.

Using a relatively large logical block size (4096 bytes for example) and maintaining disk block allocations that are equal in size to the logical block are advantageous for reducing the number of disk I/O operations that must be performed by a single file system operation. A file or directory data is stored on disk in a small number of large disk blocks rather than in a large number of small disk blocks. For example, a file with a size of 4096 bytes or less is allocated a single 4096-byte disk block if the logical block size is 4096 bytes. A read or write operation therefore only has to perform a single disk I/O operation to access the data on the disk. If the logical block size is smaller requiring more than one allocation for the same amount of data, then more than one disk I/O operation is be required to access the data. A large logical block and equal disk block size are also advantageous for reducing the amount of disk space allocation activity that must be performed as new data is added to files and directories, because large disk blocks hold more data.

Restricting the disk space allocation unit to the logical block size can, however, lead to wasted disk space in a file system containing numerous files and directories of a small size. Wasted disk space occurs when a logical block worth of disk space is allocated to a partial logical block of a file or directory. Because partial logical blocks always contain less than a logical block worth of data, a partial logical block only consumes a portion of the disk space allocated to it. The remaining portion remains unused because no other file or directory can write its contents to disk space that has already been allocated. The total amount of wasted disk space can be large for file systems containing a large number of small files and directories.

The journaled file system (JFS) divides disk space into allocation units called fragments. The enhanced journaled file system (JFS2) segments disk space into blocks. The objective is the same: to efficiently store data.

JFS fragments are smaller than the default disk allocation size of 4096 bytes. Fragments minimize wasted disk space by more efficiently storing the data in a file or directory partial logical blocks. The functional behavior of JFS fragment support is based on that provided by Berkeley Software Distribution (BSD) fragment support.

JFS2 supports multiple file system block sizes of 512, 1024, 2048, and 4096. Smaller block sizes minimize wasted disk space by more efficiently storing the data in a file or directory's partial logical blocks. Smaller block sizes also result in additional operational overhead. The block size for a JFS2 is specified during its creation. Different file systems can have different block sizes, but only one block size can be used within a single file system.

Related concepts

JFS data compression JFS supports fragmented and compressed file systems, which save disk space by allowing a logical block to be stored on the disk in units or "fragments" smaller than the full block size of 4096 bytes.

JFS fragments:

In JFS, the disk space allocation unit is called a fragment, and it can be smaller than the logical block size of 4096 bytes.

With the use of fragments smaller than 4096 bytes, the data contained within a partial logical block can be stored more efficiently by using only as many fragments as are required to hold the data. For example, a partial logical block that only has 500 bytes could be allocated a fragment of 512 bytes (assuming a fragment size of 512 bytes), thus greatly reducing the amount of wasted disk space. If the storage requirements of a partial logical block increase, one or more additional fragments are allocated.

The fragment size for a file system is specified during its creation. The allowable fragment sizes for journaled file systems (JFS) are 512, 1024, 2048, and 4096 bytes. Different file systems can have different fragment sizes, but only one fragment size can be used within a single file system. Different fragment sizes can also coexist on a single system (machine) so that users can select a fragment size most appropriate for each file system.

JFS fragment support provides a view of the file system as a contiguous series of fragments rather than as a contiguous series of disk blocks. To maintain the efficiency of disk operations, however, disk space is often allocated in units of 4096 bytes so that the disk blocks or allocation units remain equal in size to the logical blocks. A disk-block allocation in this case can be viewed as an allocation of 4096 bytes of contiguous fragments.

Both operational overhead (additional disk seeks, data transfers, and allocation activity) and better utilization of disk space increase as the fragment size for a file system decreases. To maintain the optimum balance between increased overhead and increased usable disk space, the following factors apply to JFS fragment support:

  • Where possible, disk space allocations of 4096 bytes of fragments are maintained for a file or the logical blocks of a directory.

  • Only partial logical blocks for files or directories less than 32KB in size can be allocated less than 4096 bytes of fragments.

As the files and directories within a file system grow beyond 32 KB in size, the benefit of maintaining disk space allocations of less than 4096 bytes for partial logical blocks diminishes. The disk space savings as a percentage of total file system space grows small while the extra performance cost of maintaining small disk space allocations remains constant. Since disk space allocations of less than 4096 bytes provide the most effective disk space utilization when used with small files and directories, the logical blocks of files and directories equal to or greater than 32 KB are always allocated 4096 bytes of fragments. Any partial logical block associated with such a large file or directory is also allocated 4096 bytes of fragments.

JFS2 blocks:

The enhanced journaled file system segments disk space into blocks. JFS2 supports multiple file system block sizes of 512, 1024, 2048, and 4096.

Different file systems can have different block sizes, but only one block size can be used within a single file system.

Smaller block sizes minimize wasted disk space by more efficiently storing the data in a file or directory's partial logical blocks. Smaller block sizes can also result in additional operational overhead. Also, device drivers must provide disk block addressability that is the same or smaller than the file system block size.

Because disk space is allocated in smaller units for a file system with a block size other than 4096 bytes, allocation activity can occur more often when files or directories are repeatedly extended in size. For example, a write operation that extends the size of a zero-length file by 512 bytes results in the allocation of one block to the file, assuming a block size of 512 bytes. If the file size is extended further by another write of 512 bytes, an additional block must be allocated to the file. Applying this example to a file system with 4096-byte blocks, disk space allocation occurs only once, as part of the first write operation. No additional allocation activity is performed as part of the second write operation since the initial 4096-byte block allocation is large enough to hold the data added by the second write operation.

File system block size is specified during the file system's creation with Web-based System Manager, the System Management Interface Tool (SMIT), or the crfs and mkfs commands. The decision of which file system block size to choose should be based on the projected size of files contained by the file system.

The file system block size value can be identified through Web-based System Manager, the System Management Interface Tool (SMIT), or the lsfs command. For application programs, the statfs subroutine can be used to identify the file system block size.

Blocks serve as the basic unit of disk space allocation, and the allocation state of each block within a file system is recorded in the file system block allocation map. More virtual memory and file system disk space might be required to hold block allocation maps for file systems with a block size smaller than 4096 bytes.

Variable number of i-nodes:

Segmenting disk space at sizes smaller than 4096 bytes optimizes disk space utilization, but it increases the number of small files and directories that can be stored within a file system.

However, disk space is only one of the file system resources required by files and directories: each file or directory also requires a disk i-node.

JFS and i-nodes:

JFS allows you to specify the number of disk i-nodes created within a file system in case more or fewer than the default number of disk i-nodes is desired.

The number of disk i-nodes at file system creation is specified in a value called as the number of bytes per i-node or NBPI. For example, an NBPI value of 1024 causes a disk i-node to be created for every 1024 bytes of file system disk space. Another way to look at this is that a small NBPI value (512 for instance) results in a large number of i-nodes, while a large NBPI value (such as 16,384) results in a small number of i-nodes.

For JFS file systems, one i-node is created for every NBPI bytes of allocation group space allocated to the file system. The total number of i-nodes in a file system limits the total number of files and the total size of the file system. An allocation group can be partially allocated, though the full number of i-nodes per allocation group is still allocated. NBPI is inversely proportional to the total number of i-nodes in a file system.

The JFS restricts all file systems to 16M (224) i-nodes.

The set of allowable NBPI values vary according to the allocation group size (agsize). The default is 8 MB. The allowable NBPI values are 512, 1024, 2048, 4096, 8192, and 16,384 with an agsize of 8 MB. A larger

agsize can be used. The allowable values for agsize are 8, 16, 32, and 64. The range of allowable NBPI values scales up as agsize increases. If the agsize is doubled to 16 MB, the range of NBPI values also double: 1024, 2048, 4096, 8193, 16384, and 32768.

Fragment size and the NBPI value are specified during the file system's creation with Web-based System Manager, the System Management Interface Tool (SMIT), or the crfs and mkfs commands. The decision of fragment size and how many i-nodes to create for the file system is based on the projected number and size of files contained by the file system.

You can identify fragment size and NBPI value using the Web-based System Manager, the System Management Interface Tool (SMIT), or the lsfs command. For application programs, use the statfs subroutine to identify the file system fragment size.

JFS2 and i-nodes:

JFS2 allocates i-nodes as needed.

If there is room in the file system for additional i-nodes, they are automatically allocated. Therefore, the number of i-nodes available is limited by the size of the file system itself.

JFS and JFS2 size limitations:

You define the maximum size for a JFS when you create the file system. The decision of what size to define for a JFS is based on several significant issues.

The recommended maximum size for a JFS2 is 16 TBs. The minimum file system size for a JFS2 is 16 MBs.

Although file systems that use allocation units smaller than 4096 bytes require substantially less disk space than those using the default allocation unit of 4096 bytes, the use of smaller fragments might incur performance costs.

The allocation state of each fragment (JFS) or block (JFS2) within a file system is recorded in the file system allocation map. More virtual memory and file system disk space might be required to hold allocation maps for file systems with a fragment or block size smaller than 4096 bytes.

Because disk space is allocated in smaller units for a file system with a fragment (JFS) or block (JFS2) size other than 4096 bytes, allocation activity can occur more often when files or directories are repeatedly extended in size. For example, a write operation that extends the size of a zero-length file by 512 bytes results in the allocation of one 512-byte fragment or block to the file, depending on the file system type. If the file size is extended further by another write of 512 bytes, an additional fragment or block must be allocated to the file. Applying this example to a file system with 4096-byte fragments or blocks, disk space allocation occurs only once, as part of the first write operation. No additional allocation activity must be performed as part of the second write operation since the initial 4096-byte allocation is large enough to hold the data added by the second write operation. Allocation activity can be minimized if the files are extended by 4096 bytes at a time.

One size-related issue is the size of the file system log.

For JFS, in most instances, multiple file systems use a common log configured to be 4 MB in size. For example, after initial installation, all file systems within the root volume group use logical volume hd8 as a common JFS log. The default logical volume partition size is 4 MB, and the default log size is one partition, therefore, the root volume group normally contains a 4 MB JFS log. When file systems exceed 2 GB or when the total amount of file system space using a single log exceeds 2 GB, the default log size might not be sufficient. In either case, the log sizes are scaled upward as the file system size increases.

When the size of the log logical volume is changed, the logform command must be run to reinitialize the log before the new space can be used. The JFS log is limited to a maximum size of 256 MB.

There is a practical limit to the size of the combined file systems that a single JFS log can support. As a guideline, one trillion bytes of total file system capacity is the recommended limitation for a single JFS log. When this guideline is exceeded or is close to being exceeded, or when out-of-memory errors occur from the logredo command (which is called by the fsck command), add an additional JFS log and then share the load between the two JFS log files.

For JFS2, in most instances, multiple file systems also use a common log. When file systems exceed 2 GB or when the total amount of file system space using a single log exceeds 2 GB, the default log size might not be sufficient. In either case, you can scale log sizes upward as the file system size increases or you can add an additional JFS2 log and then share the load between the two JFS2 log files.

JFS size limits:

The maximum JFS size is defined when the file system is created. The NBPI, fragment size, and allocation group size are contributing factors to the decision.

The file system size limitation is the minimum of the following:

text
NBPI * 2     24

or

text
FragmentSize * 2          28

For example, if you select an NBPI ratio of 512, the file system size is limit to 8 GB (512 * 224 = 8 GB). JFS supports NBPI values of 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, and 131072.

The JFS restricts all file systems to 16M (224) i-nodes.

One i-node is created for every NBPI bytes of allocation group space allocated to the file system. An allocation group can be partially allocated, though the full number of i-nodes per allocation group is still allocated. NBPI is inversely proportional to the total number of i-nodes in a file system.

The JFS segregates file system space into groupings of i-nodes and disk blocks for user data. These groupings are called allocation groups. The allocation group size can be specified when the file system is created. The allocation group sizes are 8M, 16M, 32M, and 64M. Each allocation group size has an associated NBPI range. The ranges are defined by the following table:

text
Allocation Group
Size in Megabytes      Allowable NBPI Values
 8                     512, 1024, 2048, 4096, 8192, 16384
16                          1024, 2048, 4096, 8192, 16384, 32768
32                                2048, 4096, 8192, 16384, 32768, 65536
64                                      4096, 8192, 16384, 32768, 65536, 131072

The JFS supports four fragment sizes of 512, 1024, 2048, and 4096 byte units of contiguous disk space. The JFS maintains fragment addresses in i-nodes and indirect blocks as 28-bit numbers. Each fragment must be addressable by a number from 0 to (228).

JFS2 size limits:

Testing has shown that extremely large JFS2 file systems that contain very large files are more practical to maintain than those that contain a large number of small files. When a large file system contains many small files, the fsck command and other file system maintenance tasks take a long time to run.

The following size limitations are recommended:

  • Maximum JFS2 file system size: — 32TB
  • Maximum JFS2 file size: — 16TB
  • Minimum JFS2 file system size: — 16MB
  • JFS free space fragmentation:

For JFS file systems, using fragments smaller than 4096 bytes can cause greater fragmentation of the free space on the disk.

For example, consider an area of the disk that is divided into eight fragments of 512 bytes each. Suppose that different files, requiring 512 bytes each, have written to the first, fourth, fifth, and seventh fragments in this area of the disk, leaving the second, third, sixth, and eighth fragments free. Although four fragments representing 2048 bytes of disk space are free, no partial logical block requiring four fragments (or 2048 bytes) is allocated for these free fragments, since the fragments in a single allocation must be contiguous.

Because the fragments allocated for a file or directory logical blocks must be contiguous, free space fragmentation can cause a file system operation that requests new disk space to fail even though the total amount of available free space is large enough to satisfy the operation. For example, a write operation that extends a zero-length file by one logical block requires 4096 bytes of contiguous disk space to be allocated. If the file system free space is fragmented and consists of 32 noncontiguous 512-byte fragments or a total of 16 KB of free disk space, the write operation will fail because eight contiguous fragments (or 4096 bytes of contiguous disk space) are not available to satisfy the write operation.

A JFS file system with an unmanageable amount of fragmented free space can be defragmented with the defragfs command. Running the defrags command has a positive impact on performance.

Sparse files:

A file is a sequence of indexed blocks. Blocks are mapped from the i-node to the logical offset of the file they represent.

A file that has one or more indexes that are not mapped to a data block is referred to as being sparsely-allocated or a sparse file. A sparse file will have a size associated with it, but it will not have all of the data blocks allocated to fulfill the size requirements. To identify if a file is sparsely-allocated, use the fileplace command. It will indicate all blocks in the file that are not currently allocated.

Note: In most circumstances, du can also be used to determine if the number of data blocks allocated to a file do not match those required to hold a file of its size. A compressed file system might show the same behavior for files that are not sparsely-allocated.

A sparse file is created when an application extends a file by seeking to a location outside the currently allocated indexes, but the data that is written does not occupy all of the newly assigned indexes. The new file size reflects the farthest write into the file.

A read to a section of a file that has unallocated data blocks results in a buffer of zeroes being returned. A write to a section of a file that has unallocated data blocks causes the necessary data blocks to be allocated and the data written.

This behavior can affect file manipulation or archival commands. For example, the following commands do not preserve the sparse allocation of a file:

  • cp

  • mv

  • tar

  • cpio

Note: In the case of mv, this only applies to moving a file to another file system. If the file is moved within the same file system, it will remain sparse.

The result of a file being copied or restored from the preceding commands has each data block allocated, and thus have no sparse characteristics. However, the following archival commands either preserve sparse characteristics or actively sparse a file:

  • backup

  • restore

  • pax

Because it is possible to overcommit the resources of a file system with sparse files, care should be taken in the use and maintenance of files of this type.

JFS and large files:

You can create large files with the JFS file system type.

All JFS2 file systems support large files.

File systems enabled for large files can be created with the crfs and mkfs commands. Both commands have an option (bf=true) to specify file systems enabled for large files. You can also use SMIT or Web-based System Manager to create these file systems.

In file systems enabled for large files, file data stored before the 4 MB file offset is allocated in 4096-byte blocks. File data stored beyond the 4 MB file offset is allocated with large disk blocks of 128 KB in size. The large disk blocks are actually 32 contiguous 4096-byte blocks.

For example, in a regular file system, the 132-MB file requires 33K 4-KB disk blocks (33 single indirect blocks each filled with 1024 4 KB disk addresses). A 132-MB file in a file system enabled for large files has 1024 4-KB disk blocks and 1024 128-KB disk blocks. The large file geometry requires only two single indirect blocks for the 132 MB file. Both large and regular file types require one double indirect block.

Large disk blocks require 32 contiguous 4 KB blocks. If you write to large files beyond the 4 MB, file offset will fail with ENOSPC if the file system does not contain 32 unused contiguous 4 KB blocks.

Note: The file system may have thousands of free blocks, but if 32 of them are not contiguous, the allocation will fail.

The defragfs command reorganizes disk blocks to provide larger contiguous free block areas.

The JFS is required to initialize all new disk allocations. The JFS starts the kernel kproc procedure used to zero initial file allocations when mounting the first large file enabled file system on your system. The kproc procedure remains once the file system enabled for large files has successfully unmounted.

JFS data compression:

JFS supports fragmented and compressed file systems, which save disk space by allowing a logical block to be stored on the disk in units or "fragments" smaller than the full block size of 4096 bytes.

Data compression is not supported for JFS2.

In a fragmented file system, only the last logical block of files no larger than 32KB are stored in this manner, so that fragment support is only beneficial for file systems containing numerous small files. Data compression, however, allows all logical blocks of any-sized file to be stored as one or more contiguous fragments. On average, data compression saves disk space by about a factor of two.

The use of fragments and data compression does, however, increase the potential for fragmentation of the disk free space. Fragments allocated to a logical block must be contiguous on the disk. A file system experiencing free space fragmentation might have difficulty locating enough contiguous fragments for a logical block allocation, even though the total number of free fragments may exceed the logical block requirements. The JFS alleviates free space fragmentation by providing the defragfs program which "defragments" a file system by increasing the amount of contiguous free space. This utility can be used for fragmented and compressed file systems. The disk space savings gained from fragments and data compression can be substantial, while the problem of free space fragmentation remains manageable.

Data compression in the current JFS is compatible with previous versions of this operating system. The API comprised of all the system calls remains the same in both versions of the JFS.

Related concepts

JFS and JFS2 disk space segmentation Many UNIX file systems only allocate contiguous disk space in units equal in size to the logical blocks used for the logical division of files and directories. These allocation units are typically referred to as disk blocks and a single disk block is used exclusively to store the data contained within a single logical block of a file or directory.

JFS data compression implementation:

Data compression is an attribute of a file system which is specified when the file system is created with the crfs or mkfs command. You can also use Web-based System Manager or SMIT to specify data compression.

Attention: The root file system (/) must not be compressed. Compressing the /usr file system is not recommended because installp must be able to accurately calculate its size for updates and new installs.

Compression only applies to regular files and long symbolic links in such file systems. Fragment support continues to apply to directories and metadata that are not compressed. Each logical block of a file is compressed by itself before being written to the disk. Compression in this manner facilitates random seeks and updates, while losing only a small amount of freed disk space in comparison to compressing data in larger units.

After compression, a logical block usually requires less than 4096 bytes of disk space. The compressed logical block is written to the disk and allocated only the number of contiguous fragments required for its storage. If a logical block does not compress, then it is written to disk in its uncompressed form and allocated 4096 bytes of contiguous fragments.

The lsfs -q command displays the current value for compression. You can also use Web-based System Manager or SMIT to identify data compression.

Related concepts

Implicit behavior of JFS data compression Because a program that writes a file does not expect an out-of-space (ENOSPC) condition to occur after a successful write (or successful store for mapped files), it is necessary to guarantee that space be available when logical blocks are written to the disk.

Implicit behavior of JFS data compression:

Because a program that writes a file does not expect an out-of-space (ENOSPC) condition to occur after a successful write (or successful store for mapped files), it is necessary to guarantee that space be available when logical blocks are written to the disk.

This is accomplished by allocating 4096 bytes to a logical block when it is first modified so that there is disk space available even if the block does not compress. If a 4096-byte allocation is not available, the system returns an ENOSPC or EDQUOT error condition even though there might be enough disk space to accommodate the compressed logical block. Premature reporting of an out-of-space condition is most likely when operating near disk quota limits or with a nearly full file system.

Compressed file systems might also exhibit the following behavior:

  • Because 4096 bytes are initially allocated to a logical block, certain system calls might receive an ENOSPC or EDQUOT error. For example, an old file might be mapped using the mmap system call, and a store operation into a previously written location can result in an ENOSPC error.

  • With data compression, a full disk block remains allocated to a modified block until it is written to disk. If the block had a previously committed allocation of less than a full block, the amount of disk space tied up by the block is the sum of the two, the previous allocation not being freed until the file (i-node) is committed. This is the case for normal fragments. The number of logical blocks in a file that can have previously committed allocations is, at most, one for normal fragments but can be as many as the number of blocks in a file with compression.

  • None of the previously committed resources for a logical block are freed until the fsync or sync system call is run by the application program.

  • The stat system call indicates the number of fragments allocated to a file. The number reported is based on 4096 bytes being allocated to modified but unwritten blocks and the compressed size of unmodified blocks. Previously committed resources are not counted by the stat system call. The stat system call reports the correct number of allocated fragments after an i-node commit operation if none of the modified blocks compressed. Similarly, disk quotas are charged for the current allocation. As the logical blocks of a file are written to the disk, the number of fragments allocated to them decrease if they compress, and thereby change disk quotas and the result from stat.

Related concepts

JFS data compression implementation Data compression is an attribute of a file system which is specified when the file system is created with the crfs or mkfs command. You can also use Web-based System Manager or SMIT to specify data compression.

JFS data compression algorithm:

The compression algorithm is an IBM version of LZ. In general, LZ algorithms compress data by representing the second and later occurrences of a given string with a pointer that identifies the location of the first occurrence of the string and its length.

At the beginning of the compression process, no strings have been identified, so at least the first byte of data must be represented as a "raw" character requiring 9-bits (0,byte). After a given amount of data is compressed, say N bytes, the compressor searches for the longest string in the N bytes that matches the string starting at the next unprocessed byte. If the longest match has length 0 or 1, the next byte is encoded as a "raw" character. Otherwise, the string is represented as a (pointer,length) pair and the number of bytes processed is incremented by length. Architecturally, IBM LZ supports values of N of 512, 1024, or 2048. IBM LZ specifies the encoding of (pointer,length) pairs and of raw characters. The pointer is a fixed-length field of size log2 N, while the length is encoded as a variable-length field.

Performance costs of JFS data compression:

Because data compression is an extension of fragment support, the performance associated with fragments also applies to data compression.

Compressed file systems also affect performance in the following ways:

  • It can require a great deal of time to compress and extract data so that the usability of a compressed file system might be limited for some user environments.

  • Most UNIX regular files are written only once, but some are updated in place. For the latter, data compression has the additional performance cost of having to allocate 4096 bytes of disk space when a logical block is first modified, and then reallocate disk space after the logical block is written to the disk. This additional allocation activity is not necessary for regular files in a uncompressed file system.

  • Data compression increases the number of processor cycles. For the software compressor, the number of cycles for compression is approximately 50 cycles per byte, and for decompression 10 cycles per byte.

JFS online backups and JFS2 snapshots:

You can make a point-in-time image of a JFS file system or of a JFS2 file system, which you can then use for backup purposes. There are differences, however, in the requirements and behavior of this image for each file system type.

For a JFS file system, you can split off a read-only static copy of a mirrored copy of the file system. Typically, a mirrored copy is updated whenever the original file system is updated, but this point-in-time copy does not change. It remains a stable image of the point in time at which the copy was made. When this image is used for backing up, any modifications that begin after you begin the procedure to create the image might not be present in the backup copy. Therefore, it is recommended that file system activity be minimal while the split is taking place. Any changes that occur after the split is made will not be present in the backup copy.

For a JFS2 file system, the point-in-time image is called a snapshot. The snapshot remains static and it retains the same security permissions as the original file system (called the snappedFS) had when the snapshot was made. Also, you can create a JFS2 snapshot without unmounting or quiescing the file system. You can use a JFS2 snapshot to use as an online backup of the file system, to access the files or directories as they existed when the snapshot was taken, or to back up to removable media. Note the following about JFS2 snapshots:

  • A snapshot image of the root (/) or /usr file system is overwritten when the system is rebooted. Snapshots of other file systems can be preserved by unmounting the file system before rebooting. Snapshots created in AIX 5.2 with 5200-01 are recoverable. When fsck or logredo runs on a JFS2 filesystem with a snapshot created on AIX 5.2 with 5200-01, the snapshot will be preserved. A cleanly unmounted filesystem with an AIX 5.2-created snapshot will also be recoverable once it is mounted on an AIX 5.2 with 5200-01 system.

  • Running the defragfs command against a file system with snapshots is not recommended. Every block that is moved during defragmentation must also be copied to the snapshot, which is both time consuming and a waste of space in the snapshot logical volume.

  • If a snapshot runs out of space, all snapshots for that snappedFS are deleted. This failure writes an entry to the error log.

  • If a write to a snapshot fails, all snapshots for that snappedFS are deleted. This failure writes an entry to the error log.

  • A snapshot that is created or accessed on a AIX 5.2 with 5200-01 system cannot be accessed on an AIX 5.2 system. These snapshots must be deleted before the filesystem can be mounted.

  • A JFS2 file system that has a snapshot on AIX 5.3 cannot be accessed on any releases prior to AIX 5.2 with 5200-01. If the system is to be moved back, the snapshots must be deleted first to allow file system access.

JFS online backups:

You can make a point-in-time image of a JFS file system that you can then use for backup purposes.

For a JFS file system, you can split off a read-only static copy of a mirrored copy of the file system. Typically, a mirrored copy is updated whenever the original file system is updated, but this point-in-time copy does not change. It remains a stable image of the point in time at which the copy was made. When this image is used for backing up, any modifications that begin after you begin the procedure to create the image might not be present in the backup copy. Therefore, it is recommended that file system activity be minimal while the split is taking place. Any changes that occur after the split is made will not be present in the backup copy.

JFS2 snapshots:

You can make a point-in-time image of a JFS2 file system that you can then use for backup purposes.

The point-in-time image for a JFS2 file system is called a snapshot. The snapshot remains static and retains the same security permissions that the original file system (called the snappedFS) had when the snapshot was made. Also, you can create a JFS2 snapshot without unmounting the file system, or quiescing the file system. You can use a JFS2 snapshot to:

  • Access the files or directories as they existed when the snapshot was taken.

  • Backup to removable media.

There are two types of JFS2 snapshots: internal and external. A JFS2 external snapshot is created in a separate logical volume from the file system. The external snapshot can be mounted separately from the file system at its own unique mount point.

A JFS2 internal snapshot is created in the same logical volume as the file system and allocates blocks from the file system. An internal snapshot is accessible from the invisible .snapshot directory in the root of the JFS2 file system with the snapshot. A JFS2 file system must be enabled to support internal snapshots at the time the file system is created.

JFS2 snapshots do not support checking of file system quotas. You cannot use the repquota command on the snapshot to determine the state of the quota. The point-in-time quota information is preserved if you roll back the file system image to the snapshot image. Note the following considerations specific to JFS2 external snapshots and JFS2 internal snapshots:

  • An external snapshot that is created or accessed on an AIX 5.2 with 5200-01 system cannot be accessed on an AIX 5.2 system. These snapshots must be deleted before the file system can be mounted.

  • A JFS2 file system that has a snapshot on AIX 5.3 cannot be accessed on any releases prior to AIX 5.2 with 5200-01. If the system is to be moved back, the snapshots must be deleted first to allow file system access.

  • Running the defragfs command against a JFS2 file system with external snapshots is not recommended because every block that is moved during defragmentation must also be copied to the snapshot, which is both time consuming and a waste of space in the snapshot logical volume.

  • If an external snapshot runs out of space, or if an external snapshot fails, all external snapshots for that snappedFS are marked invalid. Further access to the snapshot will fail. These failures write an entry to the error log.

Internal JFS2 snapshot considerations:

  • Internal snapshots are preserved when the logredo command runs on a JFS2 file system with an internal snapshot.

  • Internal snapshots are removed if the fsck command has to modify a JFS2 file system to repair it.

  • If an internal snapshot runs out of space, or if a write to an internal snapshot fails, all internal snapshots for that snappedFS are marked invalid. Further access to the internal snapshots will fail. These failures write an entry to the error log.

  • Internal snapshots are not separately mountable. You can access internal snapshots in the .snapshot directory of the root of the file system immediately after they are created. Consequently, you can access internal snapshots through an NFS server without having to export a separate mount point for the snapshot.

  • Internal snapshots are not compatible with AIX releases prior to AIX 6.1. A JFS2 file system created to support internal snapshots cannot be modified on an earlier release of AIX.

  • A JFS2 file system created to support internal snapshots is also enabled to support Extended Attributes Version 2.

  • A JFS2 file system with internal snapshots cannot be used with a Data Management Application Programming Interface (DMAPI).

  • You cannot use the defragfs command against a JFS2 file system with internal snapshots.

  • The .snapshot directory is not returned from the readdir() system call. This prevents unintended visiting of the snapshots. Any system calls or commands that depend on the readdir() system call fail with the .snapshot directory (for example, the /bin/pwd command and the getcwd() system call of the .snapshot directory cannot find the parent directory).

Compatibility and migration:

JFS file systems are fully compatible within AIX 5.1 and AIX 5.2. Previous supported versions of the operating system are compatible with the current JFS, although file systems with a nondefault fragment size, NBPI value, or allocation group size might require special attention if migrated to a previous version.

Note: JFS file systems are not supported on disks that have a sector size of 4 KB. Therefore, when you create a file system or perform backup operations, ensure that the disks are not of 4 KB sector size.

JFS2 file systems, with the exception of snapshots, are compatible within AIX 5.1 and AIX 5.2, but not with earlier versions of the operating system. JFS2 file systems with snapshots are not supported in AIX 5.1. Always ensure a clean unmount of all JFS2 file systems before reverting to an earlier version of AIX because the logredo command does not necessarily run against a file system created for a later release.

Note: JFS2 file systems created or converted to v2 format cannot be accessed on prior releases of AIX.

The following list describes aspects that might cause problems with file systems created under earlier versions of the operating system:

JFS file system images

Any JFS file system image created with the default fragment size and NBPI value of 4096 bytes, and default allocation group size (agsize) of 8 can be interchanged with JFS file system images created under AIX 4.3 and later versions of this operating system without requiring any special migration activities.

Note: JFS2 Snapshots: JFS2 snapshots created or accessed in AIX 5L™Version 5.2 with the 5200-01 Recommended Maintenance package are not accessible on earlier releases. These snapshots must be deleted before the filesystem can be mounted.

Backup and restore between JFS file systems

Backup and restore sequences can be performed between JFS file systems with different block sizes, however because of increased disk utilization, restore operations can fail due to a lack of free blocks if the block size of the source file system is smaller than the block size of the target file system. This is of particular interest for full file system backup and restore sequences and can even occur when the total file system size of the target file system is larger than that of the source file system.

While backup and restore sequences can be performed from compressed to uncompressed file systems or between compressed file systems with different fragment sizes, because of the enhanced disk utilization of compressed file systems, restore operations might fail due to a shortage of disk space. This is of particular interest for full file system backup and restore sequences and might even occur when the total file system size of the target file system is larger than that of the source file system.

JFS and JFS2 device driver limitations

A device driver must provide disk block addressability that is the same or smaller than the JFS file system fragment size or the JFS2 block size. For example, if a JFS file system was made on a user supplied RAM disk device driver, the driver must allow 512 byte blocks to contain a file system that had 512 byte fragments. If the driver only allowed page level addressability, a JFS with a fragment size of 4096 bytes could only be used.

Copying a JFS to another physical volume

You can copy a JFS file system to a different physical volume while retaining file system integrity.

The following scenario describes copying JFS file system to a different physical volume while retaining file system integrity.

The information in this how-to scenario was tested using specific versions of AIX. The results you obtain might vary significantly depending on your version and level of AIX.

To copy a JFS to another physical volume while maintaining file system integrity, do the following:

  1. Stop activity for the file system that you want to copy. Unless the application that is using the file system is quiescent or the file system is in a state that is known to you, you cannot know what is in the data of the backup.

  2. Mirror the logical volume, by typing the following SMIT fast path on the command line:

text
smit mklvcopy
  1. Copy the file system, using the following command:
text
chfs -a splitcopy=/backup -a copy=2 /testfs

The splitcopy parameter for the -a flag causes the command to split off a mirrored copy of the file system and mount it read-only at the new mount point. This action provides a copy of the file system with consistent journaled meta data that can be used for backup purposes.

  1. If you want to move the mirrored copy to a different mount point, use the following SMIT fast path:
text
smit cplv

At this point, the file system copy is usable.

Related information

mklv command

CD-ROM file system and UDF file system

The CD-ROM file system (CDRFS) is a read-only local file system implementation that might be stored on CD-ROM media, CD-RW media if write protected, and DVD-ROM media. The maximum CDRFS file size is 2 GB, regardless of the media used. The Universal Disk Format (UDF) file system is a writeable local file system implementation that might be stored as read-only on DVD-ROM media, or as read-write in DVD-RAM media.

CDs are automatically mounted by default but this feature can be disabled. If the feature has been disabled, use the cdmount command to mount the CDRFS file system.

AIX supports the following CDRFS volume and file structure formats:

  • The ISO 9660:1988(E) standard — The CDRFS supports ISO 9660 level 3 of interchange and level 1 of implementation.
  • The High Sierra Group Specification — Precedes the ISO 9660 and provides backward compatibility with previous CD-ROMs.
  • The Rock Ridge Group Protocol — Specifies extensions to the ISO 9660 that are fully compliant with the ISO 9660 standard, and that provide full POSIX file system semantics based on the System Use Sharing Protocol (SUSP) and the Rock Ridge Interchange Protocol (RRIP), enabling mount/access CD-ROM as with any other UNIX file system.

The CD-ROM eXtended Architecture File Format (in Mode 2 Form 1 sector format only) The CD-ROM eXtended Architecture (XA) file format specifies extensions to the ISO 9660 that are used in CD-ROM-based multimedia applications for example, Photo CD.

For all volume and file structure formats, the following restrictions apply:

  • Single-volume volume set only

  • Non-interleaved files only

The CDRFS is dependent upon the underlying CD-ROM device driver to provide transparency of the physical sector format (CD-ROM Mode 1 and CD-ROM XA Mode 2 Form 1), and the multisession format of the disks (mapping the volume descriptor set from the volume recognition area of the last session).

Note: The CDRFS must be unmounted from the system before you can remove the CD-ROM media.

There is another supported file system type called UDFS, which is a read-only file system stored on DVD-ROM media. UDFS must be unmounted from the system before you can remove the media. AIX supports UDFS format versions 1.50, 2.00, and 2.01.

UDFS must be exported using NFS in read-only mode. Writing to an NFS mounted UDFS is not supported.

To use the cdmount command to automatically mount a read/write UDFS, edit the cdromd.conf file. You can also manually mount a read/write UDFS with the mount command.