File Systems and File Management
What are files? Where are they?
2006-08-31 - RAMontante 1 What are "files"?
• People save information they care about in (or on) their computers - documents - long-term storage • Computers keep documents in files • Other things kept in files: - executable programs - "data files“
• A file system is the scheme used by the Operating System to organize the files
2 Files on Disks
• Files are kept on "Disk Drives" - Fixed (hard) disks -- high-capacity devices built into the computer - Removable devices: floppies, CDs & DVDs, "flash" memory, USB drives • Disk Drive names: one letter followed by a colon - Any diskettes (floppy disks) are called A: , B: - Hard disk is always C: - CD-ROM drives, network drives, USB drives, tape drives, etc. are called D:, E:, F: ...
3 Examine the disks:
• Start “My Computer” • Look at disk properties - Right-click a disk, choose “Properties” -
• (Minimize Explorer)
4 Disk Formats
• A disk's recording surface is marked to identify file positions • Concentric tracks are divided into sectors - 100’s – 1000’s of tracks (a.k.a. cylinders) - 63 sectors/track • Different filesystems use different marking patterns, or formats - Hard disks are preformatted – should not change • CDs are formatted at recording time
5 Disk Formatting
• Formatting is the process of adding file-locator marks to the disk surface • Windows allows most disks to be formatted with an appropriate file system • Reformatting destroys any previous file information
6 The XP formatting dialog, on a Flash drive
(animation)
7 The XP formatting dialog, on a Flash “drive”
• In the middle image, a new volume label has been entered for this device.
8 Flash Drives
• Flash drives don’t have a rotating disk - They are “solid-state” • The operating system (Windows, etc.) expects them to act like disk drives • Circuitry provides a file system that acts like tracks and sectors - FAT file system is commonly used on Flash drives
9 FYI: Flash drive internals
1 - USB connector 2 - USB mass storage controller device 3 - Test points 4 - Flash memory chip 5 - Crystal oscillator 6 - LED 7 - Write-protect switch 8 - Space for second flash memory chip
10 Try formatting?
• Start “My Computer” • Try the "Format…" menu • Minimize Explorer
11 They hold documents, programs, data – anything that is stored on the computer… …but what are they? …how are they organized?
What Are Files?
12 Files
• A file is a collection of "bytes" that hold values - one byte per character… AA aa BB bb CC cc ?? 88 - four bytes (usually) per number… --6102861028 - ??? bytes per machine instruction addadd XX,, YY 13 Kinds of Files
• Text files hold letters, punctuation, digits Oh say can you see my - "human-readable" information eyes --- if you can then my hair's too short. • Binary files hold numeric data, 8987 234765 instructions 4 98798686 - "machine-readable" information - binary files can include text as well
• File name – a human-readable identifier for each file on the disk
14 Organizing the Files
• Tens of thousands of files on a single drive - Files can be stored anywhere within the drive
• Each drive needs a directory to match file names with file locations • Directories contain additional information about the files • size • time of modification • ownership • etc.
15 Disk Directories
• Each disk has a master directory called the root directory and written “\” - Floppy-disk roots are A:\, B:\ - Hard disk’s root is known as C:\ - ( \ is the backslash character) - Additional devices, D:, E:, etc., each have their own root directory • Disks can also have volume labels (“names”) that refer to the entire disk
16 Directory Hierarchy or "tree"
• The root directory is at the top of the hierarchy (or "root" of the tree) • Directories contain - (the names of) files - (the names of) subdirectories
• Subdirectories contain - (the names of) files - (the names of) sub-subdirectories…
17 Folders (Directories)
• MS-Windows represents directories as folders
• Folders also contain "directory-like" things - Windows Desktop - “My Computer” - Control Panel - Printer control panel
• Folders can be shown as a Start Button, as Desktop icons, and in other ways
18 XP’s view of the hierarchy
• Windows Explorer – left-hand side - (this window has been customized – the default display is arranged slightly differently)
19 Make a folder; make a file:
• Restore Windows Explorer • Examine the Folders hierarchy on the left - If necessary, click the “Folders” button to make it visible • Make P:\ the current folder • Create a new Folder on the P: drive - Name it 56-110 - Properties? • Create a new file - Properties: how big is it? Where is it? • Move the new file into the folder 20 File Names
• Most files have a two-part name: - the "document name" - e.g., “assignment #1” - the extension - “.txt” - The extension is optional, but most applications create, and expect one. • In MS-Windows: the file extension indicates the type of contents of the file - text, program, picture, etc. • The extension can lie - some computer worms and viruses use a fake extension to fool the operating system.
21 Filename Extensions
• Files are associated with applications according to the file's extension -examples: .html, .htm : web page .jpg: picture .doc, .docx : MS-Word .py : Python program .txt : Notepad .exe: an application -Applications choose their own extension. -Extension names can be changed/overridden. ¾The extension can be hidden from view. -Windows Explorer defaults to hiding things.
22 File Name Rules – the NTFS filesystem
• Maximum name length (including extension) is 260 characters • File names cannot contain the following characters: * : " / ? < > \ | - These characters have special meanings, such as the : for drive letters
• Names containing spaces should be enclosed in "quotes" (which aren’t part of the name) • Upper/lowercase letters are preserved, but treated as the same letter
23 File Name Rules – MS-DOS / FAT
• MS-DOS used the File-Allocation-Table filesystem - FAT is more limited than NTFS • DOS limited names to "8.3" format - No more than 8 letters in the name, and 3 in the extension - All letters are converted to UPPERCASE - Not allowed in a name: " . / \ [ ] : + | < > = ; , * ? » These have special meanings in the command line - Spaces also forbidden
• NTFS names are “backwards compatible” with DOS - Current FAT version partially supports long filenames (“LFN”)
24 “8.3” names and “LFN” names
• Command prompt: “DIR” shows Long File Names. • “DIR /X” shows LFN names along with converted 8.3 names.
25 8.3 names can be disabled…
• BloomU has disabled the 8.3 names in labs. • 8.3 names can be seen on personal computers - …or managed with the “fsutil” command – this is an advanced technique!
26 Rules for File Names – other Filesystems
• MacOS, Linux "ext3" filesystem, others - Support "all" characters, including those NTFS doesn’t use - Respect the case » "Abcd", "ABCD", "abcd" can be 3 separate files
• CD-R – CDFS filesystem - ISO9660 – 32 characters per name - Joliet – 64 characters per name - Rock Ridge – more info stored
• "Red Book" – a format for audio CDs - Tracks / ”files” don’t actually have names
27 File-like Directory Entries – Links
• Also called a "shortcut" - is a fake entry in a folder - refers to a file (or folder) that is actually stored somewhere else. - Sometimes the link entry's name is “shortcut to…” whatever is being linked. • Applications can usually use a shortcut as if it was the file itself. • Rename/move/copy/delete on a shortcut doesn’t affect the linked file!
28 Create some file names:
• Windows Explorer: - Create new documents • Start Notepad: - Make a new text file
• Make both long names and short names • Make a link
• Use command line to look at the link
29 Using Files
• Most document files are automatically associated with a particular application - Double-click the file, and its associated program executes and uses the file. • Most applications have an “open file” command on the File menu (and usually on the toolbar) that can be used to find and open a file.
• Some programs support dragging a file onto a program's icon to start the program and use the dragged file as its input - Sometimes this is confusing, even bad! 30 Managing Files
• Graphical User Interface includes “Drag & Drop” mouse operations • Moving and Copying - Highlight one or more files or directories - “Drag” the highlighted area - click & hold, move cursor to desired location - “Drop” it - release the mouse button • Renaming, Deleting - Highlight the file or files - Press Delete key to get rid of it - Choose the File menu; select Rename, Delete, or other desired operation
31 Examining directories
• GUI – Windows Explorer - Information is controlled and simplified - Hierarchies nicely displayed, but can be deceiving • Command-line – dir command - Basic, DOS-compatible - Poor representation of hierarchies
32 The Command Prompt
• Non-graphical commands are available from the command prompt (a.k.a. command line, shell, command.com, cmd.exe) • Windows-explorer functions are matched by individual commands: dir – listing of files and folders rename – change a file's name mkdir – create a folder chdir – change the current directory • For some tasks, a command line is simpler or more powerful than the Windows "GUI". 33 Some file-control commands compared
Change Display Create current folder Rename Move Copy Delete folder folder contents
right- Choose automatic select, Double- drag- click, “new” in right- press GUI click and- drag- from Windows click Delete folder drop and- menu Explorer key drop
Command del chdir mkdir dir rename move copy or Line rmdir
34 Try out the command prompt:
• Make Windows Explorer partial-size • Start a Command prompt (side-by-side) • Navigate to folder on P: drive - “chdir” • Use “dir” • Use “del” (or “erase”), “rename”
35