aboutsummaryrefslogtreecommitdiffstats
path: root/design/XFS_Filesystem_Structure/magic.asciidoc
blob: f9e32df4f9f88227f2445abdf0a9e920e5e56649 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
= Magic Numbers

These are the magic numbers that are known to XFS, along with links to the
relevant chapters.  Magic numbers tend to have consistent locations:

* 32-bit magic numbers are always at offset zero in the block.
* 16-bit magic numbers for the directory and attribute B+tree are at offset eight.
* The quota magic number is at offset zero.
* The inode magic is at the beginning of each inode.

[options="header"]
|=====
| Flag				| Hexadecimal	| ASCII	| Data structure
| +XFS_SB_MAGIC+		| 0x58465342	| XFSB	| xref:Superblocks[Superblock]
| +XFS_AGF_MAGIC+		| 0x58414746	| XAGF	| xref:AG_Free_Space_Block[Free Space]
| +XFS_AGI_MAGIC+		| 0x58414749	| XAGI	| xref:Inode_Information[Inode Information]
| +XFS_AGFL_MAGIC+		| 0x5841464c	| XAFL	| xref:AG_Free_List[Free Space List], v5 only
| +XFS_DINODE_MAGIC+		| 0x494e	| IN	| xref:Inode_Core[Inodes]
| +XFS_DQUOT_MAGIC+		| 0x4451	| DQ	| xref:Quota_Inodes[Quota Inodes]
| +XFS_SYMLINK_MAGIC+		| 0x58534c4d	| XSLM	| xref:Extent_Symbolic_Links[Symbolic Links]
| +XFS_ABTB_MAGIC+		| 0x41425442	| ABTB	| xref:AG_Free_Space_Btrees[Free Space by Block B+tree]
| +XFS_ABTB_CRC_MAGIC+		| 0x41423342	| AB3B	| xref:AG_Free_Space_Btrees[Free Space by Block B+tree], v5 only
| +XFS_ABTC_MAGIC+		| 0x41425443	| ABTC	| xref:AG_Free_Space_Btrees[Free Space by Size B+tree]
| +XFS_ABTC_CRC_MAGIC+		| 0x41423343	| AB3C	| xref:AG_Free_Space_Btrees[Free Space by Size B+tree], v5 only
| +XFS_IBT_MAGIC+		| 0x49414254	| IABT	| xref:Inode_Btrees[Inode B+tree]
| +XFS_IBT_CRC_MAGIC+		| 0x49414233	| IAB3	| xref:Inode_Btrees[Inode B+tree], v5 only
| +XFS_FIBT_MAGIC+		| 0x46494254	| FIBT	| xref:Inode_Btrees[Free Inode B+tree]
| +XFS_FIBT_CRC_MAGIC+		| 0x46494233	| FIB3	| xref:Inode_Btrees[Free Inode B+tree], v5 only
| +XFS_BMAP_MAGIC+		| 0x424d4150	| BMAP	| xref:Btree_Extent_List[B+Tree Extent List]
| +XFS_BMAP_CRC_MAGIC+		| 0x424d4133	| BMA3	| xref:Btree_Extent_List[B+Tree Extent List], v5 only
| +XLOG_HEADER_MAGIC_NUM+	| 0xfeedbabe	|     	| xref:Log_Records[Log Records]
| +XFS_DA_NODE_MAGIC+		| 0xfebe	|     	| xref:Directory_Attribute_Internal_Node[Directory/Attribute Node]
| +XFS_DA3_NODE_MAGIC+		| 0x3ebe	|     	| xref:Directory_Attribute_Internal_Node[Directory/Attribute Node], v5 only
| +XFS_DIR2_BLOCK_MAGIC+	| 0x58443242	| XD2B	| xref:Block_Directories[Block Directory Data]
| +XFS_DIR3_BLOCK_MAGIC+	| 0x58444233	| XDB3	| xref:Block_Directories[Block Directory Data], v5 only
| +XFS_DIR2_DATA_MAGIC+		| 0x58443244	| XD2D	| xref:Leaf_Directories[Leaf Directory Data]
| +XFS_DIR3_DATA_MAGIC+		| 0x58444433	| XDD3	| xref:Leaf_Directories[Leaf Directory Data], v5 only
| +XFS_DIR2_LEAF1_MAGIC+	| 0xd2f1	|     	| xref:Leaf_Directories[Leaf Directory]
| +XFS_DIR3_LEAF1_MAGIC+	| 0x3df1	|     	| xref:Leaf_Directories[Leaf Directory], v5 only
| +XFS_DIR2_LEAFN_MAGIC+	| 0xd2ff	|     	| xref:Node_Directories[Node Directory]
| +XFS_DIR3_LEAFN_MAGIC+	| 0x3dff	|     	| xref:Node_Directories[Node Directory], v5 only
| +XFS_DIR2_FREE_MAGIC+		| 0x58443246	| XD2F	| xref:Node_Directories[Node Directory Free Space]
| +XFS_DIR3_FREE_MAGIC+		| 0x58444633	| XDF3	| xref:Node_Directories[Node Directory Free Space], v5 only
| +XFS_ATTR_LEAF_MAGIC+		| 0xfbee	|     	| xref:Leaf_Attributes[Leaf Attribute]
| +XFS_ATTR3_LEAF_MAGIC+	| 0x3bee	|     	| xref:Leaf_Attributes[Leaf Attribute], v5 only
| +XFS_ATTR3_RMT_MAGIC+		| 0x5841524d	| XARM	| xref:Remote_Values[Remote Attribute Value], v5 only
| +XFS_RMAP_CRC_MAGIC+		| 0x524d4233	| RMB3	| xref:Reverse_Mapping_Btree[Reverse Mapping B+tree], v5 only
| +XFS_RTBITMAP_MAGIC+		| 0x424D505A	| BMPZ	| xref:Real-Time_Bitmap_Inode[Real-Time Bitmap], metadir only
| +XFS_RTSUMMARY_MAGIC+		| 0x53554D59	| SUMY	| xref:Real-Time_Summary_Inode[Real-Time Summary], metadir only
| +XFS_RTRMAP_CRC_MAGIC+	| 0x4d415052	| MAPR	| xref:Real_time_Reverse_Mapping_Btree[Real-Time Reverse Mapping B+tree], v5 only
| +XFS_REFC_CRC_MAGIC+		| 0x52334643	| R3FC	| xref:Reference_Count_Btree[Reference Count B+tree], v5 only
| +XFS_MD_MAGIC+		| 0x5846534d	| XFSM	| xref:Metadata_Dumps[Metadata Dumps]
| +XFS_RTSB_MAGIC+		| 0x46726F67	| Frog	| xref:Realtime_Groups[Realtime Groups]
| +XFS_RTREFC_CRC_MAGIC+	| 0x52434e54	| RCNT	| xref:Real_time_Refcount_Btree[Real-Time Reference Count B+tree], v5 only
|=====

The magic numbers for log items are at offset zero in each log item, but items
are not aligned to blocks.

[options="header"]
|=====
| Flag				| Hexadecimal	| ASCII	| Data structure
| +XFS_TRANS_HEADER_MAGIC+	| 0x5452414e	| TRAN	| xref:Log_Transaction_Headers[Log Transactions]
| +XFS_LI_EFI+			| 0x1236        |       | xref:EFI_Log_Item[Extent Freeing Intent Log Item]
| +XFS_LI_EFD+			| 0x1237        |       | xref:EFD_Log_Item[Extent Freeing Done Log Item]
| +XFS_LI_IUNLINK+		| 0x1238        |       |  Unknown?
| +XFS_LI_INODE+		| 0x123b        |       | xref:Inode_Log_Item[Inode Updates Log Item]
| +XFS_LI_BUF+			| 0x123c        |       | xref:Buffer_Log_Item[Buffer Writes Log Item]
| +XFS_LI_DQUOT+		| 0x123d        |       | xref:Quota_Update_Log_Item[Update Quota Log Item]
| +XFS_LI_QUOTAOFF+		| 0x123e        |       | xref:Quota_Off_Log_Item[Quota Off Log Item]
| +XFS_LI_ICREATE+		| 0x123f        |       | xref:Inode_Create_Log_Item[Inode Creation Log Item]
| +XFS_LI_RUI+			| 0x1240        |       | xref:RUI_Log_Item[Reverse Mapping Update Intent]
| +XFS_LI_RUD+			| 0x1241        |       | xref:RUD_Log_Item[Reverse Mapping Update Done]
| +XFS_LI_CUI+			| 0x1242        |       | xref:CUI_Log_Item[Reference Count Update Intent]
| +XFS_LI_CUD+			| 0x1243        |       | xref:CUD_Log_Item[Reference Count Update Done]
| +XFS_LI_BUI+			| 0x1244        |       | xref:BUI_Log_Item[File Block Mapping Update Intent]
| +XFS_LI_BUD+			| 0x1245        |       | xref:BUD_Log_Item[File Block Mapping Update Done]
| +XFS_LI_ATTRI+		| 0x1246        |       | xref:ATTRI_Log_Item[Extended Attribute Update Intent]
| +XFS_LI_ATTRD+		| 0x1247        |       | xref:ATTRD_Log_Item[Extended Attribute Update Done]
| +XFS_LI_XMI+			| 0x1248        |       | xref:XMI_Log_Item[File Mapping Exchange Intent]
| +XFS_LI_XMD+			| 0x1249        |       | xref:XMD_Log_Item[File Mapping Exchange Done]
| +XFS_LI_EFI_RT+		| 0x124a        |       | xref:EFI_Log_Item[Extent Freeing Intent Log Item]
| +XFS_LI_EFD_RT+		| 0x124b        |       | xref:EFD_Log_Item[Extent Freeing Done Log Item]
| +XFS_LI_RUI_RT+		| 0x124c        |       | xref:RUI_Log_Item[Reverse Mapping Update Intent]
| +XFS_LI_RUD_RT+		| 0x124d        |       | xref:RUD_Log_Item[Reverse Mapping Update Done]
| +XFS_LI_CUI_RT+		| 0x124e        |       | xref:CUI_Log_Item[Reference Count Update Intent]
| +XFS_LI_CUD_RT+		| 0x124f        |       | xref:CUD_Log_Item[Reference Count Update Done]
|=====

= Theoretical Limits

XFS can create really big filesystems!

[options="header"]
|=====
| Item			| 1KiB blocks | 4KiB blocks | 64KiB blocks
| Blocks		| 2^52^ | 2^52^ | 2^52^
| Inodes		| 2^63^ | 2^63^ | 2^64^
| Allocation Groups	| 2^32^ | 2^32^ | 2^32^
| File System Size	| 8EiB  | 8EiB | 8EiB
| Blocks per AG		| 2^31^ | 2^31^ | 2^31^
| Inodes per AG		| 2^32^ | 2^32^ | 2^32^
| Max AG Size		| 2TiB  | 8TiB  | 128TiB
| Blocks Per File	| 2^54^ | 2^54^ | 2^54^
| File Size		| 8EiB  | 8EiB | 8EiB
| Max Dir Size          | 32GiB | 32GiB | 32GiB
|=====

Linux doesn't support files or devices larger than 8EiB, so the block
limitations are largely ignorable.