FAT1
FAT1
FAT1
Sectors
The sector is minimum data storage unit
A sector is usually 512 bytes A sector is the minimum size read from, or written to, a disk A sector is the minimum I/O unit This is a HW thing
Clusters
Files are allocated space in clusters
A cluster is a fixed number of sectors
Must be a power of 2 (1,2,,64,)
Slack
Slack is the space allocated to a file, but unused
Space at the end of a sector that remains unused by the file Sectors allocated to the file that the file hasnt yet used
Unallocated Clusters
When a file is deleted its allocated clusters become unallocated Many clusters on a modern hard drive are unallocated Unallocated clusters may have been allocated earlier though
These clusters retain their data until they are reallocated to a new file Deleted files are still recoverable!
Partitions Review
The drive is partitioned Each extended partition has its own partition table Each non-extended partition is referred to as a volume Each volume has a volume boot record or a boot sector Recovery tools can often find data even if the disk was repartioned
Sectors ending in 0x55AA
DOS Disk
Partition 1
Partition 2
FAT Partition
Starting LBA from partition table Reserved Area FAT Area Directories and Files
VBR
Measured in Clusters
FAT12/16 Reserved area is one sector, the Boot Sector or Volume Boot Record FAT32 Reserved area contains many sectors, VBR, FSINFO sector and a backup VBR
VBR Layout
02 3 10 11 12 13 13 14 15 16 16 17 18 19 20 21 21 22 23 24 27 28 31 32 35 Assembly instruction to jump to boot code OEM in ASCII Bytes/sector (512, 1024, 2048, 4096) Sectors/cluster n where n <= 32K and is a power of 2 Size in sectors of reserved area Number of FATs Maximum number of files in root dir. FAT16 typically 512, 0 for FAT32 Number of sectors in file system. If not big enough set to 0, a 4 byter is coming soon Media type: MS states 0xf8 for fixed disks and 0xf0 for removable 16-bit size in sectors for each FAT in FAT12/16 0 for FAT32 Number of sectors/track and heads Number of sectors before start of partition Number of sectors in the file system Essential if a boot partition No Yes Yes Yes Yes Yes Yes No Yes No No Yes
No Yes No No No No No
No
Reference
http://www.dewassoc.com/kbase/hard_drives/boot_sector.htm
FAT32 FSINFO
03 4 483 484 487 488 491 492 495 496 507 508 511 Signature 0x41615252. Not Used Signature 0x61417272 Number of free clusters Next free cluster Not used Signature 0xAA550000 No No No No No No No
Start of Data
Cluster address of start of data is 2
Microsoft mandated no Cluster 0 or 1 addresses
Data Area
Root Directory Reserved Area FAT Area Directories and Files
Data Area
FAT Directories
00 1 10 11 11 12 12 13 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 31 First character of file name in ASCII. 0x5e or 0x00 if unallocated Characters 2 11 of file name in ASCII. File attributes Reserved Create time (tenths of second) Create time ( hours, minutes, seconds) Create day Access day High 2 bytes of first cluster address (0 for FAT12/16) Write time (( hours, minutes, seconds) Write day Low 2 bytes of first cluster address from start of data area Size of file (0 for directories) in bytes Yes Yes Yes No No No No No Yes No No Yes Yes
File Attributes
Flag Value 0000 0001 = 0x01 0000 0010 = 0x02 0000 0100 = 0x04 0000 1000 = 0x08 0000 1111 = 0x0f 0001 0000 = 0x10 0010 0000 = 0x20
Description Read only Hidden file System file Volume label Long file name Directory Archive
FAT Directories
00 1 10 11 11 12 12 13 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 31 First character of file name in ASCII. 0x5e or 0x00 if unallocated Characters 2 11 of file name in ASCII. File attributes Reserved Create time (tenths of second) Create time ( hours, minutes, seconds) Create day Access day High 2 bytes of first cluster address (0 for FAT12/16) Write time (( hours, minutes, seconds) Write day Low 2 bytes of first cluster address from start of data area Size of file (0 for directories) in bytes Yes Yes Yes No No No No No Yes No No Yes Yes
15 14 13 12 11 10
0x53 0 1 0 1 0 0
4
0xf6
Data hex
Data binary
Hour
Minute
Second
= = = =
FAT Directories
00 1 10 11 11 12 12 13 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 31 First character of file name in ASCII. 0x5e or 0x00 if unallocated Characters 2 11 of file name in ASCII. File attributes Reserved Create time (tenths of second) Create time ( hours, minutes, seconds) Create day Access day High 2 bytes of first cluster address (0 for FAT12/16) Write time (( hours, minutes, seconds) Write day Low 2 bytes of first cluster address from start of data area Size of file (0 for directories) in bytes Yes Yes Yes No No No No No Yes No No Yes Yes
15 14 13 12 11 10
0x32 0 0 1 1 0 0
4
0x81
Data hex
Data binary
0 Day
Month
Year = 00110012 = 0x19 = 25 (+ 1980) = 2005 Month = 01002 = 0x04 = April Day = 000012 = 0x01 = 1
1 10 11 11 12 12 13 13 14 25 26 27 28 31
http://www.ntfs.com/fat-filenames.htm
1. Read Fat Boot Sector (sector 0 of the volume) to understand structure and location of Reserved, FAT, and Data areas 2. Locate file1.txt in the Root Directory to determine its starting cluster 3. Set FAT entries for file1.txt to 0 4. Change filename to ile1.txt in root directory
Set first character to 0xE5 or 0x00
FAT
0 0 F 2 2 F D E F
02D
02E
Directory
First cluster used by file
O2C 02C
0 0 0 0 0 0 0 0 0
02D
02E
Get the first cluster from the directory entry Get size from directory entry Calculate the number of clusters allocated to the file, n.
Option 1 Grab the next n-1 consecutive clusters. Call it the file. May have allocated or unallocated clusters from other files. WinHex uses this option. Option 2 Grab the next n-1 unallocated clusters using the FAT. Call it the file. May have unallocated clusters from other deleted files. EnCase uses this option.