File-system basics

Hard drive arrangement.
Linux File-system partition. Three parts.
  • Super-block - overall configuration of partition
  • Inode table - table for tracking available and used file storage.
  • File block - free and available blocks for storing file data. Originally, once super-block and inode table created, their sizes fixed. Inode table was a single structure immediately following sunblock, with a backup located elsewhere on partition. Current system divides partition up into smaller regions and create a separate inode table for each. Current systems reserve space in Superblock to allow additional inode tables to be created if the current tables are full and there is still space on partition.
    Superblock. - describes overall configuration of partition. Contains information such as : File-system type. Features - journalling, special file-types, etc. Size of blocks on partition. Number of blocks on partition. Number of free blocks. Number of inodes on partition. Number of free inodes. Creation date. Last mount date. Grouping info. Location(index) of 1st usable inode (usually root's) * The following has to be run as an admin. dumpe2fs -h /dev/sda7 > sb.txt Superblock listing
    Inode table. Inode contents Device ID Inode ID File type File mode - permissions. Link count - number of names. UID - owner's ID GID - group ID Device # - for block and character, special interfaces. File size - bytes Optimal block size for I/O Block count - 512 byte/block. May be different, 4KiB, on newer drives. Time last accessed. Time last modified. Time last status change - inode info changed. * time recorded down to nS. Pointers to drive blocks holding data. For overview of filesystem, try : stat -f /home/hopper
    Inode file pointes Block size on Linux is usually 4K. Maximum file size is 4GB. Inodes are of fixed size. So, how does Linux track file's data. * Assume a pointer is 32 bit. 1st 10 pointers in inode point directly to file's data blocks. (10 pointers for total of 40 bytes in inode) 11th pointer points to a block on the hard drive (indirect) This block is contains a set of points to the file's data blocks. (4 bytes in inode and 1K pointers in drive block) 12th pointer points to a block on the hard drive (double indirect) This block is contains a set of points to another set of blocks on drive. These blocks then are set to point to file's data blocks. (4 bytes in inode + 1K pointer * 1K pointers) Max file size (4 K block) 2^2 * 2^10 * 2^10 2^10 * = 2^32 or 4GiB 13th pointer points to a block on the hard drive (triple indirect) This block is contains a set of points to another set of blocks on drive. These, in turn, contain a set of points to another set of blocks on drive. These blocks then are set to point to file's data blocks. (4 bytes in inode + 1K pointer * 1K pointers * 1K pointer) 1K pointer * 1K pointers * 1K pointer = 2^30 pointers Max file size (4 K block) 2^2 * 2^10 * 2^10 2^10 2^10 * = 2^42 or 4TiB Check out : https://digital-forensics.sans.org/blog/2008/12/24/understanding-indirect-blocks-in-unix-file-systems
    quota -v Run it on hopper to check your account quota. Log directly into babbage and run it there to check web-page usage. stat filename