Blogger Widgets Science Education and Technology: Does An SSD Have A Boot Sector?

Tuesday, 24 December 2013

Does An SSD Have A Boot Sector?

Do Solid State Drives (SSDs) have boot sectors? Yes and no.
In short, SSDs are capable of emulating legacy magnetic hard drives for legacy BIOSes which use boot sectors, but they’re also capable of supporting newer boot standards.
We have written articles about how to optimize a SSD because it is do different from the old hard drives we are used to. But in this article we will explain the boot sector  in a SSD.

What Is A Boot Sector?

Almost all PCs built between the late 1980s and the mid 2000s (and still some computers built today) used a boot sector to start loading the operating system.
When you turned on your computer, the computer processor would read instructions off of a special chip on your computer, called the CMOS, which would load your Basic Input/Output System (BIOS). The BIOS ran some basic checks on your computer hardware—is your memory working? is your graphics card attached?—and let you configure a few settings, such as your primary and secondary boot devices. If there was a problem with this process you could use various options to repair the boot sector.
Then the BIOS would find the first available attached boot device and read its first sector, called the boot sector. (Also called the boot block because block is a common name for sectors on disk drives.)
A sector or a block on most drives is 512 bytes large, so with the right tools you can actually look at your boot block. Linux and Mac OS X both include the dd tool by default, and you can optionally add it to Windows, so a simple command will display your boot block: (the following command is from Linux, so you need to change the /dev part on Mac OSX and Windows)
dd if=/dev/sda bs=512 count=1 | hexdump
The command above sets the block size to 512 bytes and only reads one block, converting into into hexadecimal format so it doesn’t look like gibberish. Here are the first few lines of the boot block on my Lenovo Thinkpad running Linux:
0000000 63eb 9090 9090 9090 9090 9090 9090 9090
0000010 9090 9090 9090 9090 9090 9090 9090 9090
0000020 ed33 8efa bcd5 7c00 fcfb 3166 66db c931
When the BIOS reads this boot block, it loads it directly into memory and executes it as a program. It’s up to the boot block to start your main operating system, whether that’s Windows or Linux. (Mac OSX on Intel never used boot blocks, and older PowerPC Macs didn’t use them either.)

The Problem With Boot Sectors

If you paid close attention to the description above (and if you know a little bit about computers and programming) you may have noticed that boot sectors are complete programs written in just 512 bytes—that’s the equivilent of 512 English (ASCII) characters. For comparison, this paragraph, which isn’t really that long, has 522 characters, so it’s larger than a typical boot sector. As you can imagine, writing a program that small which does something as important as load your operating system is quite a challenge.
Now 512 bytes was actually a lot of space in computer memory back in the 1980s, so it was reasonable to limit boot sectors to 512 bytes, but today’s computers with their more sophisticated technology had to start using workarounds to get past the boot sector size limitation. Most of them used a boot sector which simply loaded another larger program from somewhere else on your drive. This worked well until you tried to backup and restore your disk drive and the other sector accidentally got moved or—worse—a virus was able to infect it. We could prevent this by protecting the computer from viruses but there had to be a better solution.

The Replacement System

Boot blocks have been mostly phased out in modern PCs. They’ve been replaced with the Unified Extensible Firmware Interface (UEFI) which gives computers much more flexibility in booting and makes it easier for operating systems to interact with core computer hardware.
But where does that leave SSDs? Like any disk drive, SSDs have a first sector (called sector 0 because programmers like to start counting from 0).
If you put an SSD in an older computer which uses legacy BIOS, the Windows or Linux install programs will create a boot sector on sector 0. But if you put an SSD in a modern computer which uses UEFI (including Intel Macs), you won’t need a boot sector, so none will be created. (However, the operating system will probably avoid using sector 0 just to prevent any confusion.)


No comments:

Post a Comment