Misplaced Pages

Fork (file system): Difference between revisions

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
Browse history interactively← Previous editNext edit →Content deleted Content addedVisualWikitext
Revision as of 09:46, 1 September 2011 editAndrewWTaylor (talk | contribs)Extended confirmed users, Pending changes reviewers11,529 editsm NTFS← Previous edit Revision as of 01:47, 11 September 2011 edit undoDanhash (talk | contribs)Extended confirmed users, Pending changes reviewers, Rollbackers9,190 editsm FAT: comma usageNext edit →
Line 17: Line 17:
=== Microsoft === === Microsoft ===
====FAT==== ====FAT====
The ] file system, in all it's 12, 16 and 32 bit versions, is limited to one fork per file. ] for compatibility with operating systems that natively use a different file system. The ] file system, in all it's 12, 16, and 32 bit versions, is limited to one fork per file. ] for compatibility with operating systems that natively use a different file system.

====NTFS==== ====NTFS====
In ]'s ] file system forks are known as '''Alternate Data Streams''' (ADS).<ref>{{cite web | url=http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/files_and_clusters.asp | title=Files and Clusters | author=Microsoft | publisher=Microsoft | accessdate=2006-11-18}}</ref> In 1993, Microsoft released the first version of the ] operating system which introduced the ] file system. This file system includes support for multiple named forks as ''alternate data streams'' for compatibility with pre-existing operating systems that support forks. With ], Microsoft started using alternate data streams in NTFS to store things such as ''author'' or ''title'' file attributes<ref>{{cite web | url=http://msdn2.microsoft.com/en-us/library/ms810604.aspx | title=A Programmer's Perspective on NTFS 2000 Part 1: Stream and Hard Link | author=Dino Esposito | month=March | year=2000 | publisher=Microsoft | accessdate=2006-11-18}}</ref> and image ]s.<ref>{{cite web | url=http://support.microsoft.com/kb/319300 | title=Indexing service adds data streams to image files | author=Microsoft | date=2006-10-27 | publisher=Microsoft | accessdate=2006-11-18}}</ref> With Service Pack 2 for ], Microsoft introduced the Attachment Execution Service that stores details on the origin of downloaded files in alternate data streams attached to files, in an effort to protect users from downloaded files that may present a risk.<ref>{{cite web | url=http://community.bartdesmet.net/blogs/bart/archive/2005/08/19/3485.aspx | title=Demo of "Attachment Execution Service internals" in Windows XP SP2 and Windows Server 2003 SP1 | author=Bart De Smet | date=2005-08-19 | publisher=B# .NET Blog | accessdate=2006-11-18}}</ref> In ]'s ] file system forks are known as '''Alternate Data Streams''' (ADS).<ref>{{cite web | url=http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/files_and_clusters.asp | title=Files and Clusters | author=Microsoft | publisher=Microsoft | accessdate=2006-11-18}}</ref> In 1993, Microsoft released the first version of the ] operating system which introduced the ] file system. This file system includes support for multiple named forks as ''alternate data streams'' for compatibility with pre-existing operating systems that support forks. With ], Microsoft started using alternate data streams in NTFS to store things such as ''author'' or ''title'' file attributes<ref>{{cite web | url=http://msdn2.microsoft.com/en-us/library/ms810604.aspx | title=A Programmer's Perspective on NTFS 2000 Part 1: Stream and Hard Link | author=Dino Esposito | month=March | year=2000 | publisher=Microsoft | accessdate=2006-11-18}}</ref> and image ]s.<ref>{{cite web | url=http://support.microsoft.com/kb/319300 | title=Indexing service adds data streams to image files | author=Microsoft | date=2006-10-27 | publisher=Microsoft | accessdate=2006-11-18}}</ref> With Service Pack 2 for ], Microsoft introduced the Attachment Execution Service that stores details on the origin of downloaded files in alternate data streams attached to files, in an effort to protect users from downloaded files that may present a risk.<ref>{{cite web | url=http://community.bartdesmet.net/blogs/bart/archive/2005/08/19/3485.aspx | title=Demo of "Attachment Execution Service internals" in Windows XP SP2 and Windows Server 2003 SP1 | author=Bart De Smet | date=2005-08-19 | publisher=B# .NET Blog | accessdate=2006-11-18}}</ref>

Revision as of 01:47, 11 September 2011

In a computer file system, a fork is byte stream associated with a file system object. Every non-empty file must have at least one fork, and depending on the file system, a file may have one or more other associated forks, which in turn may contain primary data integral to the file, or just metadata. Unlike an extended attributes, a similar file system feature which is typically limited in size, forks can be of arbitrary size, possibly even larger than the file's primary data fork. The size of a file is the sum of the sizes of each fork.

Implementations

Apple

Further information: Resource fork

File system forks are associated with Apple's Hierarchical File System (HFS). Apple's HFS, and the original Apple Macintosh file system MFS, allowed a file system object to have several kinds of forks: a data fork, a resource fork, and multiple named forks.

The resource fork was designed to store non-compiled data that would be used by the system's graphical user interface (GUI), such as localisable text strings, a file's icon to be used by the Finder or the menus and dialog boxes associated with an application. However the feature was very flexible, so additional uses were found, such as splitting a word processing document into content and presentation, then storing each part in separate resources. As compiled software code was also stored in a resource, often applications would consist of just a resource fork and no data fork.

One of HFS+'s more obscure features is that a file may have an arbitrary number of custom “named forks” in addition to the traditional data and resource forks. This feature has gone largely unused, as Apple never added support for it under Mac OS 8.1-10.3.9. Beginning with 10.4, a partial implementation was made to support Apple's extended inline attributes.

Until Mac OS X v10.4, users running the legacy Unix command line utilities (such as tar) included with Mac OS X would risk data loss, as the utilities were not updated to handle the resource forks of files until v10.4.

Novell

Starting in 1985, Novell NetWare File System (NWFS), and its successor Novell Storage Services (NSS), were designed from the ground up to use a variety of methods to store a file's metadata. Some metadata resides in Novell Directory Services (NDS), some is stored in the directory structure on the disk, and some is stored in, as Novell terms it, 'multiple data streams' with the file itself. Multiple data streams also allow Macintosh clients to attach to and use NetWare servers.

Microsoft

FAT

The File Allocation Table file system, in all it's 12, 16, and 32 bit versions, is limited to one fork per file. Work-arounds exist for compatibility with operating systems that natively use a different file system.

NTFS

In Microsoft's NTFS file system forks are known as Alternate Data Streams (ADS). In 1993, Microsoft released the first version of the Windows NT operating system which introduced the NTFS file system. This file system includes support for multiple named forks as alternate data streams for compatibility with pre-existing operating systems that support forks. With Windows 2000, Microsoft started using alternate data streams in NTFS to store things such as author or title file attributes and image thumbnails. With Service Pack 2 for Windows XP, Microsoft introduced the Attachment Execution Service that stores details on the origin of downloaded files in alternate data streams attached to files, in an effort to protect users from downloaded files that may present a risk.

Windows NT versions include the ability to use forks in the API, and some command line tools can be used to create and access forks, but they are ignored by most programs, including Windows Explorer and the DIR command. Windows Explorer copies forks and warns when the target file system does not support them, but only counts the main fork's size and does not list a file or folder's streams. The DIR command has been updated in Vista to include an option that will list forks.

Possible security and data loss risks

When a file system supports different forks, the applications should be aware of them, or security risks can arise. Allowing legacy software to access data without appropriate shims in place is the primary culprit for such problems.

If the different system utilities (disk explorer, antivirus software, archivers, and so on), are not aware of the different forks, the following problems can arise:

  • The user will never know the presence of any alternate fork nor the total size of the file, just of the main data fork.
  • Computer viruses can hide in alternate forks on Windows and never get detected if the antivirus software is not aware of forks.
  • Data can be lost when sending files via fork-unaware channels, such as e-mail, file systems without support for forks, or even when copying files between file systems with forks support if the program that made the copy does not support forks or when compressing files with software that does not support forks.

This video illustrate how a file is being forked in ADS and one of the methods to remove ADS files.

See also

References

  1. Apple (1996-07-02). "File Forks". Apple. Retrieved 2006-11-18.
  2. Bruce Horn. "The Grand Unified Model (1) - Resources". Folklore.org. Retrieved 2006-11-18.
  3. "Command-line Backup Solutions on Mac OS X". Apple. 2005-10-29. Retrieved 2006-11-18.
  4. Microsoft. "Files and Clusters". Microsoft. Retrieved 2006-11-18.
  5. Dino Esposito (2000). "A Programmer's Perspective on NTFS 2000 Part 1: Stream and Hard Link". Microsoft. Retrieved 2006-11-18. {{cite web}}: Unknown parameter |month= ignored (help)
  6. Microsoft (2006-10-27). "Indexing service adds data streams to image files". Microsoft. Retrieved 2006-11-18.
  7. Bart De Smet (2005-08-19). "Demo of "Attachment Execution Service internals" in Windows XP SP2 and Windows Server 2003 SP1". B# .NET Blog. Retrieved 2006-11-18.
  8. Bart De Smet (2006-07-13). "Use Vista's DIR command to display alternate data streams". B# .NET Blog. Retrieved 2007-07-07.

External links

Category: