Friday, May 24, 2013

What is Mac OS HFS+ format ?


The Mac OS Extended Format (HFS+) is a volume format compatible with Mac OS 8.1 and higher, including Mac OS X. In terms of volume, folder, and file size limits, it is similar to the Macintosh Standard Format (HFS). 
HFS+ or HFS Plus is a file system developed by Apple Computer Inc. to replace their Hierarchical File System (HFS) as the primary file system used in Macintosh computers (or other systems running Mac OS). It is also one of the formats used by the iPod music player. HFS+ is also referred to as Mac OS Extended Volume Hard Drive Format, where its predecessor, HFS, is also referred to as Mac OS Standard.

HFS+ is an improved version of HFS, supporting much larger files (block addresses are 32-bit length instead of 16-bit) and using Unicode (instead of Mac OS Roman or any of several other character sets) for naming the items (files, folders) - names which are also character encoded in UTF-16 and normalized to a form very nearly the same as Unicode Normalization Form D (NFD) (which means that precomposed characters like é are decomposed in the HFS+ filename and therefore count as two characters and UTF-16 implies that characters from outside the Basic Multilingual Plane - often seldom used and characters from ancient writing systems - also count as two characters in an HFS+ filename). HFS Plus permits filenames up to 255 UTF-16 characters in length, and n-forked files similar to NTFS, though until recently, almost no software takes advantage of forks other than the data fork and resource fork. HFS+ also uses a full 32-bit allocation mapping table, rather than HFS’s 16 bits. This was a serious limitation of HFS, meaning that no disk could support more than 65,536 allocation blocks under HFS. When disks were small, this was of little consequence, but as larger-capacity drives became available, it meant that the smallest amount of space that any file could occupy (a single allocation block) became excessively large, wasting significant amounts of space. For example, on a 1 GB disk, the allocation block size under HFS is 16 KB, so even a 1 byte file would take up 16 KB of disk space.

How do I know a hard disk is HFS+ format?

Select the hard disk in the Finder and choose the Get Info command in the File menu. The format information will specify either Mac OS Standard (hfs) or Mac OS Extended (hfs+). 

What are the differences between HFS+ format and HFS format?

The most visible difference between HFS+ format and HFS format, other than the minimum file size, is the maximum number of files. 

An HFS+ volume contains five special files:

  1. Catalog file - Describes the folder and file hierarchy of the volume. It is organized as a "balanced tree" for fast and efficient searches
  2. Allocation file - Specifies whether an allocation block is free (similar to $Bitmap in NTFS). This is stored in a bitmap, specifying a free allocation block with a "clear bit"
  3. Attributes file - Contains attribute information regarding files or folders
  4. Extents overflow file - Additional extents (contiguous allocation blocks allocated to forks) are stored in a b-tree in this file
  5. Startup file - Allows computers to boot that do have built in support for HFS+ file systems

What is FAT and NTFS ?


FAT Definition:

FAT, short for File Allocation Table (used by hard disks, disks, Smartmedia™, Compact Flash™, Memory Stick and other), 
A table that the operating system uses to locate files on a disk. Due to fragmentation, a file may be divided into many sections that are scattered around the disk. The FAT keeps track of all these pieces. 
It is a file system that was created by Microsoft in 1977. FAT ( also know as FAT, FAT16, and FAT32 ) is still in use today as the preferred file system for floppy drive media and portable, high capacity storage devices like flash drives.

FAT was the primary file system used in all of Microsoft's consumer operating systems from MS-DOS to Windows ME. The New Technology File System (NTFS) is the primary file system on Microsoft's newer operating systems but FAT is still a supported option.

Below is more information on the versions of the FAT file system:
  • FAT12 - The initial version of the FAT file system, FAT12 was introduced in 1977, even before MS-DOS, and was the primary file system for Microsoft operating systems up to MS-DOS 4.0. FAT12 supports drive sizes up to 32MB.
  • FAT16 - The second implementation of FAT was FAT16, introduced in 1981. FAT16 was the primary file system for MS-DOS 4.0 up to Windows 95. FAT16 supports drive sizes up to 2GB. It was designed originally to handle files on a floppy drive, and has had minor modifications over the years so it can handle hard disks, and even file names longer than the original limitation of 8.3 characters, but it's still the lowest common denominator. The biggest advantage of FAT16 is that it is compatible across a wide variety of operating systems, including Windows 95/98/Me, OS/2, Linux, and some versions of UNIX. The biggest problem of FAT16 is that it has a fixed maximum number of clusters per partition, so as hard disks get bigger and bigger, the size of each cluster has to get larger. In a 2–GB partition, each cluster is 32 kilobytes, meaning that even the smallest file on the partition will take up 32 KB of space. FAT16 also doesn't support compression, encryption, or advanced security using access control lists.
  • FAT32 - FAT32 is the latest version of the FAT file system. It was introduced in 1996 for Windows 95 Service Pack 2 users and was the primary file system for consumer Windows versions through Windows ME. FAT32 supports drive sizes up to 8TB.
    FAT32 shares all of the other limitations of FAT16, and adds an important additional limitation—many operating systems that can recognize FAT16 will not work with FAT32—most notably Windows NT, but also Linux and UNIX as well. Now this isn't a problem if you're running FAT32 on a Windows XP computer and sharing your drive out to other computers on your network—they don't need to know (and generally don't really care) what your underlying file system is.



New Technology File System (NTFS):

NTFS Short for NT File System, is a high-performance and self-healing file system used in Windows Vista, Windows XP, 2003, 2000, NT and Windows 7, which supports file-level security, compression and auditing. It also supports large volumes and powerful storage solution such as RAID. NTFS supports hard drive sizes up to 256TB.

NTFS supersedes the FAT file system as the preferred file system for Windows operating systems. NTFS has several improvements over FAT and HPFS (High Performance File System) such as improved support for metadata and the use of advanced data structures to improve performance, reliability, and disk space utilization, plus additional extensions such as security access control lists (ACL) and file system journaling.

The most important new feature of NTFS is the ability to encrypt files and folders to protect your sensitive data.

The Advantages of NTFS:

The NTFS file system, introduced with first version of Windows NT, is a completely different file system from FAT. It provides for greatly increased security, file–by–file compression, quotas, and even encryption. It is the default file system for new installations of Windows XP, and if you're doing an upgrade from a previous version of Windows, you'll be asked if you want to convert your existing file systems to NTFS. Don't worry. If you've already upgraded to Windows XP and didn't do the conversion then, it's not a problem. You can convert FAT16 or FAT32 volumes to NTFS at any point. Just remember that you can't easily go back to FAT or FAT32 (without reformatting the drive or partition), not that I think you'll want to.

The NTFS file system is generally not compatible with other operating systems installed on the same computer, nor is it available when you've booted a computer from a floppy disk. For this reason, many system administrators, myself included, used to recommend that users format at least a small partition at the beginning of their main hard disk as FAT. This partition provided a place to store emergency recovery tools or special drivers needed for reinstallation, and was a mechanism for digging yourself out of the hole you'd just dug into. But with the enhanced recovery abilities built into Windows XP (more on that in a future column), I don't think it's necessary or desirable to create that initial FAT partition.

What is a Sector and a Bad Sector ?

A sector is a small area on the surface of a hard drive or a floppy disk.


The smallest unit that can be accessed on a disk. When a disk undergoes a low-level format, it is divided into tracks and sectors. The tracks are concentric circles around the disk and the sectors are segments within each circle. For example, a formatted disk might have 40 tracks, with each track divided into 10 sectors. The operating system and disk drive keep tabs on where information is stored on the disk by noting its track and sector number. 

Modern hard disk drives use a technique called zoned-bit recording in which tracks on the outside of the disk contain more sectors than those on the inside. 

A sector that cannot be used due to a physical flaw on the disk is called a bad sector.

What is Bad Sector?

Hard drives are contain millions of sectors. It is very normal for some of these sectors to be bad sectors, even when the drive is first manufactured.

In addition, a small number of sectors will normally go bad during the lifespan of a drive.

When this happens, the data in those sectors may be lost, but the data on the rest of the disk will be unaffected and the disk is still completely usable.

A bad sector cannot be repaired, but it can be marked as unusable. Once marked as unusable, the Operating System will know not to attempt to store data in that bad sector. The storage capacity of the disk will be decreased by the amount of storage space in the bad sector.

If your hard drive develops a bad sector, back the hard drive up immediately. If the bad sector was caused by a faulty drive head, the problem can quickly spread to other sectors on the disk.

Partition Tables

[ Click on the Image to Enlarge ]


These describe the various partitions on the disk: where they start, how big they are, what type they are. The MBR contains a partition table. 
Partition can be considered as a piece of disk space, which is marked thereby runs on some operating system. Partition table is located at the first sector (cylinder 0, head 0 and sector 1, MBR) of each hard disk. It memorizes information about sizes and locations of partitions on hard disk. The partition information is started on offset 1BEH of master boot sector. Each partition entry is 16 bytes long. The total partition table is 64 bytes long. Then partition table is limited to a maximum of 4 entries. That is, there is a maximum of 4 partitions, which is called primary partition and can be created on hard disk.

If Dynamic disks are used the partition table explanation as described here does not apply anymore. 

Partition types: Primary / Extended / Logical



Primary partitions is a partition that is needed to store and boot an operating system, In general, you would install the operating system in a primary partition. A primary partition can be set "active", which allows the computer to locate the operating system that needs to be started. Only 1 primary partition can be active, but more primary partitions can exist. If more than 1 primary partition is set active, the computer will not boot. Also, when no primary partition is set active, the computer will not boot. Only the partition table in the MBR can contain primary partitions.

Extended partition can be sub-divided into logical drives and is viewed as a container for logical drives, where data proper is located. An extended partition is not formatted or assigned a drive letter. The extended partition is used only for creating a desired number of logical partitions..

Logical partitions are the partitions that are created in the extended partition area. A logical partition is a way to extend the initial limitation of four partitions. An extended partition can contain up to 24 logical partitions.
Logical partitions are used for storing data mainly, they can be formatted and assigned drive letters; their details are listed in the extended partition’s table - EMBR (Extended Master Boot Record). 


Note that when using Dynamic disks these rules don't apply anymore.

Monday, May 20, 2013

Email protocols: POP, IMAP, SMTP and MAPI

Interactions between email servers and clients are governed by email protocols.  The three most common email protocols are POP, IMAP and MAPI.  Most email software operates under one of these (and many products support more than one). 


The Post Office Protocol (currently in version 3, hence POP3) allows email client software to retrieve email from a remote server.  The Internet Message Access Protocol (now in version 4 or IMAP4) allows a local email client to access email messages that reside on a remote server.  There's a related protocol called SMTP, which we also discuss below.

The Messaging Application Programming Interface (MAPI)  is a proprietary email protocol of Microsoft, that can be used by Outlook (Microsoft's email client software) to communicate with Microsoft Exchange (its email server software).  It provides somewhat more functionality than an IMAP protocol; unfortunately, as a proprietary protocol, it works only for Outlook-Exchange interactions.


POP

POP is the older design, and hails from an era when intermittent connection via modem (dial-up) was the norm.  POP allows users to retrieve email when connected, and then act on the retrieved messages without needing to stay "on-line."  This is an important benefit when connection charges are expensive.
The basic POP procedure is to retrieve all inbound messages for storage on the client, delete them on server, and then disconnect.  (The email server functions like a mailbox at the Post Office -- a temporary holding area until mail gets to its final destination, your computer.)
Outbound mail is generated on the client, and held for transmission to the email server until the next time the user's connection is active.  After it's uploaded, the server forwards the outgoing mail to other email servers, until it reaches its final destination.
Most POP clients also provide an option to leave copies of email on the server.  In this case, messages are only removed from the server when greater than a certain "age" or when they have been explicitly deleted on the client.  It's the copies on the client that are considered the "real" ones, however, with those left on the server merely temporary backups.


IMAP

IMAP is the newer protocol and oriented toward a "connected" mode of operation.  The standard IMAP procedure is to leave messages on the server instead of retrieving copies, so email is only accessible when "on-line."
IMAP is more suited to a world of always-on connections, particularly the fast connections offered by broadband mechanisms.  Having to be connected to read your email is a trivial obstacle when the connection is always available.  (It's a little like leaving your messages at the Post Office, and going there every time you want to read them.  That might be difficult in the physical world, but it's easy in the virtual one.)
Because messages remain on the server, until explicitly deleted by the user, they can be accessed by multiple client computers -- an important advantage when you use more than one computer to check your email.
IMAP does not preclude keeping copies on the client, but, in an inversion of the way POP works, it's the server's copies that are considered the "real" ones.  That offers an important security benefit -- you won't lose your email if, for some reason, your client computer's storage media fails.
IMAP has other advantages over POP (detailed in the links provided below).  It is the standard we recommend if you can't use MAPI.


SMTP

At the risk of overloading you with information, you should know that strictly speaking it's only the incoming mail that is handled by a POP or IMAP protocol.  Outgoing mail for both POP and IMAP clients uses the Simple Mail Transfer Protocol (SMTP).
When you set up a POP or IMAP email account on email client software, you must specify the name of the (POP or IMAP) mail server computer for incoming mail.  You must also specify the name of the (SMTP) server computer for outgoing mail.  These names are typically in the same form as Web addresses (e.g., "imap.med.miami.edu").  Depending on the client, there may also be specifications for email directories and searching.


MAPI

As noted, MAPI is Microsoft's proprietary email protocol.  It provides greater functionality than IMAP for Outlook email clients interacting with an Exchange email server.  It doesn't work for anything else.  (In Outlook you may simply see the connection option "Microsoft Exchange Server" rather than MAPI.  It's offering the same thing.)
Remote access using MAPI may require use of a VPN connection, because the ports (communications channels) that MAPI uses are otherwise blocked for security reasons.  (That's the case when accessing the medical campus Exchange system remotely.)


Web browser email access

Many email systems can now be accessed using only a Web browser.  There is no need to install client email software of any kind.  Logically, Web browser interfaces to email are like IMAP, in that all the messages remain on the server unless explicitly deleted.  (Message copies can be saved on the client computer.)
For example, the medical campus Exchange email system can be accessed by Outlook Web Access (OWA); it provides most of the functionality of an installed version of Outlook.  OWA is compatible with most browsers, such as Firefox, Netscape, Opera or Safari, though it works best with Microsoft's Internet Explorer browser.


More information

POP (Wikipedia)Information about POP, including links to the formal standards
IMAP (Wikipedia)
Information about IMAP, including links to the formal standards
Comparing Two Approaches to Remote Mailbox Access: IMAP vs. POP (IMAP Connection)All about why IMAP is better than POP
SMTP (Wikipedia)All about SMTP
MAPI (Wikipedia)
Information about MAPI, including links to Microsoft reference materials