You are not logged in.
Pages: 1
hi all,
Looking for some help.
Have a 4 disk server with btrfs using the entire disks.
I made a mistake in the setup and only had one of the drives with a grub boot partition. The machine was moved and one of the drives was dead on arrival. It turns out it was the drive with the grub partition on it.
What is the best way to recover ?
Thanks,
Mark.
Offline
I think you need to give more info about your btrfs setup.
Offline
hi WonderWoofy,
you helped me before https://bbs.archlinux.org/viewtopic.php?id=168902
basically, btrfs raid10, 3 drives have swap partition & partition for btrfs, first drive had 3 partitions, swap, btrfs & 2MB with type "EF02" for grub boot
I think you need to give more info about your btrfs setup.
Offline
So the other disks are whole disk btrfs then? That is, there is no ef02 partition on the other disks? I ask because that is essential to having a GPT partitioned disk and using grub. But if you use whole disk btrfs (add /dev/sdX instead of /dev/sdXY) then you should be able to install grub2 without issue onto any of the other disks.
In any case, you're basically going to have to boot from live media and then install a bootloader to one of those disks. Then of course, adjust the boot order of your disk. But how you proceed depends greatly on how your btrfs raid10 is laid out.
Offline
So the other disks are whole disk btrfs then? That is, there is no ef02 partition on the other disks? I ask because that is essential to having a GPT partitioned disk and using grub. But if you use whole disk btrfs (add /dev/sdX instead of /dev/sdXY) then you should be able to install grub2 without issue onto any of the other disks.
In any case, you're basically going to have to boot from live media and then install a bootloader to one of those disks. Then of course, adjust the boot order of your disk. But how you proceed depends greatly on how your btrfs raid10 is laid out.
thanks for the reply. The other disks all have a swap partition and a btrfs partition.
So they where created with
mkfs.btrfs /dev/sdb2 /dev/sdc2 /dev/sdd2How do I install a bootloader from live media ?
Originally I used
grub-mkconfig -o /boot/grub/grub.cfg
grub-install /dev/sda Offline
If you have GPT on all these disks, then you'll have to have the grub bios boot partition (ef02) in order to get grub working. You could use syslinux, which should be fine, but for me I have had trouble with it when /boot is not located directly off of subvolid=0. So if your /boot resides in a subvol, then it makes it a bit tricky.
It would be easy to shrink the btrfs filesystem by just a bit on one disk, then shrink the partition a little as well. This would allow you to create an 1-2MB ef02 partition at the end of the disk, then you could install grub.
But at this point, I don't even know how you have your filesystem laid out, what else might be on those disks, or even what /dev/sd{a,b,c}1 might be. So again, without more info about your setup, it is not possible to guide you in the right direction.
Offline
If you have GPT on all these disks, then you'll have to have the grub bios boot partition (ef02) in order to get grub working. You could use syslinux, which should be fine, but for me I have had trouble with it when /boot is not located directly off of subvolid=0. So if your /boot resides in a subvol, then it makes it a bit tricky.
It would be easy to shrink the btrfs filesystem by just a bit on one disk, then shrink the partition a little as well. This would allow you to create an 1-2MB ef02 partition at the end of the disk, then you could install grub.
But at this point, I don't even know how you have your filesystem laid out, what else might be on those disks, or even what /dev/sd{a,b,c}1 might be. So again, without more info about your setup, it is not possible to guide you in the right direction.
i have a swap partition on each drive and it is the first partition. I presume I can delete that partition, and create the ef02 partition at the start and the swap after it.
On each of the drives
/dev/sdb1 - swap
/dev/sdb2 - btrfs
/dev/sdc1 - swap
/dev/sdc2 - btrfsOffline
You could indeed. Just know that you are going to have to adjust your fstab before trying to boot the thing. You can either comment out the partitions that you are removing from there, or simply add 'nofail' to their options. Systemd does not like it when there are partitions that it expects but don't show up, and it will drop you into the recovery.target (or maybe the emergency.target, I can never remember which is which).
Also for the btrfs filesystem itself, since you are now missing a disk, you will have to mount it the 'degraded' mount option. You will have to do this in order to install grub, and you will have to continue to do it until you are able to add that disk back. Alternatively, you could rebalance to raid1 for the time being. If you are okay with losing a bit of space until you add one back, this would probably be a good way to go. Just make sure that you have the 3.12.2-1-ARCH kernel, as the version before that have a balance bug that screws with checksums on preallocated extents (files like the journal made with fallocate).
Offline
You could indeed. Just know that you are going to have to adjust your fstab before trying to boot the thing. You can either comment out the partitions that you are removing from there, or simply add 'nofail' to their options. Systemd does not like it when there are partitions that it expects but don't show up, and it will drop you into the recovery.target (or maybe the emergency.target, I can never remember which is which).
Also for the btrfs filesystem itself, since you are now missing a disk, you will have to mount it the 'degraded' mount option. You will have to do this in order to install grub, and you will have to continue to do it until you are able to add that disk back. Alternatively, you could rebalance to raid1 for the time being. If you are okay with losing a bit of space until you add one back, this would probably be a good way to go. Just make sure that you have the 3.12.2-1-ARCH kernel, as the version before that have a balance bug that screws with checksums on preallocated extents (files like the journal made with fallocate).
hi WonderWoofy,
Sorry it took time to try this.
Ok, I booted off usb (archlinux-2013-12), changed /dev/sda, deleted the swap, recreated with partition 1 as EF02, added the remaining as swap. I mounted the btrfs partitions, and adjusted the fstab file. You get a lovely "wrong fs" without the degraded option, but with degraded everything is fine.
I used chroot
arch-chroot /mnt/btrfs-activeI now have the filesystem as it was before, with the correct fstab.
When I run
grub-mkconfig -o /boot/grub/grub.cfg
grub-install /dev/sda The grub-mkconfig fails with the following
grub-probe: error: failed to get canonical path of `'.Any ideas ?
Thanks,
Mark.
Offline
It might be because you are running a degraded filesystem and the grub scripts are not prepared to handle that. But I don't really use grub as my primary bootloader, so I am not enitrely sure about this.
Since you now don't have enough disks to actually run a proper raid10, you might try rebalancing to a raid1 so that it is no longer a degraded array. Then try to install grub again. But since it is really just the grub-mkconfig that is running into issues, you could just set up the grub.cfg by hand. If you have the previous one, it should be as easy as using that and adding 'rootflags=degraded' to the kernel command line.
But I have never had to deal with a degraded array before, so I don't know what implications that might have in terms of grub compatibility. Maybe you should just get a new disk and re-add and re-balance the thing...
Offline
It might be because you are running a degraded filesystem and the grub scripts are not prepared to handle that. But I don't really use grub as my primary bootloader, so I am not enitrely sure about this.
Since you now don't have enough disks to actually run a proper raid10, you might try rebalancing to a raid1 so that it is no longer a degraded array. Then try to install grub again. But since it is really just the grub-mkconfig that is running into issues, you could just set up the grub.cfg by hand. If you have the previous one, it should be as easy as using that and adding 'rootflags=degraded' to the kernel command line.
But I have never had to deal with a degraded array before, so I don't know what implications that might have in terms of grub compatibility. Maybe you should just get a new disk and re-add and re-balance the thing...
Yes all the old grub directory is there. I will rebalance and try edit the existing grub config.
Thanks.
Offline
Pages: 1