Tag Archives: hard drives

The New 4096 Byte Sector

Back in the latter part of ’09, hard disk manufacturers introduced the new 4096 byte sector to replace the older style 512 byte sector that’s been around forever.

This is a bit more techie than most folks want to delve into, but it’s pretty important that you at least have a passing familiarity with how disk drives work. A hard disk platter is divided up into tracks and sectors (see Fig 1). When you “write” data to the disk, the drive converts your digital data to physical artifacts on the actual drive platter that can later be “read” by the head and converted back to digital form.

Figure 1

The above image is from an excellent guide on how disk drives work that can be found at How Stuff Works. I strongly recommend giving that guide a looksee –> How Stuff Works – How Hard Disks Work by Marshall Brain

A wee bit of Mr. Brain’s article:

At the simplest level, a hard disk is not that different from a cassette tape. Both hard disks and cassette tapes use the same magnetic recording techniques described in How Tape Recorders Work. Hard disks and cassette tapes also share the major benefits of magnetic storage — the magnetic medium can be easily erased and rewritten, and it will “remember” the magnetic flux patterns stored onto the medium for many years.

Without getting too complicated, the main reason for the change from 512 byte to 4096 byte sectors is to aid in error correction capabilities. Disk drives are just getting so physically HUGE nowadays, that the old 512 byte sector provides too many possibilities for low level errors. The firmware that tracks and corrects these errors normally is now being strained trying to keep up on large capacity disks with the smaller sectors. The 4096 byte (512*8) sector allows for much more efficient error correction.

There is the possibility of performance degradation using the larger 4096 byte sector, though. There are workarounds and performance tweaks that one can do to eliminate those type issues.

From Roderick W. Smith’s somewhat technical article at IBM’s DeveloperWorks Technical Library site:

Most modern file systems use data structures that are 4096 bytes or larger in size. Thus, most disk I/O operations are in multiples of this amount. Consider what happens when Linux wants to read or write one of these data structures on a new disk with 4096-byte sectors. If the file system data structures happen to align perfectly with the underlying physical partition size, a read or write of a 4096-byte data structure results in a read or write of a single sector. The hard disk’s firmware doesn’t need to do anything extraordinary; but when the file system data structures do not align perfectly with the underlying physical sectors, a read or write operation must access two physical sectors. For a read operation, this takes little or no extra time because the read/write head on the disk most likely passes over both sectors in succession, and the firmware can simply discard the data it doesn’t need. Writes of misaligned data structures, on the other hand, require the disk’s firmware to first read two sectors, modify portions of both sectors, and then write two sectors. This operation takes longer than when the 4096 bytes occupy a single sector. Thus, performance is degraded.

Even though Mr. Smith’s article is quite technical in nature, it’s well written in plain language. It might be a bit deep for most, but it’s worth the effort. Give it a read. I would suggest reading Marshall Brain’s less advanced guide above first. You can find Mr. Smith’s article here –> Linux on 4KB-sector disks: Practical advice

I hope you’ll learn something useful by reading this.

Have a great day…

~Eric

Poor Misunderstood fstab

One of the most misunderstood configuration files in Linux is the fstab.

The fstab configuration file allows you to customize and manipulate how your Linux system auto-mounts drive partitions and other devices. It’s not rocket science, folks, but its nomenclature and textual entry protocols can sometimes be a wee bit confusing, especially to novice Linux users.

Nowadays, modern kernels utilize applications such as udev and hal to perform a lot of these fstab tricks in the background right out of the box. For the Linux user with a custom hardware set up or the need to tweak, the fstab is the way to go. In my Slackware installation, there are some hardware configurations and customizations that I prefer to manually set up. I use my fstab for this purpose (see Fig 1).

Figure 1 – Eric’s Slackware /etc/fstab Configuration File

You’ll notice that I mount three different partitions (Archives, Common, and Backups) in my /home/vtel57 directory at boot up. I also have a Zip drive on this system. HA! Remember those? I still use mine… and a floppy drive, too. I told you I was an old fashioned geek. These mounts are the reason that I prefer to manually configure my auto-mounting, rather than depend on udev or hal.

Akkana Peck over at Linux Planet has created an outstanding tutorial for folks interested in manipulating and understanding fstab.

Here’s a snip:

/etc/fstab — it’s there on every Linux computer, controlling which filesystems get mounted where.

Its manual page, man fstab, begins with this snippet:

fstab is only read by programs, and not written; it is the duty of the system administrator to properly create and maintain this file.

Fortunately, they’re fibbing. These days fstab is usually created for you by an installer or other program. So don’t get too worried about your “duty”.

However, if you want to delve into fstab, it’s easy to understand and modify.

Check out the entire tutorial here –> Controlling Your Linux System With fstab by Akkana Peck.

Learn something, folks… and have FUN while you’re at it.

Until next time…

~Eric