[AIX 운영 체제와 장치 관리 40] 파일 시스템 (2) — 유지 보수 빠른 경로, JFS2 스냅숏 복구, CD·DVD와 광 매체 파일 시스템, fsck 검사, rootvg 파일 시스템 줄이기, 넘침·손상·슈퍼블록 복구

핵심 정리

  • 유지 보수 작업(백업, 스냅숏 만들기·마운트·제거·롤백, 마운트·해제, 파일 시스템 그룹, JFS2 할당량)의 SMIT 빠른 경로와 명령을 표로 정리했습니다. hd4·hd2·hd9var·hd3·hd5 같은 시스템 파일 시스템 이름은 바꾸지 않고, 마운트 해제가 실패하면 fuser로 원인을 찾습니다.
  • 외부 스냅숏은 mount -v jfs2 -o snapshot으로 마운트해, 내부 스냅숏은 파일시스템/.snapshot/이름에서 바로 파일을 복사해 복구합니다.
  • CD·DVD는 자동 마운트되지 않으며 cdmount나 mount -V udfs를 씁니다. 읽기·쓰기 광 매체에는 쓰기 방지한 CDRFS나 매체 안에 자족한 VG의 JFS를 쓸 수 있습니다.
  • 사용자 파일 시스템은 마운트 해제 뒤 smit fsck로 검사하고, /와 /usr는 설치 매체로 부팅해 유지 보수 셸에서 fsck -y /dev/hd4, /dev/hd2를 실행합니다.
  • rootvg 파일 시스템을 줄이려면 mkszfile로 /image.data를 만들어 LPs·FS_SIZE·FS_MIN_SIZE를 고친 뒤 명령행 mksysb로 백업해 Use Maps·Shrink를 no로 재설치합니다. JFS 슈퍼블록 매직 넘버가 깨지면 od로 0x1f000의 보조 슈퍼블록을 확인해 dd로 복사합니다.
항목 내용
버전 AIX 6.1 (5.3판과 거의 같음, 스냅숏·할당량 항목 추가)
원문 Operating system and device management — 5.3판 98115쪽 일부, 6.1판 425435쪽
관련 명령어 backsnap, snapshot, rollback, mount -o snapshot, cdmount, mount -V udfs, fsck, mkszfile, mksysb, skulker, od, dd, fuser
관련 파일 /etc/filesystems, /image.data

파일 시스템을 유지 보수할 때 필요할 수 있는 가장 간단한 작업을 이 표에 묶었습니다.

표 65. 파일 시스템 유지 보수 작업

작업 SMIT 빠른 경로 명령이나 파일
이름으로 파일이나 디렉터리 백업 smit backfile backup(참고 1)
JFS2 스냅숏 이미지 만들기와 백업 smit backsnap backsnap(참고 1)
디스크의 모든 파일 시스템 나열 smit lsmntdsk
이동식 디스크의 파일 시스템 나열 smit lsmntdsk
마운트된 파일 시스템 나열 smit fs
파일 시스템 그룹 마운트(참고 5) smit mountg mount -t GroupName
JFS나 JFS2 마운트(참고 3) smit mountfs mount
JFS2 스냅숏 마운트 smit mntsnap mount -v jfs2 -o snapshot Device MountPoint
JFS나 JFS2 제거 smit rmfs
JFS2 스냅숏 제거 smit rmsnap snapshot -d SnapshotDevice
JFS2 파일 시스템을 시점 스냅숏으로 되돌리기 smit rollbacksnap rollback [-s] [-v] [-c] snappedFS snapshotObject
파일 시스템 마운트 해제(참고 4) smit umountfs
이동식 디스크의 파일 시스템 마운트 해제(참고 4) smit umntdsk
파일 시스템 그룹 마운트 해제(참고 5) smit umountg umount -t GroupName
JFS2 할당량 관리 smit j2fsquotas
할당량 관리 켜기·끄기 smit j2enablequotas
할당량 한도 적용 멈춤·다시 시작 smit j2enforcequotas quotaon -v 또는 quotaoff -v
할당량 사용 나열 smit j2repquota repquota -v
현재 디스크 블록과 파일 사용 통계 다시 계산
한도 클래스 더하기 smit j2addlimit j2edlimit -e
한도 클래스 특성 바꾸기·보기 smit j2changelimit
한도 클래스를 파일 시스템 기본 한도로 smit j2defaultlimit
사용자나 그룹을 한도 클래스에 할당 smit j2assignlimit
파일 시스템의 한도 클래스 나열 smit j2listlimits j2edlimit -l -u
한도 클래스 제거 smit j2removelimit

참고

  1. 옵션은 각 명령을 봅니다.
  2. 시스템에 중요한 파일 시스템의 이름은 바꾸지 않습니다. 논리 볼륨 4(hd4)의 /(루트), hd2의 /usr, hd9var의 /var, hd3의 /tmp, hd5의 /blv입니다. hdn 규칙을 쓰면 hd10부터 시작합니다.
  3. 마운트하기 전에 "파일 시스템 검사" 절차를 쓰거나 fsck 명령을 실행해 파일 시스템을 검사합니다.
  4. 마운트 해제가 실패하면 사용자나 프로세스가 마운트 해제하려는 파일 시스템의 파일을 열고 있기 때문일 수 있습니다. fuser 명령으로 어떤 사용자나 프로세스가 원인인지 찾을 수 있습니다.
  5. 파일 시스템 그룹은 /etc/filesystems 파일에서 type= 식별자 값이 같은 파일 시스템의 모음입니다.

관련 작업

  • 다른 디스크 드라이브의 공간 마운트하기

온라인 외부 JFS2 스냅숏에서 파일 복구

온라인 외부 JFS2 스냅숏에 정확한 사본이 있으면 손상된 파일을 바꿀 수 있습니다.

다음 절차로 온라인 외부 JFS2 스냅숏 이미지에서 파일을 복구합니다.

이 예에서는 /home/aaa/myfile이 /home 파일 시스템의 손상된 파일이라고 합니다.

  1. 다음과 비슷한 명령으로 스냅숏을 마운트합니다.
text
mount -v jfs2 -o snapshot /dev/mysnaplv /tmp/mysnap
  1. 다음과 비슷한 명령으로 스냅숏이 든 디렉터리로 갑니다.
text
cd /tmp/mysnap
  1. 다음과 비슷한 명령으로 스냅숏의 정확한 파일을 복사해 손상된 파일을 덮어씁니다.
text
cp aaa/myfile /home/aaa/myfile

앞 예는 myfile이라는 파일만 복사합니다. 스냅숏의 모든 파일을 aaa 디렉터리로 복사하려면 다음과 비슷한 명령을 씁니다.

text
cp -R aaa /home/aaa

스냅숏 이미지로 손상된 파일을 바꾸는 예는 Commands Reference, Volume 1의 cp나 cpio 명령 설명을 봅니다.

온라인 내부 JFS2 스냅숏에서 파일 복구

온라인 내부 JFS2 스냅숏에 정확한 사본이 있으면 손상된 파일을 바꿀 수 있습니다.

이 예에서도 /home/aaa/myfile이 /home 파일 시스템의 손상된 파일이라고 합니다.

  1. 다음과 비슷한 명령으로 스냅숏이 든 디렉터리로 갑니다.
text
cd /home/.snapshot/mysnap
  1. 다음과 비슷한 명령으로 스냅숏의 정확한 파일을 복사해 손상된 파일을 덮어씁니다.
text
cp aaa/myfile /home/aaa/myfile

스냅숏의 모든 파일을 aaa 디렉터리로 복사하려면 다음과 비슷한 명령을 씁니다.

text
cp -R aaa /home/aaa

CD-ROM과 DVD 디스크의 파일 시스템

CD와 DVD는 자동으로 마운트되지 않지만 이 기능을 켤 수 있습니다.

이 기능을 켜려면 cdmount 명령으로 CDRFS나 UDFS 파일 시스템을 마운트합니다. 예:

text
cdmount cd0

다음 명령으로 읽기·쓰기 UDFS를 직접 마운트할 수 있습니다.

text
mount -V udfs DevName MtPt

DevName은 DVD 드라이브 이름, MtPt는 파일 시스템의 마운트 지점입니다.

읽기·쓰기 광 매체의 파일 시스템 쓰기

읽기·쓰기 광 매체에는 CDRFS와 JFS 파일 시스템을 쓸 수 있습니다.

CD-ROM 파일 시스템(CDRFS)은 CD-ROM뿐 아니라, 쓰기 방지된 읽기·쓰기 광 매체에도 저장할 수 있습니다. 다음 표는 읽기·쓰기 광 매체에서 CDRFS를 더하고, 마운트하고, 해제하는 방법입니다. 파일 시스템을 마운트할 때 다음 정보를 지정해야 합니다.

  • 장치 이름 — 매체가 든 장치 이름
  • 마운트 지점 — 파일 시스템을 마운트할 디렉터리
  • 자동 마운트 — 시스템을 다시 시작할 때 파일 시스템을 자동으로 마운트할지

광 매체의 CDRFS 작업

작업 SMIT 빠른 경로 명령이나 파일
CDRFS 더하기(참고 1) smit crcdrfs 1. 파일 시스템 더하기: crfs -v cdrfs -p ro -d DeviceName -m MountPoint -A AutomaticMount 2. 파일 시스템 마운트: mount MountPoint
CDRFS 제거(참고 2) 1. 파일 시스템 마운트 해제: smit umountfs 2. 파일 시스템 제거: smit rmcdrfs 1. 파일 시스템 마운트 해제: umount FileSystem 2. 파일 시스템 제거: rmfs MountPoint

참고

  • 읽기·쓰기 광 매체가 쓰기 방지돼 있는지 확인합니다.
  • 읽기·쓰기 광 매체를 빼기 전에 CDRFS 파일 시스템을 마운트 해제해야 합니다.

JFS는 하드 디스크와 비슷하게 광 매체에 읽기·쓰기 파일 시스템을 제공합니다. 읽기·쓰기 광 매체에 읽기·쓰기 파일 시스템을 만들거나 가져오려면 system 권한(로그인이 system 그룹에 속해야 함)이 있어야 하고 다음 정보가 필요합니다.

  • 볼륨 그룹 이름 — 볼륨 그룹 이름
  • 장치 이름 — 읽기·쓰기 광 드라이브의 논리 이름
  • 마운트 지점 — 파일 시스템을 마운트할 디렉터리
  • 자동 마운트 — 시스템을 다시 시작할 때 파일 시스템을 자동으로 마운트할지

참고

  • 읽기·쓰기 광 매체에 만든 볼륨 그룹은 그 매체 안에 자족해야 합니다. 볼륨 그룹은 읽기·쓰기 광 디스크 하나를 넘을 수 없습니다.
  • 이전에 만든 저널 파일 시스템에 접근할 때 볼륨 그룹 이름이 볼륨 그룹을 만들 때 쓴 것과 같을 필요는 없습니다.

광 매체의 JFS 작업

작업 SMIT 빠른 경로 명령이나 파일
JFS 더하기 1. 광 디스크를 드라이브에 넣습니다. 2. (필요하면) 볼륨 그룹 만들기: smit mkvg 3. 저널 파일 시스템 만들기: smit crfs 1. 광 디스크를 드라이브에 넣습니다. 2. (필요하면) 볼륨 그룹 만들기: mkvg -f -y VGName -d 1 DeviceName 3. 저널 파일 시스템 만들기: crfs -v jfs -g VGName -a size=SizeFileSystem -m MountPoint -A AutomaticMount -p rw 4. 파일 시스템 마운트: mount MountPoint
이전에 만든 JFS에 접근(참고 1) 1. 광 디스크를 드라이브에 넣습니다. 2. 볼륨 그룹 가져오기: smit importvg 1. 광 디스크를 드라이브에 넣습니다. 2. 볼륨 그룹 가져오기: importvg -y VGName DeviceName 3. 파일 시스템 마운트: mount MountPoint
JFS 제거(참고 2) 1. 파일 시스템 마운트 해제: smit umountfs 2. 파일 시스템 제거: smit rmjfs 1. 파일 시스템 마운트 해제: umount FileSystem 2. 파일 시스템 제거: rmfs MountPoint

참고

  • 저널 파일 시스템이 든 매체를 넣을 때마다 이 절차가 필요합니다.
  • 저널 파일 시스템을 지우면 그 파일 시스템과 읽기·쓰기 광 매체의 모든 데이터가 파괴됩니다.

파일 시스템 검사

파일 시스템이 마운트된 채로 시스템이 멈추거나 디스크가 손상되면 파일 시스템에 불일치가 생길 수 있습니다. 이런 경우 마운트하기 전에 파일 시스템을 검사하는 것이 중요합니다.

다음 경우에도 파일 시스템을 검사합니다.

  • 오작동 뒤. 예를 들어 사용자가 자기 권한(uid)이 있는 디렉터리로 이동할 수 없을 때
  • 오류와 복원 문제를 막으려고 파일 시스템을 백업하기 전
  • 운영 체제 파일 오류가 없는지 확인하려고 설치나 시스템 부팅 때

사용자 정의 파일 시스템 검사

사용자 정의 파일 시스템을 검사하려면 다음 단계를 따릅니다.

  1. 검사할 사용자 정의 파일 시스템을 마운트 해제합니다.
  2. 파일 시스템의 파일에 쓰기 권한이 있는지 확인합니다. 없으면 고치기 프롬프트에 Yes라고 답해도 fsck가 손상된 파일을 고치지 못합니다.
  3. smit fsck 빠른 경로로 Verify a File System 메뉴에 들어갑니다.
  4. 다음 가운데 하나를 합니다.
    • NAME of file system 필드에 검사할 개별 파일 시스템 이름을 지정합니다.
    • TYPE of file system 필드에서 저널 파일 시스템(JFS) 같은 일반 파일 시스템 형을 고릅니다.
  5. 가능성이 가장 큰 것만 검사하려면 FAST check? 필드에 Yes를 지정합니다. 빠른 검사 옵션은 과거 시스템이 멈출 때 마운트돼 있던 파일 시스템처럼 불일치가 있을 법한 파일 시스템만 검사합니다.
  6. SCRATCH file 필드에 검사하지 않는 파일 시스템의 임시 파일 이름을 지정합니다.
  7. 파일 시스템 검사를 시작합니다.

루트와 /usr 파일 시스템 검사

실행 중인 시스템에서는 /(루트)와 /usr 파일 시스템을 마운트 해제할 수 없으므로, /나 /usr 파일 시스템에 fsck 명령을 실행하려면 시스템을 종료하고 이동식 매체로 재부팅해야 합니다.

다음 절차는 유지 보수 셸에서 /와 /usr 파일 시스템에 fsck를 실행하는 방법입니다.

  1. 시스템을 종료합니다(root 권한 필요).
  2. 설치 매체로 부팅합니다.
  3. Welcome 메뉴에서 Maintenance 옵션을 고릅니다.
  4. Maintenance 메뉴에서 볼륨 그룹에 접근하는 옵션을 고릅니다.
  5. rootvg 볼륨 그룹을 고릅니다. 고른 볼륨 그룹에 속한 논리 볼륨 목록이 나옵니다.
  6. 2를 골라 볼륨 그룹에 접근하고 파일 시스템을 마운트하기 전에 셸을 시작합니다. 다음 단계에서 알맞은 옵션과 파일 시스템 장치 이름으로 fsck 명령을 실행합니다. fsck 명령은 파일 시스템 일관성을 검사하고 대화식으로 고칩니다. /(루트) 파일 시스템 장치는 /dev/hd4, /usr 파일 시스템 장치는 /dev/hd2입니다.
  7. / 파일 시스템을 검사하려면 다음을 입력합니다.
text
$ fsck -y /dev/hd4

경험이 적은 사용자에게는 -y 플래그를 권합니다(fsck 명령 참고). 8. /usr 파일 시스템을 검사하려면 다음을 입력합니다.

text
$ fsck -y /dev/hd2
  1. rootvg의 다른 파일 시스템을 검사하려면 알맞은 장치 이름으로 fsck 명령을 입력합니다. /tmp 장치는 /dev/hd3, /var 장치는 /dev/hd9var입니다.
  2. 파일 시스템 검사를 마치면 시스템을 재부팅합니다.

루트 볼륨 그룹의 파일 시스템 크기 줄이기

모든 파일 시스템을 최소 크기로 줄이는 가장 간단한 방법은 백업에서 기본 운영 체제를 복원할 때 SHRINK 옵션을 yes로 설정하는 것입니다. SHRINK 옵션과 다음 시나리오는 함께 쓸 수 없습니다. 다음 절차를 한 뒤 SHRINK 옵션을 yes로 설정하면 설치가 /image.data 파일 변경을 덮어씁니다.

이 시나리오는 고른 rootvg 파일 시스템의 크기를 직접 줄이는 과정을 안내합니다. 할당된 디스크 공간을 다 쓰지 않는 파일 시스템을 찾아 실제 쓰는 공간에 맞춰 다시 할당해 루트 볼륨 그룹이 쓸 공간을 더 확보합니다. 이 절차의 일부로 볼륨 그룹을 백업하고 수정한 할당으로 운영 체제를 다시 설치합니다.

주의: 이 절차는 기본 운영 체제를 종료하고 다시 설치해야 합니다. 운영 체제를 다시 설치할 때는 데이터나 기능을 잃을 가능성에 대비해 작업 부하에 영향이 가장 적은 때로 정지 시간을 잡습니다. 다시 설치하기 전에 데이터와 사용자 정의 응용 프로그램이나 볼륨 그룹을 믿을 만하게 백업했는지 확인합니다.

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

  1. rootvg에 들지 않은 모든 파일 시스템을 따로 백업합니다. 별도 백업은 모든 파일 시스템의 무결성 보장에 도움이 됩니다.
  2. root 권한으로 다음 명령을 입력해 루트 볼륨 그룹의 어떤 파일 시스템이 할당된 디스크 공간을 쓰지 않는지 확인합니다.
text
df -k

-k 플래그는 파일 시스템 크기를 킬로바이트로 보여 줍니다. 결과는 다음과 비슷합니다.

text
Filesystem    1024-blocks      Free %Used    Iused %Iused Mounted on
/dev/hd4           196608      4976   98%     1944     2% /
/dev/hd2          1769472    623988   65%    36984     9% /usr
/dev/hd9var        163840     65116   61%      676     2% /var
/dev/hd3            65536     63024    4%      115     1% /tmp
/dev/hd1            49152      8536   83%      832     7% /home
/proc                   -         -    -         -     -  /proc
/dev/hd10opt        32768     26340   20%      293     4% /opt

이 결과에서 /usr에 마운트된 파일 시스템의 빈 블록이 많고 사용률이 꽤 낮은 것을 알 수 있습니다. /usr 파일 시스템에 할당된 파티션 수를 줄여 상당한 블록을 풀 수 있다고 판단합니다. 3. /etc/filesystems 파일 내용을 확인해 rootvg의 모든 파일 시스템이 마운트돼 있는지 봅니다. 마운트돼 있지 않으면 다시 설치한 시스템에 포함되지 않습니다. 4. 다음 명령으로 설치 절차에 포함되는 rootvg의 모든 활성 파일 시스템을 나열한 /image.data 파일을 만듭니다.

text
mkszfile
  1. 편집기로 /image.data 파일을 엽니다.
  2. usr 문자열을 찾아 /usr 파일 시스템에 해당하는 lv_data 스탠자를 찾습니다. 이 스탠자의 숫자를 바탕으로 /usr 파일 시스템의 논리 파티션 수를 얼마나 줄일지 정합니다. 추가 논리 파티션 하나의 기본 크기는 /image.data 파일의 PP_SIZE 항목에 정의돼 있습니다. /image.data 파일은 다음과 비슷합니다.
text
lv_data:
 VOLUME_GROUP= rootvg
 LV_SOURCE_DISK_LIST= hdisk0
 LV_IDENTIFIER= 00042345d300bf15.5
 LOGICAL_VOLUME= hd2
VG_STAT= active/complete
TYPE= jfs
MAX_LPS= 32512
COPIES= 1
LPs= 108
STALE_PPs= 0
INTER_POLICY= minimum
INTRA_POLICY= center
MOUNT_POINT= /usr
MIRROR_WRITE_CONSISTENCY= on/ACTIVE
LV_SEPARATE_PV= yes
PERMISSION= read/write
LV_STATE= opened/syncd
WRITE_VERIFY= off
PP_SIZE= 16
SCHED_POLICY= parallel
PP= 108
BB_POLICY= relocatable
RELOCATABLE= yes
UPPER_BOUND= 32
LABEL= /usr
MAPFILE=
LV_MIN_LPS= 70
STRIPE_WIDTH=
STRIP_SIZE=

이 논리 볼륨에 할당된 논리 파티션 수는 108(LPs=108)입니다. 7. 2단계 결과로 /usr 파일 시스템의 기존 데이터에 필요한 논리 파티션 수를 정합니다. 다음 명령으로 /usr 파일 시스템의 기존 파일 크기만 볼 수 있습니다.

text
df -k /usr

결과는 2단계에서 받은 /usr 파일 시스템 숫자(킬로바이트)를 되풀이합니다. 예:

text
Filesystem    1024-blocks      Free %Used    Iused %Iused Mounted on
/dev/hd2          1769472    623988   65%    36984     9% /usr
  1. 할당된 총 1024 블록 수에서 빈 공간을 뺍니다.
text
1769472 - 623988 = 1145484
  1. 이 파일 시스템에서 앞으로 늘어날 공간을 추정해 더합니다. 이 예에서는 결과에 200000을 더합니다.
text
1145484 + 200000 = 1345484
  1. 결과를 바이트 단위 논리 파티션 크기(16*1024)로 나눠 필요한 최소 논리 파티션 수를 정합니다.
text
1345484 / 16384 = 82.121826171875

이 결과를 올림해 필요한 논리 파티션 수를 다시 정합니다(LPs=83). 8. image.data 파일에서 LPs 필드를 108에서 83으로 바꿉니다. 9. /usr 파일 시스템에 해당하는 fs_data 스탠자를 찾습니다. fs_data 스탠자는 다음과 비슷합니다.

text
fs_data:
 FS_NAME= /usr
 FS_SIZE= 3538944
 FS_MIN_SIZE= 2290968
 FS_LV= /dev/hd2
 FS_FS= 4096
 FS_NBPI= 4096
 FS_COMPRESS= no
 FS_BF= false
 FS_AGSIZE= 8
  1. 물리 파티션 크기(PP_SIZE)에 2(물리 파티션이 쓰는 512바이트 블록 수)와 논리 파티션 수(LPs)를 곱해 파일 시스템 크기(FS_SIZE)를 계산합니다. 이 예의 값으로 계산하면 다음과 같습니다.
text
PP_SIZE * 512 blocks * LPs = FS_SIZE
16384 * 2 * 83 = 2719744
  1. image.data 파일에서 FS_SIZE 필드를 3538944에서 2719744로 바꿉니다.
  2. /usr 파일 시스템이 지금 쓰는 데이터의 실제 크기로 최소 파일 시스템 크기(FS_MIN_SIZE)를 다음과 같이 계산합니다.
    1. 필요한 최소 파티션 수를 계산합니다. 이 예의 값으로는 size_in_use(7a단계) / PP_SIZE = 파티션 수, 곧 1145484 / 16384 = 69.914794921875입니다.
    2. 그 파티션 수에 필요한 최소 크기를 계산합니다. 앞 결과를 70으로 올림하면 다음과 같습니다.
text
PP_SIZE * 512 blocks * partitions = FS_MIN_SIZE
16384 * 2 * 70 = 2293760
  1. image.data 파일에서 FS_MIN_SIZE 필드를 2290968에서 2293760으로 바꿉니다.
  2. 편집 내용을 저장하고 편집기를 끝냅니다.
  3. rootvg 볼륨 그룹에 없는 모든 파일 시스템을 마운트 해제합니다.
  4. 사용자 정의 볼륨 그룹이 있으면 다음 명령을 입력해 vary-off하고 내보냅니다.
text
varyoffvg VGName
exportvg VGName
  1. 테이프 드라이브에 테이프를 넣고 다음 명령을 입력해 전체 시스템 백업을 시작합니다.
text
mksysb /dev/rmt0

이 백업에는 /image.data 파일에 지정한 파일 시스템 크기 정보가 들어가며, 나중에 새 파일 시스템 크기로 시스템을 다시 설치하는 데 씁니다.

참고: 이 백업은 명령행에서 mksysb 명령으로 시작해야 합니다. SMIT 같은 시스템 관리 도구를 쓰면 백업이 새 `image.data` 파일을 만들어 변경을 덮어씁니다.
  1. 이 백업으로 Install With Current System Settings 옵션을 써서 운영 체제를 다시 설치합니다. 설치하는 동안 다음 옵션이 알맞게 설정됐는지 확인합니다.

    • Use Maps는 no여야 합니다.
    • Shrink the File Systems는 no여야 합니다.

    설치 절차에 관한 자세한 내용은 Installing system backups를 봅니다.

  2. 운영 체제를 설치한 뒤 Normal 모드로 시스템을 재부팅합니다. 이제 /usr 파일 시스템 크기가 바뀌었지만 사용자 정의 파일 시스템은 아직 쓸 수 없습니다.

  3. 다음 명령을 입력해 모든 파일 시스템을 마운트합니다.

text
mount all

이미 마운트된 파일 시스템에 대한 Device Busy 메시지는 무시해도 됩니다.

이제 /usr 파일 시스템 크기가 바뀌었고, 루트 볼륨 그룹에 빈 공간이 더 생겼으며, 파일 시스템을 쓸 수 있습니다.

관련 개념

  • 논리 볼륨 저장소

관련 정보

  • 테이프나 파일로 루트 볼륨 그룹 백업 만들기, /image.data 파일 설명, mkszfile 명령, mksysb 명령
영어 원문

Maintaining file systems

The simplest tasks you might need when maintaining file systems are grouped within this table.

Table 65. Maintaining File Systems Tasks Task SMIT Fast Path Command or File Backup by name files or directories smit backfile backup Note 1 Create and back up a JFS2 snapshot image smit backsnap backsnap Note 1 List all file systems on a disk smit lsmntdsk List file systems on a removable disk smit lsmntdsk List mounted file systems smit fs Mount a group of file systemsNote 5 smit mountg mount -t GroupName Mount a JFS or JFS2Note 3 smit mountfs mount Mount a JFS2 snapshot smit mntsnap mount -v jfs2 -o snapshot Device MountPoint Remove a JFS or JFS2 smit rmfs Remove a JFS2 snapshot smit rmsnap snapshot -d SnapshotDevice Revert a JFS2 file system to a point-in-time snapshot smit rollbacksnap rollback [-s] [-v] [-c] snappedFS snapshotObject Unmount a file systemNote 4 smit umountfs Unmount a file system on a removable diskNote 4 smit umntdsk

Unmount a group of file systemsNote 5 smit umountg umount -t GroupName Manage Enhanced Journaled File Systems quotas smit j2fsquotas

Enable or disable quota management smit j2enablequotas Stop/restart quota limits enforcement smit j2enforcequotas quotaon|off -v List quota usage smit j2repquota repquota -v Recalculate current disk block and file usage statistics

  • Add a limits class smit j2addlimit — j2edlimit -e

Change/show characteristics of a limits class smit j2changelimit

Make a limits class the default limits for a file system smit j2defaultlimit

Table 65. Maintaining File Systems Tasks (continued) Task SMIT Fast Path Command or File Assign a user or group to a limits class smit j2assignlimit List limits classes for a file system smit j2listlimits j2edlimit -l '-u' Remove a limits class smit j2removelimit

Note

  1. For options, refer to the individual commands.

  2. Do not change the names of system-critical file systems, which are / (root) on logical volume 4 (hd4), /usr on hd2, /var on hd9var, /tmp on hd3, and /blv on hd5. If you use the hdn convention, start at hd10.

  3. Check the file systems before mounting by using the procedure File system verification or running the fsck command.

  4. If an unmount fails, it might be because a user or process has an opened file in the file system being unmounted. The fuser command lets you find out which user or process might be causing the failure.

  5. A file system group is a collection of file systems which have the same value for the type= identifier in the /etc/filesystems file.

Related tasks

Mounting space from another disk drive You can get more space on a disk drive by mounting space from another drive.

Recovering one or more files from an online external JFS2 snapshot:

You can replace a corrupted file if you have an accurate copy in an online external JFS2 snapshot.

Use the following procedure to recover one or more files from an online external JFS2 snapshot image.

For this example, assume that /home/aaa/myfile is a corrupted file in the /home file system.

  1. Mount the snapshot with a command similar to the following:
text
mount -v jfs2 -o snapshot /dev/mysnaplv /tmp/mysnap
  1. Change to the directory that contains the snapshot with a command similar to the following:
text
cd /tmp/mysnap
  1. Copy the accurate file from the snapshot to overwrite the corrupted file with a command similar to the following:
text
cp aaa/myfile /home/aaa/myfile

The previous example copies only the file named myfile. If you want to copy all the files from the snapshot to the aaa directory, use a command similar to the following:

text
cp -R aaa /home/aaa

For more examples of replacing corrupted files with snapshot images, see the cp or cpio command descriptions in Commands Reference, Volume 1.

Recovering one or more files from an online internal JFS2 snapshot:

You can replace a corrupted file if you have an accurate copy in an online internal JFS2 snapshot.

Use the following procedure to recover one or more files from an online internal JFS2 snapshot image.

For this example, assume that /home/aaa/myfile is a corrupted file in the /home file system.

  1. Change to the directory that contains the snapshot with a command similar to the following:
text
cd /home/.snapshot/mysnap
  1. Copy the accurate file from the snapshot to overwrite the corrupted file with a command similar to the following:
text
cp aaa/myfile /home/aaa/myfile

The previous example copies only the file named myfile. If you want to copy all of the files from the snapshot to the aaa directory, use a command similar to the following:

text
cp -R aaa /home/aaa

For more examples of replacing corrupted files with snapshot images, see the cp or cpio command descriptions in Commands Reference, Volume 1.

File systems on CD-ROM and DVD disks

CDs and DVDs are not automatically mounted, but this feature can be enabled.

To enable this feature, use the cdmount command to mount the CDRFS or UDFS file system, for example:

text
cdmount cd0

You can manually mount a read/write UDFS with the following command:

text
mount -V udfs DevName MtPt

Where DevName is the name of the DVD drive and MtPt is the mount point for the file system.

Using file systems on read/write optical media

CDRFS and JFS file systems can be used on read/write optical media.

A CD-ROM file system (CDRFS) can be stored on read/write optical media, provided that the optical media is write-protected, as well as on a CD-ROM. The following table tells you how to add, mount, or unmount a CDRFS on read/write optical media. You must specify the following information when mounting the file system:

  • Device name — Defines the name of device containing the media.
  • Mount point — Specifies the directory where the file system will be mounted.
  • Automatic mount — Specifies whether the file system will be mounted automatically at system restart.
  • CDRFS on Optical Media Tasks
  • Task — SMIT Fast Path Command or File
  • Adding a CDRFS 1 — smit crcdrfs 1. Add the file system: crfs -v cdrfs -p ro -dDeviceName -m MountPoint -A AutomaticMount 2. Mount the file system: mount MountPoint

Removing a CDRFS2

  1. Unmount the file system: smit umountfs

  2. Remove the file system: smit rmcdrfs

  3. Unmount the file system: umount FileSystem

  4. Remove the file system: rmfs MountPoint

Note

  • Make sure the read/write optical media is write-protected.

  • A CDRFS file system must be unmounted before the read/write optical media can be removed.

A JFS provides a read/write file system on optical media similar to those on a hard disk. You must have system authority to create or import a read/write file system on read/write optical media (that is, your login must belong to the system group) and you must have the following information:

Volume group name

Specifies the name of the volume group

Device name

Specifies the logical name of the read/write optical drive

Mount point

Specifies the directories where the file systems will be mounted

Automatic mount

Specifies whether the file system will be mounted automatically at system restart

Note

  • Any volume group created on read/write optical media must be self contained on that media. Volume groups cannot go beyond one read/write optical disk.

  • When accessing a previously created journaled file system, the volume group name does not need to match the one used when the volume group was created.

JFS on Optical Media Tasks Task SMIT Fast Path Command or File Add a JFS 1. Insert optical disk into drive.

  1. Create a volume group (if necessary): smit mkvg

  2. Create a journaled file system: smit crfs

  3. Insert optical disk into drive.

  4. Create a volume group (if necessary): mkvg -f -y VGName -d 1 DeviceName

  5. Create a journaled file system: crfs -v jfs -g VGName -a size=SizeFileSystem -m MountPoint -A AutomaticMount -p rw

  6. Mount the file system: mount MountPoint

Accessing previously created JFSNote 1

  1. Insert optical disk into drive.

  2. Import the volume group: smit importvg

  3. Insert optical disk into drive.

  4. Import the volume group: importvg -y VGName DeviceName

  5. Mount the file system: mount MountPoint

Removing a JFSNote 2

  1. Unmount the file system: smit umountfs

  2. Remove the file system: smit rmjfs

  3. Unmount the file system: umount FileSystem

  4. Remove the file system: rmfs MountPoint

Note

  • This procedure is required whenever inserting media containing journaled file systems.

  • Removing a journaled file system destroys all data contained in that file system and on the read/write optical media.

File system verification

Inconsistencies can occur in file systems when the system is stopped while file systems remained mounted or when a disk is damaged. In such circumstances, it is important to verify file systems before mounting them.

Also verify your file systems in the following circumstances:

  • After a malfunction; for example, if a user cannot change directories to a directory that has that user's permissions (uid)

  • Before backing up file systems to prevent errors and possible restoration problems

  • At installation or system boot to make sure that there are no operating system file errors

Checking a user-defined file system:

To check a user-defined file system, perform the following steps.

  1. Unmount the user-defined file system being checked.

  2. Ensure you have write permission on files in the file system. Otherwise, the fsck cannot repair damaged files even if you answer Yes to repair prompts.

  3. Use the smit fsck fast path to access the Verify a File System menu.

  4. Do one of the following:

  • Specify the name of an individual file system to check in the NAME of file system field, or

  • Select a general file system type to check, such as a journaled file system (JFS) in the TYPE of file system field.

  1. If you want to limit your check to the most likely candidates, specify Yes in the FAST check? field. The fast-check option checks only those file systems that are likely to have inconsistencies such as the file systems that were mounted when the system stopped at some point in the past.

  2. Specify the name of a temporary file on a file system not being checked in the SCRATCH file field.

  3. Start the file system check.

Checking root and /usr file systems:

To run the fsck command on / or /usr file system, you must shut down the system and reboot it from removable media because the / (root) and /usr file systems cannot be unmounted from a running system.

The following procedure describes how to run fsck on the / and /usr file systems from the maintenance shell.

  1. Shut down your system. (Root access required)

  2. Boot from your installation media.

  3. From the Welcome menu, choose the Maintenance option.

  4. From the Maintenance menu, choose the option to access a volume group.

  5. Choose the rootvg volume group. A list of logical volumes that belong to the volume group you selected is displayed.

  6. Choose 2 to access the volume group and to start a shell before mounting file systems. In the following steps, you will run the fsck command using the appropriate options and file system device names. The fsck command checks the file system consistency and interactively repairs the file system. The / (root) file system device is /dev/hd4 and the /usr file system device is /dev/hd2.

  7. To check / file system, type the following:

text
$ fsck -y /dev/hd4

The -y flag is recommended for less experienced users (see the fsck command).

  1. To check the /usr file system, type the following:
text
$ fsck -y /dev/hd2
  1. To check other file systems in the rootvg, type the fsck command with the appropriate device names. The device for /tmp is /dev/hd3, and the device for /var is /dev/hd9var.

  2. When you have completed checking the file systems, reboot the system.

Reducing the size of a file system in your root volume group:

The simplest way to reduce all file systems to their minimum size is to set the SHRINK option to yes when restoring the base operating system from backup.

The simplest way to reduce all file systems to their minimum size is to set the SHRINK option to yes when restoring the base operating system from backup. The SHRINK option and the following scenario cannot be used in tandem. If you set the SHRINK option to yes after doing the following procedure, the installation overrides your changes to the /image.data file.

This scenario leads you through a manual process to reduce the size of a selected rootvg file system. You will identify a file system that is not using all of its allocated disk space and then reallocate based on the amount of space the file system actually uses, thus freeing more space for the root volume group's use. As part of this procedure, you will back up your volume groups and reinstall the operating system, using the revised allocations.

Attention: This procedure requires shutting down and reinstalling the base operating system. Whenever you reinstall any operating system, schedule your downtime when it least impacts your workload to protect yourself from a possible loss of data or functionality. Before reinstalling the operating system, ensure you have reliable backups of your data and any customized applications or volume groups.

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.

  1. Create a separate backup of all file systems that are not contained in the rootvg. The separate backup helps ensure the integrity of all your file systems.

  2. With root authority, check which file systems in your root volume group are not using their allocated disk space by typing the following command:

text
df -k

The -k flag displays the file-system sizes in kilobytes. Your result will look similar to the following:

text
Filesystem    1024-blocks      Free %Used    Iused %Iused Mounted on
/dev/hd4           196608      4976   98%     1944     2% /
/dev/hd2          1769472    623988   65%    36984     9% /usr
/dev/hd9var        163840     65116   61%      676     2% /var
/dev/hd3            65536     63024    4%      115     1% /tmp
/dev/hd1            49152      8536   83%      832     7% /home
/proc                   -         -    -         -     -  /proc
/dev/hd10opt        32768     26340   20%      293     4% /opt

Looking at these results, you notice a large number of free blocks and a fairly low percentage of use associated for the file system that is mounted on /usr. You decide you can release a significant number of blocks by reducing the number of partitions allocated to the /usr file system.

  1. Check the contents of the /etc/filesystems file to ensure that all file systems in the rootvg are mounted. If not, they will not be included in the reinstalled system.

  2. Create an /image.data file, which lists all the active file systems in the rootvg that are included in the installation procedure, by typing the following command:

text
mkszfile
  1. Open the /image.data file in your favorite editor.

  2. Search for the usr text string to locate the lv_data stanza that pertains to the /usr file system. Use numbers from this stanza as a base to determine how much you can reduce the /usr file system's number of logical partitions. The default size of each additional logical partition is defined in the PP_SIZE entry of the /image.data file. Your /image.data file would look similar to the following:

(30줄짜리 예는 위 한글 본문에 그대로 실었습니다.)

The number of logical partitions devoted to this logical volume is 108 (LPs=108).

  1. Determine the number of logical partitions needed by the existing data in the /usr file system by using your result from step 2. You can display the existing file sizes specifically for the /usr file system by using the following command:
text
df -k /usr

The result repeats the numbers (in kilobytes) you received for the /usr file system in step 2. For example:

text
Filesystem    1024-blocks      Free %Used    Iused %Iused Mounted on
/dev/hd2          1769472    623988   65%    36984     9% /usr
  1. Subtract the amount of free space from the total number of 1024-blocks allocated:
text
1769472 - 623988 = 1145484
  1. Add an estimate of the space you might need to accommodate any future growth expected in this file system. For this example, add 200000 to the result.
text
1145484 + 200000 = 1345484
  1. Divide the result by the logical-partition size in bytes (16*1024) to determine the minimum number of logical partitions you need.
text
1345484 / 16384 = 82.121826171875

Use this result, rounded upward, to redefine the number of logical partitions needed (LPs=83).

  1. In your image.data file, change the LPs field from 108 to 83.

  2. Find the fs_data stanza that pertains to the /usr file system. Your fs_data stanza will look similar to the following:

text
fs_data:
 FS_NAME= /usr
 FS_SIZE= 3538944
 FS_MIN_SIZE= 2290968
 FS_LV= /dev/hd2
 FS_FS= 4096
 FS_NBPI= 4096
 FS_COMPRESS= no
 FS_BF= false
 FS_AGSIZE= 8
  1. Calculate the file-system size (FS_SIZE) by multiplying the physical partition size (PP_SIZE) by 2 (the number of 512-byte blocks used by the physical partitions) by the number of logical partitions (LPs). Given the values used in this example, the calculation is:
text
PP_SIZE * 512 blocks * LPs = FS_SIZE
16384 * 2 * 83 = 2719744
  1. In your image.data file, change the FS_SIZE field from 3538944 to 2719744.

  2. Calculate the minimum file-system size (FS_MIN_SIZE) based on the actual size of the current data used by the /usr file system, as follows: a. Calculate the minimum number of partitions needed. Given the values used in this example, the calculation is:

size_in_use (see step 7a) / PP_SIZE = partitions 1145484 / 16384 = 69.914794921875 b. Calculate the minimum size required by that number of partitions. Rounding the previous calculation results upward to 70, the calculation is:

text
PP_SIZE * 512 blocks * partitions = FS_MIN_SIZE
16384 * 2 * 70 = 2293760
  1. In your image.data file, change the FS_MIN_SIZE field from 2290968 to 2293760.

  2. Save your edits and exit the editor.

  3. Unmount all file systems that are not in the rootvg volume group.

  4. If you have any user-defined volume groups, type the following commands to vary off and export them:

text
varyoffvg VGName
exportvg VGName
  1. With a tape in the tape drive, type the following command to initiate a complete system backup:
text
mksysb /dev/rmt0

This type of backup includes the file-system size information you specified in the /image.data file, which will be used later to reinstall your system with the new file-system sizes.

Note: To initiate this backup, you must run the mksysb command from the command line. If you use a system management tool, such as SMIT, the backup creates a new image.data file, overwriting the changes you have made.

  1. Use this backup to reinstall the operating system using the Install With Current System Settings option. During the installation, check that the following options are set appropriately:
  • Use Maps must be set to no

  • Shrink the File Systems must be set to no If you need more information about the installation procedure, see the Installing system backups.

  1. After the operating system is installed, reboot the system in Normal mode. At this point, the /usr file system is resized, but your user-defined file systems are not available.

  2. Mount all file systems by typing the following command:

text
mount all

If you receive Device Busy messages about file systems that are already mounted, you can ignore these messages.

At this point, your /usr file system is resized, your root volume group has more free space, and your file systems are usable.

Related concepts

Logical volume storage Logical volumes are groups of information located on physical volumes.

Related information

Creating a Root Volume Group Backup to Tape or File /image.data file description mkszfile command mksysb command

파일 시스템 문제 해결

다음 문제 해결 방법으로 파일 시스템에 생길 수 있는 기본 문제를 다룹니다. 이 정보로 해결되지 않으면 서비스 담당자에게 연락합니다.

사용자 정의 파일 시스템 넘침 고치기

다음 절차로 넘치는 사용자 정의 파일 시스템을 고칩니다.

  1. 오래된 백업 파일과 core 파일을 지웁니다. 다음 예는 모든 *.bak, .*.bak, a.out, core, *(원문 그대로), ed.hup 파일을 지웁니다.
text
find / \( -name "*.bak" -o -name core -o -name a.out -o \
        -name "...*" -o -name ".*.bak" -o -name ed.hup \) \
        -atime +1 -mtime +1 -type f -print | xargs -e rm -f
  1. 파일이 정기적으로 디스크를 넘치지 않게 하려면 cron 과정의 일부로 skulker 명령을 실행해 불필요하거나 임시인 파일을 지웁니다. skulker 명령은 /tmp 디렉터리의 파일, 지정한 기간보다 오래된 파일, a.out 파일, core 파일, ed.hup 파일을 지웁니다. (계정을 켰다면) 한가한 시간에 cron 명령이 실행하는 계정 절차의 일부로 매일 실행됩니다. cron 데몬은 지정한 날짜와 시각에 셸 명령을 실행합니다. skulker 같은 정기 명령은 crontab 파일의 지침에 따라 지정할 수 있습니다. crontab 파일은 crontab 명령으로 제출합니다. crontab 파일을 편집하려면 root 사용자 권한이 있어야 합니다.

관련 작업

  • 계정 시스템 설정

손상된 파일 시스템 고치기

파일 시스템 디렉터리 구조의 i-node나 슈퍼블록 정보가 손상되면 파일 시스템이 손상될 수 있습니다.

이 손상은 하드웨어 관련 문제나, i-node나 슈퍼블록 정보에 직접 접근하는 프로그램이 잘못되어 생길 수 있습니다(어셈블러와 C로 작성한 프로그램은 운영 체제를 거치지 않고 하드웨어에 직접 쓸 수 있습니다). 파일 시스템이 손상된 증상 하나는 시스템이 그 파일 시스템의 데이터를 찾거나, 읽거나, 쓸 수 없는 것입니다.

손상된 파일 시스템을 고치려면 문제를 진단한 뒤 고쳐야 합니다. fsck 명령이 저수준 진단과 수리를 합니다.

손상된 파일 시스템을 고치는 절차는 다음과 같습니다.

  1. root 권한으로 다음 SMIT 빠른 경로 가운데 하나로 손상된 파일 시스템을 마운트 해제합니다. 고정 디스크 드라이브의 파일 시스템은 smit unmountfs, 이동식 디스크의 파일 시스템은 smit unmntdsk.
  2. fsck 명령을 실행해 파일 시스템 손상을 평가합니다. 다음 예에서 fsck 명령은 /dev/myfilelv 장치에 있는 마운트 해제된 파일 시스템을 검사합니다.
text
fsck /dev/myfilelv

fsck 명령은 일관되지 않은 파일 시스템을 검사하고 대화식으로 고칩니다. 보통 파일 시스템은 일관되며 fsck 명령은 파일 수, 사용 블록, 빈 블록 수만 보고합니다. 파일 시스템이 일관되지 않으면 찾은 불일치 정보를 보여 주고 고칠지 묻습니다. fsck 명령은 수리에 보수적이어서 유효한 데이터를 잃을 수 있는 동작을 피하려 합니다. 그러나 어떤 경우에는 손상된 파일을 없애라고 권합니다. 이 명령이 검사하는 불일치 목록은 Commands Reference, Volume 2의 fsck 명령 설명을 봅니다. 3. 파일 시스템을 고칠 수 없으면 백업에서 복원합니다. 주의: 백업에서 파일 시스템을 복원하면 디스크에 있던 파일 시스템을 파괴하고 대체합니다. 백업에서 파일 시스템을 복원하려면 SMIT 빠른 경로 smit restfilesys나 다음 예와 같은 명령 순서를 씁니다.

text
mkfs /dev/myfilelv
mount /dev/myfilelv /myfilesys
cd /myfilesys
restore -r

이 예에서 mkfs 명령은 /dev/myfilelv 장치에 새 파일 시스템을 만들고 볼륨 레이블, 파일 시스템 레이블, 시작 블록을 초기화합니다. mount 명령은 /dev/myfilelv를 myfilesys의 마운트 지점으로 정하고(원문 그대로), restore 명령은 백업에서 파일 시스템을 꺼냅니다. 증분 파일 시스템 백업을 만들었으면 백업 수준이 커지는 순서(예: 0, 1, 2)로 복원해야 합니다. smit restfilesys로 파일 시스템 전체를 복원할 때는 대상 디렉터리, (/dev/rfd0가 아닌) 복원 장치, 한 번의 입력 작업에서 읽을 블록 수를 입력합니다.

관련 작업

  • 백업 이미지에서 사용자 파일 복원 — 실수로 지운 파일을 복원할 때 가장 어려운 문제는 어느 백업 테이프에 그 파일이 있는지 정하는 것입니다. restore -T 명령으로 아카이브 내용을 나열할 수 있습니다. 사용자의 다른 파일을 실수로 덮어쓰지 않도록 /tmp 디렉터리에 복원하는 것이 좋습니다.

파일 시스템 슈퍼블록의 손상된 매직 넘버 고치기

파일 시스템의 슈퍼블록이 손상되면 파일 시스템에 접근할 수 없습니다. 파일 시스템 슈퍼블록의 손상된 매직 넘버는 고칠 수 있습니다.

슈퍼블록 손상은 대부분 고칠 수 없습니다. 다음 절차는 손상된 매직 넘버 때문에 문제가 생겼을 때 JFS 파일 시스템의 슈퍼블록을 고치는 방법입니다. JFS2 파일 시스템의 1차 슈퍼블록이 손상되면 fsck 명령으로 보조 슈퍼블록을 자동으로 복사해 1차 슈퍼블록을 고칩니다.

다음 시나리오에서 /home/myfs는 물리 볼륨(원문 그대로, 논리 볼륨) /dev/lv02에 있는 JFS 파일 시스템이라고 합니다.

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

  1. 다음 명령으로 손상됐다고 의심되는 /home/myfs 파일 시스템을 마운트 해제합니다.
text
umount /home/myfs
  1. 파일 시스템 손상을 확인하려면 파일 시스템에 fsck 명령을 실행합니다. 예:
text
fsck -p /dev/lv02

문제가 슈퍼블록 손상이면 fsck 명령은 다음 메시지 가운데 하나를 돌려줍니다.

text
fsck: Not an AIXV5 file system

또는

text
Not a recognized filesystem type
  1. root 권한으로 다음 예처럼 od 명령으로 파일 시스템의 슈퍼블록을 봅니다.
text
od -x -N 64 /dev/lv02 +0x1000

-x 플래그는 16진 형식으로 출력하고, -N 플래그는 파일 출력이 시작하는 위치를 지정하는 오프셋 매개변수(+)부터 64입력 바이트까지만 서식화하게 합니다. 다음은 출력 예입니다.

text
0001000  1234 0234 0000 0000 0000 4000 0000 000a
0001010  0001 8000 1000 0000 2f6c 7633 0000 6c76
0001020  3300 0000 000a 0003 0100 0000 2f28 0383
0001030  0000 0001 0000 0200 0000 2000 0000 0000
0001040

앞 출력에서 0x1000의 손상된 매직 값(1234 0234)에 주목합니다. 파일 시스템을 만들 때 기본값을 모두 받아들였다면 매직 넘버는 0x43218765여야 합니다. 기본값을 바꿨다면 0x65872143이어야 합니다. 4. od 명령으로 보조 슈퍼블록에 올바른 매직 넘버가 있는지 확인합니다. 명령과 출력 예는 다음과 같습니다.

text
$ od -x -N 64 /dev/lv02 +0x1f000
001f000  6587 2143 0000 0000 0000 4000 0000 000a
001f010  0001 8000 1000 0000 2f6c 7633 0000 6c76
001f020  3300 0000 000a 0003 0100 0000 2f28 0383
001f030  0000 0001 0000 0200 0000 2000 0000 0000
001f040

0x1f000의 올바른 매직 값에 주목합니다. 5. 보조 슈퍼블록을 1차 슈퍼블록으로 복사합니다. 명령과 출력 예는 다음과 같습니다.

text
$ dd count=1 bs=4k skip=31 seek=1 if=/dev/lv02 of=/dev/lv02
dd: 1+0 records in.
dd: 1+0 records out.
  1. fsck 명령으로 보조 슈퍼블록을 써서 생긴 일관되지 않은 파일을 정리합니다. 예:
text
fsck /dev/lv02 2>&1 | tee /tmp/fsck.errs

관련 정보

  • fsck 명령, od 명령
영어 원문

Troubleshooting file systems

Use these troubleshooting methods to tackle some of the basic problems that may occur to your file systems. If the troubleshooting information does not address your problem, contact your service representative.

Fixing a user-defined file system overflow

Use this procedure to fix an overflowing user-defined file system.

  1. Remove old backup files and core files. The following example removes all *.bak, .*.bak, a.out, core, *, or ed.hup files.
text
find / \( -name "*.bak" -o -name core -o -name a.out -o \
        -name "...*" -o -name ".*.bak" -o -name ed.hup \) \
        -atime +1 -mtime +1 -type f -print | xargs -e rm -f
  1. To prevent files from regularly overflowing the disk, run the skulker command as part of the cron process and remove files that are unnecessary or temporary. The skulker command purges files in /tmp directory, files older than a specified age, a.out files, core files, and ed.hup files. It is run daily as part of an accounting procedure run by the cron command during off-peak periods (assuming you have turned on accounting). The cron daemon runs shell commands at specified dates and times. Regularly scheduled commands such as skulker can be specified according to instructions contained in the crontab files. Submit crontab files with the crontab command. To edit a crontab file, you must have root user authority.

Related tasks

Setting up an accounting system You can set up an accounting system.

Fixing a damaged file system

File systems can get corrupted when the i-node or superblock information for the directory structure of the file system gets corrupted.

This corruption can be caused by a hardware-related ailment or by a program that gets corrupted that accesses the i-node or superblock information directly. (Programs written in assembler and C can bypass the operating system and write directly to the hardware.) One symptom of a corrupt file system is that the system cannot locate, read, or write data located in the particular file system.

To fix a damaged file system, you must diagnose the problem and then repair it. The fsck command performs low-level diagnosis and repairs.

The following is the procedure for fixing a damaged file system:

  1. With root authority, unmount the damaged file system using one of the following SMIT fast paths: smit unmountfs (for a file system on a fixed disk drive) or smit unmntdsk (for a file system on a removeable disk).

  2. Assess file system damage by running the fsck command. In the following example, the fsck command checks the unmounted file system located on the /dev/myfilelv device:

text
fsck /dev/myfilelv

The fsck command checks and interactively repairs inconsistent file systems. Normally, the file system is consistent, and the fsck command merely reports on the number of files, used blocks, and free

blocks in the file system. If the file system is inconsistent, the fsck command displays information about the inconsistencies found and prompts you for permission to repair them. The fsck command is conservative in its repair efforts and tries to avoid actions that might result in the loss of valid data. In certain cases, however, the fsck command recommends the destruction of a damaged file. Refer to the fsck command description in Commands Reference, Volume 2 for a list of inconsistences that this command checks for.

  1. If the file system cannot be repaired, restore it from backup. Attention: Restoring a file system from a backup destroys and replaces any file system previously stored on the disk. To restore the file system from backup, use the SMIT fastpath smit restfilesys or the series of commands shown in the following example:
text
mkfs /dev/myfilelv
mount /dev/myfilelv /myfilesys
cd /myfilesys
restore -r

In this example, the mkfs command makes a new file system on the device named /dev/myfilelv and initializes the volume label, file system label, and startup block. The mount command establishes /dev/myfilelv as the mountpoint for myfilesys and the restore command extracts the file system from the backup. If your backup was made using incremental file system backups, you must restore the backups in increasing backup-level order (for example, 0, 1, 2). When using smit restfilesys to restore an entire file system, enter the target directory, restore device (other than /dev/rfd0), and number of blocks to read in a single input operation.

Related tasks

Restoring user files from a backup image If you need to restore a backup image destroyed by accident, your most difficult problem is determining which of the backup tapes contains this file. The restore -T command can be used to list the contents of an archive. It is a good idea to restore the file in the /tmp directory so that you do not accidentally overwrite the user's other files.

Fixing a corrupted magic number in the file system superblock:

If the superblock of a file system is damaged, the file system cannot be accessed. You can fix a corrupted magic number in the file system superblock.

Most damage to the superblock cannot be repaired. The following procedure describes how to repair a superblock in a JFS file system when the problem is caused by a corrupted magic number. If the primary superblock is corrupted in a JFS2 file system, use the fsck command to automatically copy the secondary superblock and repair the primary superblock.

In the following scenario, assume /home/myfs is a JFS file system on the physical volume /dev/lv02.

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.

  1. Unmount the /home/myfs file system, which you suspect might be damaged, using the following command:
text
umount /home/myfs
  1. To confirm damage to the file system, run the fsck command against the file system. For example:
text
fsck -p /dev/lv02

If the problem is damage to the superblock, the fsck command returns one of the following messages:

text
fsck: Not an AIXV5 file system

OR

text
Not a recognized filesystem type
  1. With root authority, use the od command to display the superblock for the file system, as shown in the following example:
text
od -x -N 64 /dev/lv02 +0x1000

Where the -x flag displays output in hexadecimal format and the -N flag instructs the system to format no more than 64 input bytes from the offset parameter (+), which specifies the point in the file where the file output begins. The following is an example output:

text
0001000  1234 0234 0000 0000 0000 4000 0000 000a
0001010  0001 8000 1000 0000 2f6c 7633 0000 6c76
0001020  3300 0000 000a 0003 0100 0000 2f28 0383
0001030  0000 0001 0000 0200 0000 2000 0000 0000
0001040

In the preceding output, note the corrupted magic value at 0x1000 (1234 0234). If all defaults were taken when the file system was created, the magic number should be 0x43218765. If any defaults were overridden, the magic number should be 0x65872143.

  1. Use the od command to check the secondary superblock for a correct magic number. An example command and its output follows:
text
$ od -x -N 64 /dev/lv02 +0x1f000
001f000  6587 2143 0000 0000 0000 4000 0000 000a
001f010  0001 8000 1000 0000 2f6c 7633 0000 6c76
001f020  3300 0000 000a 0003 0100 0000 2f28 0383
001f030  0000 0001 0000 0200 0000 2000 0000 0000
001f040

Note the correct magic value at 0x1f000.

  1. Copy the secondary superblock to the primary superblock. An example command and output follows:
text
$ dd count=1 bs=4k skip=31 seek=1 if=/dev/lv02 of=/dev/lv02
dd: 1+0 records in.
dd: 1+0 records out.
  1. Use the fsck command to clean up inconsistent files caused by using the secondary superblock. For example:
text
fsck /dev/lv02 2>&1 | tee /tmp/fsck.errs

Related information

fsck command od command