Wince File systems File system on embedded File
Wince File systems
File system on embedded • File system choice on embedded is important – File system size can be an issue – Different media are used – i. e. Flash – May not have users – May need special security – i. e. encryption – Requirements are likely to change
Microsoft file systems • Generally Microsoft systems have 4 file system choices – CDFS • For cd roms – UDF • For dvds – FAT 12, FAT 16 and FAT 32 – NTFS
Parts of a FAT 32 Volume 1. Boot Sector - first sector of partition contains file system info, pointers to other sections and boot loader code 2. FAT - two copies of File Allocation Table – show clusters (blocks) allocation 3. Root Folder - The root folder contains an entry for each file and folder at the root 4. Data - file and directory data
FAT • File Allocation Table contains entry for each cluster on the disk • FAT 12, FAT 16, and FAT 32 - refer to the number of bits used for the cluster entries in the table • Number of entries in FAT is limited by number of bits used for describing the location of a cluster - FAT 16 can only hold < 216 or 65, 526 cluster entries
The File Allocation Table • Entry for each cluster on the partition – contains the: – address of the next cluster in chain – end of file (EOF) character that indicates the end of a chain (0 x. FFFF) – character to mark bad cluster (0 x. FFF 7) – character to mark reserved cluster – zero to note the cluster is unused • FAT 16 - 16 bits/FAT 32 - 32 bits (28 Bits)
File Allocation Table one entry for each cluster
Slack • Fixed number of clusters available • Cluster size increased in order to fill the available space as disks get bigger • FAT 32 uses 16 KB clusters for 16 -32 GB disks • 20 KB file uses two 16 KB clusters - 32 KB of space – 12 K of slack • 1 KB file uses 16 KB – 15 K of slack
Folder Entry • Set of 32 -byte Folder Entries for each file and subfolder in the folder – Name (eight-plus-three characters) – Attribute byte (8 bits/archive, directory, hidden, read-only, system and volume) – Create time (24 bits)/date (16 bits) – Last access date (16 bits) – Last modified time (16 bits)/date (16 bits) – Starting cluster in the FAT (16 bits) – File size (32 bits)
Creating a File • No organization to FAT folder structure • Files are given the first available location on the volume • Starting cluster number is the address of the first cluster used by the file • Each cluster contains a pointer to the next cluster in the file, or an indication (0 x. FFFF) that this cluster is the end of the file
File Allocation Table Figure 4 -2 Example of File Allocation Table
Windows NTFS • Hierarchical file system (similar to UNIX) • Hard and symbolic links are supported • Highly complex and sophisticated FS – Uses B+ trees – Has ACLs – Can encrypt • Different from FAT file systems 12/17/2021 12
Fundamental Concepts • NFTS file – not just a linear sequence of bytes – File – consists of multiple streams – Multiple attributes, each represented by a stream of bytes – Each stream has its own name foo: stream 1; – Idea of multiple streams in a file – Apple Macintosh • Used to allow Windows machines to read Apple files 12/17/2021 13
Principal Win 32 APIs for File I/O 12/17/2021 14
Open File Issues • • • To create and open a file, one must use Create. File There is no File. Open API Create. File system call has 7 parameters 1. Pointer to the name of the file to create or open 2. Flags telling whether the file can be read, written, or both 3. Flags telling whether multiple processes can open the file at once 4. A pointer to the security descriptor 5. Flags telling what to do if the file exists/does not exist 6. Flags dealing with attributes such as archiving, compression, ; 7. Handle of a file whose attributes should be cloned for the new file • Example: – Inhandle=Create. File(“data”, 12/17/2021 GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL) 15
NFTS Structure • NTFS is divided into volumes (aka partitions) • Each NTFS includes files, directories, other data structures • Each volume is organized as a linear sequence of blocks (block size between 512 and 4 KB) • Main data structure in each volume is Master File Table (MFT) • Bitmap keeps track which MFT entries are free 12/17/2021 16
MFT for NTFS Organization • Boot-block has information about the first block of MFT 12/17/2021 17
MFT Record (Example for 3 -Run, 9 -Block File) 12/17/2021 18
Space • NTFS supports disk quotas & file compression • NTFS handles space management for partitions > 8 G more efficiently than FAT 32 - smaller cluster sizes and less disk space waste than FAT 32 • FAT 32 maximum partition size is 32 GB • NTFS maximum partition size is 16 TB
Reliability • FAT 32 more susceptible to disk errors • NTFS has ability to recover from errors better than similar FAT 32 volumes • Log files are created under NTFS - can be used for automatic file system repair • NTFS supports dynamic cluster remapping for bad sectors and prevent them from being used in the future
Security • FAT 32 - user with access to a drive using FAT 32 has access to the files on that drive • NTFS allows NTFS Permissions - folder and file access can be controlled individually chance for error is greatly magnified • Windows XP Professional supports file encryption
- Slides: 21