I have a 2TB drive that was for a year or so a full-device btrfs filesystem1. I decided to convert is back to a partitioned device so I could install grub on it as grub cannot install on a drive completely used by btrfs. I am planning on upgrading this year, so I decided to prep this drive properly and use a GPT table instead of the older MBR. So I deleted the btrfs filesystem on it and then partitioned it with gdisk and created a new btrfs partition in partition 1. All went swimmingly - or so I thought.
Then when I tried to install grub, it failed with this message:
which I thought was dumb because I had removed btrfs from the MBR area. So I wiped the first 5122 bytes with zeros and tried again. Same error. I then searched for many long hours looking for someone else who had encountered this; nada. I did find info on grub with GPT discs. It seems GPT and grub aren't really all that compatible on an older BIOS based PC using GPT on it drives. You have to create a special small partition for grub to use on a GPT disc called a "bios_boot" partition. OK, so I did that - still no go. Grub-install fails with the same error and grub did not seem to recognize the bios_boot partition at all.
A few more hours mucking about and I pulled out the dd hammer and wiped the first 210MB with zeros. Well, this changed things, but not for better. Now grub-install says this:
However, at least this as easier to fix. I went back into gdisk and created a new partition table with partitions - including the new bios_boot partition and saved it. Finally, success! grub-install found the bios_boot partition and installed without a hitch.
Apparently, btrfs,GPT and grub use a lot of the same space and don't play all that well together. Since I could find little on this situation, I thought I had better document it.
Here are the steps to convert a btrfs drive to a GPT drive with grub on a bios based (non-efi) computer:
1. Backup your data.
2. Wipe the old table and btrfs data with dd (how much is actually needed I will update when I find out):
4. Fill in the rest of your partitions and save the new table.
5. Run grub-install.
6. Format your new partitions.
7. Adjust fstab as needed.
1) For those who aren't familiar: btrfs can reside on an entire device without a partition table. As in: sudo mkfs.btrfs /dev/sdc Note the lack of a partition number!
2) The first 512 bytes of your MBR disk hold the boot record and partition table info.
Then when I tried to install grub, it failed with this message:
grub-install: warning: Attempting to install GRUB to a disk with multiple partition labels. This is not supported yet..
grub-install: error: filesystem `btrfs' doesn't support blocklists.
grub-install: error: filesystem `btrfs' doesn't support blocklists.
A few more hours mucking about and I pulled out the dd hammer and wiped the first 210MB with zeros. Well, this changed things, but not for better. Now grub-install says this:
grub-install: error: unable to identify a filesystem in hostdisk//dev/sdi; safety check can't be performed.
Apparently, btrfs,GPT and grub use a lot of the same space and don't play all that well together. Since I could find little on this situation, I thought I had better document it.
Here are the steps to convert a btrfs drive to a GPT drive with grub on a bios based (non-efi) computer:
1. Backup your data.
2. Wipe the old table and btrfs data with dd (how much is actually needed I will update when I find out):
sudo dd if=/dev/zero of=dev/sdX bs=4M count=50
3. Create a new GPT partition table and make your first partition 1M in size and type "ef02".4. Fill in the rest of your partitions and save the new table.
5. Run grub-install.
6. Format your new partitions.
7. Adjust fstab as needed.
1) For those who aren't familiar: btrfs can reside on an entire device without a partition table. As in: sudo mkfs.btrfs /dev/sdc Note the lack of a partition number!
2) The first 512 bytes of your MBR disk hold the boot record and partition table info.
Comment