mkfs 명령어 (AIX 5.3·6.1)
https://archive.horanglab.com/posts/aix-cmd-mkfs
핵심 정리
- 지정한 장치에 새 파일 시스템을 만들고 볼륨 레이블, 파일 시스템 레이블, 시작 블록을 초기화합니다. 장치의 기존 데이터는 사라집니다.
crfs와 달리 논리 볼륨을 만들지 않고/etc/filesystems에 스탠자도 넣지 않습니다. 보통은crfs를 쓰고,mkfs는 이미 등록된 파일 시스템을 다시 만들 때 씁니다.- 기본 형태:
mkfs -V jfs2 /dev/datalv, 확장 속성 v2는mkfs -V jfs2 -o ea=v2 /dev/datalv. 장치 대신 파일 시스템 이름을 주면/etc/filesystems값을 씁니다. - JFS2를 만들 논리 볼륨은 부 번호(minor number)가 3071보다 커야 합니다.
| 항목 | 내용 |
|---|---|
| 버전 | AIX 5.3, AIX 6.1 (6.1에서 JFS2 옵션 isnapshot, efs, vix, maxext가 더해짐) |
| 원문 | IBM Commands Reference — 5.3 Volume 3, 6.1 Volume 3 |
| 파일 | /usr/sbin/mkfs, /etc/filesystems, /etc/vfs |
| 관련 명령어 | crfs, mklv, fsck, mkproto, logform |
목적
파일 시스템을 만듭니다.
영어 원문
Makes a file system.
구문
mkfs [ -b Boot ] [ -l Label ] [ -i i-Nodes ] [ -o Options ] [ -p Prototype ] [ -s Size ] [ -v VolumeLabel ] [ -V VfsName ] Device
설명
mkfs 명령은 지정한 장치에 새 파일 시스템을 만듭니다. 볼륨 레이블, 파일 시스템 레이블, 시작(startup) 블록을 초기화합니다.
Device 매개변수는 블록 장치 이름, raw 장치 이름, 파일 시스템 이름입니다. 파일 시스템 이름이면, 명령줄에서 주지 않은 다음 값을 /etc/filesystems의 해당 스탠자에서 가져옵니다.
| 값 | 뜻 |
|---|---|
dev |
장치 이름 |
vol |
볼륨 ID |
size |
파일 시스템 크기 |
boot |
시작 블록에 설치할 프로그램 |
vfs |
가상 파일 시스템 정의 |
options |
Keyword, Keyword=Value 형식의 파일 시스템별 옵션 |
참고:
- 파일 시스템은 setgid(set group ID) 비트가 켜진 상태로 만들어집니다. 이 비트가 기본 그룹 권한을 정하며, 새 파일 시스템 아래에 만드는 디렉터리는 모두 같은 기본 그룹 권한을 가집니다.
- 마운트한 파일 시스템은 파일 시스템 레이블을 포함해 아무것도 바꾸지 않습니다. 마운트하지 않은 상태에서 마운트 지점을 바꾸면 파일 시스템 레이블이 바뀝니다.
- 스트라이프 논리 볼륨에 파일 시스템을 만드는 방법은
mklv문서의 "File Systems on Striped Logical Volumes"를 봅니다. - 논리 볼륨에 JFS2를 만들려면 그 논리 볼륨의 부 번호가 3071보다 커야 합니다.
영어 원문
The mkfs command makes a new file system on a specified device. The mkfs command initializes the volume label, file system label, and startup block.
The Device parameter specifies a block device name, raw device name, or file system name. If the parameter specifies a file system name, the mkfs command uses this name to obtain the following parameters from the applicable stanza in the /etc/filesystems file, unless these parameters are entered with the mkfs command:
- dev — Device name
- vol — Volume ID
- size — File system size
- boot — Program to be installed in the startup block
- vfs — Definition of the virtual file system
- options — File-system implementation-specific options of the form Keyword, Keyword=Value
- Note:
The file system is created with the setgid (set group ID) bit enabled. The setgid bit determines the default group permissions. All directories created under the new file system have the same default group permissions.
The mkfs command does not alter anything in a mounted file system, including the file system label. The file system label changes when you change the mount point, unless the file system is mounted.
For information about creating a file system on a striped logical volume, refer to File Systems on Striped Logical Volumes the mklv documentation.
To create a JFS2 file system on a logical volume, the minor number of the logical volume must be greater than
3071.
플래그
| 플래그 | 설명 |
|---|---|
-b Boot |
새 파일 시스템의 블록 0에 설치할 프로그램 이름. |
-i i-Nodes |
처음 inode 수. JFS를 만들 때는 무시합니다. |
-l Label |
새 파일 시스템의 레이블. |
-o Options |
가상 파일 시스템별 옵션을 쉼표로 구분해 줍니다. JFS와 JFS2 옵션은 아래 표에 있습니다. |
-p Prototype |
JFS를 만들 때 쓸 프로토타입 파일 이름. 명령줄 옵션이 프로토타입 파일의 속성보다 우선합니다. |
-s Size |
크기. 512바이트 블록 수, M(MB), G(GB) 접미사로 줍니다. 볼륨 그룹의 최대 논리 볼륨 크기가 한계이며, 최소 크기라 만든 뒤 줄일 수 없습니다. |
-v VolumeLabel |
새 파일 시스템의 볼륨 레이블. |
-V VfsName |
가상 파일 시스템 유형. /etc/vfs에 항목이 있어야 합니다. |
JFS 옵션
| 옵션 | 설명 |
|---|---|
ag={ 8, 16, 32, 64 } |
할당 그룹 크기(MB). BSD 실린더 그룹과 비슷한 inode·디스크 블록 묶음입니다. 기본 8. |
bf={ true, false } |
큰 파일을 쓸 수 있는 파일 시스템. 필요 없으면 false(기본). true는 조각 크기 4096과 compress=no가 필요합니다. |
frag={ 512, 1024, 2048, 4096 } |
JFS 조각 크기(바이트). 파일에 할당하는 가장 작은 디스크 단위. 기본 4096. |
compress={ no, LZ } |
데이터 압축. 압축하려면 조각 크기가 2048 이하여야 합니다. |
nbpi={ 512 ~ 131072 } |
inode당 바이트 수(512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072). 파일 시스템 크기와 전체 inode 수의 비율이며 기본 4096. |
참고: ag, bf, compress, frag, nbpi는 만들 때 정해지며 바꿀 수 없습니다. 크기는 최소 크기라 줄일 수 없습니다. 루트 파일 시스템(/)은 압축할 수 없습니다. 일부 nbpi 값과 할당 그룹 크기는 함께 쓸 수 없습니다.
JFS2 옵션
| 옵션 | 설명 |
|---|---|
agblksize={ 512, 1024, 2048, 4096 } |
JFS2 블록 크기(바이트). 기본 4096. |
isnapshot={ yes, no } |
(6.1) 내부 스냅숏을 지원할지 정합니다. yes면 내부 스냅숏과 v2 확장 속성을 지원하며, AIX 6.1 이전 릴리스와 호환되지 않습니다. |
name=mountpoint |
파일 시스템의 마운트 지점. |
log=LVName |
로그 논리 볼륨 이름. 새 JFS2의 로그 장치가 됩니다. |
log=INLINE |
로그를 파일 시스템 논리 볼륨 안에 둡니다. logsize가 없으면 논리 볼륨 크기의 0.4%. |
logsize=Value |
inline log 크기(MB). INLINE이 아니면 무시하며, 2047MB와 파일 시스템 크기의 10%를 넘을 수 없습니다. |
ea={ v1, v2 } |
확장 속성 저장 형식. v2는 확장 가능한 확장 속성과 NFS4 ACL을 지원하고, v1은 이전 AIX와 호환됩니다. 기본 v1. |
efs={ yes, no } |
(6.1) 암호화. yes면 확장 속성 형식을 자동으로 v2로 하므로 ea를 주지 않아도 됩니다. no면 암호화하지 않습니다. |
vix={ yes, no } |
(6.1) 연속된 16KB 공간이 없을 때 16KB보다 작은 inode 익스텐트를 할당할지 정합니다. 켜면 AIX 5.1 이하에서 쓸 수 없습니다. AIX 6.1부터 기본 yes. no는 이미 가변 길이 익스텐트가 있으면 효과가 없습니다. |
maxext=Value |
(6.1) 파일 익스텐트의 최대 크기(파일 시스템 블록 수). 0이면 JFS2 기본 최대값. 0보다 작거나 16777215를 넘으면 잘못된 값입니다. 이전 릴리스에서는 무시합니다. |
참고: agblksize와 ea 형식은 만들 때 정해집니다. ea는 chfs로 v1에서 v2로 바꿀 수 있지만 되돌릴 수 없으며, 확장 속성이나 ACL을 쓸 때 파일마다 필요할 때 바뀝니다.
제한(6.1): 시스템을 시작할 때는 보안 기반(커널 확장, 라이브러리 등)이 없으므로 /, /usr, /var, /opt에는 EFS를 켤 수 없습니다.
영어 원문
-bBoot — Names the program to be installed in block 0 of the new file system.-ii-Nodes — Specifies the initial number of i-nodes on the file system. This flag is ignored when creating a journaled file system.-lLabel — Specifies the file system label for the new file system.-oOptions — Specifies a comma-separated list of virtual file system implementation-specific options.The following options are specific to the Journaled File System (JFS):
-o ag={ 8|16|32|64 } — Specifies the allocation group size in megabytes. An allocation group is a grouping of i-nodes and disk blocks similar to BSD cylinder groups. The default ag value is 8.-o bf={ true|false } — Specifies a large file enabled file system. See JFS and large files for more information. If you do not need a large file enabled file system, set this option to false; this is the default. Specifying bf=true requires a fragment size of 4096 and compress=no.-o frag={ 512|1024|2048|4096 } — Specifies the JFS fragment size in bytes. A file system fragment is the smallest unit of disk storage that can be allocated to a file. The default fragment size is 4096 bytes.-o compress={ no|LZ } — Specifies data compression. If you do not want data to be compressed, set this option tono. Selecting compression requires a fragment size of 2048 or less.-o nbpi={ 512|1024|2048|4096|8192|16384|32768|65536|131072 } — Specifies the number of bytes per i-node (nbpi). The nbpi is the ratio of file system size in bytes to the total number of i-nodes. The default nbpi value is 4096 bytes.Notes:
The ag, bf, compress, frag, and nbpi attributes are set at file system creation and cannot be changed after the file system is successfully created. The size attribute defines the minimum file system size, and you cannot decrease it after the file system is created.
The root file system ( / ) cannot be compressed.
Some nbpi values and allocation group sizes are mutually exclusive. See "Understanding JFS Size Limitations" for information.
The following options are specific to the Enhanced Journaled File System:
-o agblksize={ 512 | 1024 | 2048 |4096 } — Specifies the Enhanced Journaled File System (JFS2) block size in bytes. A file system block is the smallest unit of disk storage that can be allocated to a file. The default block size is 4096 bytes.-o isnapshot={yes|no}— Specifies whether the file system can support internal snapshots. Specifying yes enables the file system to support internal snapshots and v2 extended attributes. The resulting file system is not compatible with releases earlier than AIX 6.1.-o name=mountpoint — Specifies the mount point for the file system.-o log=LVName — Specifies the log logical volume name. The specified logical volume is the logging device for the new JFS2.-o log=INLINE— Specifies to place the log in the logical volume with the JFS2 file system. The INLINE log will default to .4% of the logical volume size if logsize is not specified.-o logsize=Value — Specifies the size for an INLINE log in MBytes. Ignored if INLINE log not being used. Cannot be greater than 2047 MBytes and cannot be greater than 10% of the size of the file system.-o ea={v1 | v2}— Specifies the format to be used to store named extended attributes in the JFS2 file system. The v2 format provides support for scalable named extended attributes as well as support for NFS4 ACLs. The v1 format is compatible with prior releases of AIX. The default format is v1.-o efs={yes|no}— Specifies encryption. Specifying yes enables encryption for the JFS2 file system. • If the efs attribute is set to yes, the mkfs command automatically creates the JFS2 file system with the extended attribute format set to v2. The ea attribute is not required. • If the efs attribute is set to no, the mkfs command creates a file system that is not encrypted.-o vix={yes|no}— Specifies whether the file system can allocate i-node extents smaller than the default of 16 KB, if there are no contiguous 16 KB extents free in the file system. After a file system is enabled for small free extents, the file system cannot be accessed on AIX 5.1 or earlier releases. yes The file system can allocate variable-length i-node extents. This is the default value beginning with AIX 6.1. no The file system must use the default size of 16 KB for i-node extents. This has no effect if the file system already contains variable-length i-node extents.-o maxext=Value— Specifies the maximum size of a file extent in file system blocks. A zero value implies that the JFS2 default maximum should be used. Values less than 0 or exceeding maximum supported extent size of 16777215 are invalid.- Note: The agblksize attribute is set at file system creation and cannot be changed after the file system is
successfully created.
The ea attribute format is set at file system creation. The chfs command can be used to convert the extended attribute format from v1 to v2, but the format cannot be converted back. The conversion is done in an on-demand manner such that any extended attribute or ACL writes cause the conversion for that file object to occur.
-pPrototype — Specifies the name of the prototype file when you create a JFS file system. Options specified on the command line override attributes in the prototype file.-sSize — Specifies the size of the file system. Size can be specified in units of 512-byte blocks, megabytes (suffix M must be used) or gigabytes (suffix G must be used). See JFS and JFS2 for more information.Notes:
The volume group in which the file system resides defines a maximum logical volume size and also limits the file system size.
The
-sSize flag specifies the minimum file size and cannot be decreased after the file system has been successfully created.The maxext attribute is ignored in older releases even if the filesystem was created with it on a later release .
-vVolumeLabel — Specifies the volume label for the new file system.-VVfsName — Specifies the virtual file system (VFS) type. The VFS must have an entry in the /etc/vfs file.Restriction: The mkfs command prevents EFS File System enablement of the following File Systems
(mount points) because the security infrastructure (kernel extensions, libraries, and so on) are not available when you start the system. The following list is of known File Systems (mount points) that you cannot use:
"/" "/usr" "/var" "/opt"
보안
접근 제어: root나 system 그룹 구성원만 실행할 수 있습니다.
(6.1) RBAC와 Trusted AIX 사용자: 이 명령은 특권 작업을 할 수 있으며 특권 사용자만 할 수 있습니다. 권한과 특권은 lssecattr 명령이나 getcmdattr 하위 명령으로 봅니다.
영어 원문
Access Control: Only the root user or a member of the system group can run this command.
Attention RBAC users and Trusted AIX users: This command can perform privileged operations. Only privileged users can run privileged operations. For more information about authorizations and privileges, see Privileged Command Database in Security. For a list of privileges and the authorizations associated with this command, see the lssecattr command or the getcmdattr subcommand.
예제
| 명령 | 하는 일 |
|---|---|
mkfs -lworks -vvol001 /dev/hd3 |
/dev/hd3 전체에 빈 파일 시스템을 만들고 볼륨 일련번호 vol001, 파일 시스템 이름 works를 줌. 조각 크기와 nbpi는 기본값(4096) |
mkfs -s 8192 -o nbpi=2048,frag=512 /dev/lv01 |
조각 512바이트, 2048바이트당 inode 하나인 4MB 파일 시스템 |
mkfs -V jfs -o nbpi=131072,bf=true,ag=64 /dev/lv01 |
할당 그룹 64MB, 131072바이트당 inode 하나인 큰 파일용 JFS. 크기는 lv01 전체 |
mkfs -s 4M -o nbpi=2048,frag=512 /dev/lv01 |
예 2와 같은 것을 MB 단위로 |
mkfs -V jfs2 -o ea=v2 /dev/lv01 |
NFS4 ACL을 쓸 수 있는(확장 속성 v2) JFS2 |
영어 원문
- To specify the volume and file system name for a new file system, type:
mkfs -lworks -vvol001 /dev/hd3
This command creates an empty file system on the /dev/hd3 device, giving it the volume serial number vol001 and file system name works. The new file system occupies the entire device. The file system has a default fragment size (4096 bytes) and a default nbpi ratio (4096).
- To create a file system with nondefault attributes, type:
mkfs -s 8192 -o nbpi=2048,frag=512 /dev/lv01
This command creates an empty 4 MB file system on the /dev/lv01 device with 512-byte fragments and 1 i-node for each 2048 bytes.
- To create a large file enabled file system, type:
mkfs -V jfs -o nbpi=131072,bf=true,ag=64 /dev/lv01
This creates a large file enabled JFS file system with an allocation group size of 64 megabytes and 1 i-node for every 131072 bytes of disk. The size of the file system will be the size of the logical volume lv01.
- To create a file system with nondefault attributes, type:
mkfs -s 4M -o nbpi=2048, frag=512 /dev/lv01
This command creates an empty 4 MB file system on the /dev/lv01 device with 512-byte fragments and one i-node for each 2048 bytes.
- To create a JFS2 file system which can support NFS4 ACLs, type:
mkfs -V jfs2 -o ea=v2 /dev/lv01
This command creates an empty file system on the /dev/lv01 device with v2 format for extended attributes.
파일
| 파일 | 설명 |
|---|---|
/etc/vfs |
가상 파일 시스템 유형 설명 |
/etc/filesystems |
알려진 파일 시스템과 그 특성 |
영어 원문
- /etc/vfs — Contains descriptions of virtual file system types.
- /etc/filesystems — Lists the known file systems and defines their characteristics.
Related reference:
- mkproto Command
Related information:
- fsck command
- filsys.h command
- Understanding JFS Size Limitations
리눅스(GNU)와 다른 점
리눅스에서는 파일 시스템 정보가 /etc/fstab에 있고(AIX는 스탠자 형식의 /etc/filesystems), LVM과 파일 시스템 명령이 나뉘어 있습니다. 만들기는 lvcreate 뒤 mkfs.xfs·mkfs.ext4, 늘리기는 lvextend -r(또는 lvextend 뒤 xfs_growfs·resize2fs), 지우기는 umount 뒤 /etc/fstab 항목과 lvremove로 따로 합니다. AIX의 crfs·chfs·rmfs는 이것을 한 명령으로 합니다. 리눅스 mkfs는 mkfs.xfs, mkfs.ext4 같은 유형별 도구의 앞단이며(mkfs -t xfs /dev/vg/lv), 만든 뒤 /etc/fstab에 직접 넣어야 합니다.