Product SiteDocumentation Site

4.2.2. Exercise 2 - ondisk form of the EA (ACL)

We will now see how this ACL and other EAs look in terms of the on disk structure using xfs_db.
  1. Obtain the inode number for the file
    # ls -i file1
    # umount $SCRATCH_MNT
    
  2. Use xfs_db to look at what is on the disk to see:
    • Data format is extents (core.format = 2)
    • Offset between data and EA fork = 15 * 8 = 120 bytes
    • EA format is extents (core.aformat = 2)
    # xfs_db -r $SCRATCH_DEV
    xfs_db> inode inode_number
    xfs_db> print
    ...
    core.format = 2 (extents)
    core.forkoff = 15
    core.aformat = 2 (extents)
    u.bmx[0] = [startoff,startblock,blockcount,extentflag] 0:[0,13,1,0]
    a.bmx[0] = [startoff,startblock,blockcount,extentflag] 0:[0,12,1,0]
    xfs_db> ablock 0
    xfs_db> p
    ....stuff omitted...
    nvlist[0].valuelen = 52
    nvlist[0].namelen = 12
    nvlist[0].name = "SGI_ACL_FILE"
    nvlist[0].value = "\000\000\000\004\000\000\000\001\377\377\377\377\000\006\000\000\000\000\000\004\377\377\377\377\000\006\000\000\000\000\000\020\377\377\377\377\000\a\000\000\000\000\000 \377\377\377\377\000\004\000\000"
    
  3. Alternatively specifying the filesystem block directly using the FSB listed in the a.bmx list::
    xfs_db> fsb 12
    xfs_db> type attr
    xfs_db> p
    
    Look at the file data while we are here:
    xfs_db> dblock 0
    xfs_db> p
    000: 64617461 310a0000 00000000 00000000 00000000 00000000 00000000 00000000
    ...etc...
    xfs_db> type text
    xfs_db> p
    000:  64 61 74 61 31 0a 00 00 00 00 00 00 00 00 00 00  data1...........
    010:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    
    i.e. the file1 data is "data1" just like we echo'ed in at the beginning.
    So in this example with 1 data extent for its contents, the ACL EA was also in extent format. However, EAs can often fit inside the inode in what is called "shortform" format. However, in this case, the EA space starts from the fork offset in the inode:
    core.forkoff = 15
    
    which is 15 * 8 = 120 bytes into the llteral space of the inode (which is the area after the core part of the inode). With the 51 bytes value and 12 byte name and the rest of the EA header, there was not enough room for the EA to be inside the inode.