Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a HP 4530s laptop and I've swapped the original HDD with an 180GB Intel 335 SSD. The problem is, I can't boot from it.

I've transfered my openSUSE 12.3 x86_64 from the HDD via cpio, as mentioned here: http://www.linuxjournal.com/magazine/hack-and-migrate-new-hard-drive

I've also reinstalled GRUB with something like:

    mount /dev/sda1 /mnt/
    mount --bind /dev/ /mnt/dev
    mount --bind /proc/ /mnt/proc
    mount --bind /sys/ /mnt/sys
    chroot /mnt/
    grub2-mkconfig
    grub2-install /dev/sda

Some of that must have done some good, because now I can boot from my openSUSE Rescue CD, go to "boot from HDD" and it works. But if I try to boot directly from the SSD, the HP BIOS kindly informs me I should install an OS there first.

I've tried variations of the same method, like enabling UEFI from BIOS and installing grub2-efi, but I'm bumping on the same issue.

I have that weird feeling that I'm missing something basic. Any ideas for a more "systematic" approach?

Thanks in advance!

share|improve this question
1  
Do you have an active partition on your new SSD? Although the active flag is not used during boot when GRUB in installed into the MBR, some BIOS versions check the partition table and refuse to boot from a disk which does not seem to have an active partition. –  Sergey Vlasov May 24 '13 at 6:47
    
No, I didn't. I just went to fdisk and did an "a" on my /dev/sda1 and now it boots! Thanks a million! I'm now rebooting the thing just for fun! –  Radu Gheorghe May 25 '13 at 9:17
    
Glad that you solved your problem; I now rewritten the comment to a proper answer which can be accepted. –  Sergey Vlasov May 25 '13 at 14:25
add comment

1 Answer

up vote 1 down vote accepted

The Linux Journal article you referenced misses one step which may be important for some computers — when you partition the new drive using the MS-DOS partition table format, you must mark exactly one primary partition on the drive as active. This step is often forgotten without any visible problems; however, on some computers the BIOS performs more strict checks and refuses to boot from a disk without an active partition.

The way to mark a partition as active in Linux fdisk is to use the a command; it asks for the partition number and toggles the active flag for that partition. If you print the partition table using the p command, active partitions are marked by the * character in the Boot column.

If you have only Linux installed on the disk, and the bootloader is installed into the MBR, it does not matter which primary partition is marked as active, as long as there is exactly one such partition.

More details below, if you are interested:

(All this applies only when the MS-DOS partition table format is used; the situation is significantly different with the GPT partition table, especially when used together with UEFI.)

When the MS-DOS partition table was introduced, the MBR was intended to contain a small piece of code which searches through primary partitions (there can be up to 4 of them), and if exactly one partition has the active flag set, loads the first sector from that partition (the boot sector) and transfers control to the code from there, which then should boot the OS from that partition. If there are either no active partitions, or more than one partition with the active flag set, the MBR code prints a message and invokes int $0x18 to report boot failure to the BIOS.

However, many bootloaders used for booting Linux are usually installed into the MBR and replace the standard MBR code with the code which loads the rest of the bootloader and then, e.g., offers the boot menu. This code does not use the active flag in the partition table, therefore, e.g., GRUB installed into the MBR can start and load the Linux kernel even if there is no active partition on the disk; Linux also does not use the active partition flag in any way.

Many BIOS versions check only the 0xaa55 magic number at the end of MBR and the initial jmp command code to determine whether the MBR is valid, and will happily transfer control to the code in MBR irrespective of the MS-DOS partition table contents. However, in some cases BIOS developers decide to be “more helpful” and add more checks to the boot code — e.g., BIOS may look at the MS-DOS partition table in the MBR and consider the disk to be non-bootable if there is no active partition there. This check gives wrong results if MBR does not contain the usual code which loads the boot sector from the active partition, but BIOS developers probably does not consider this to be a problem. If your computer has such BIOS, you must have an active partition on your boot disk, even if the active flag is not actually used by the code in MBR and the rest of bootloader.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.