LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   *BSD (https://www.linuxquestions.org/questions/%2Absd-17/)
-   -   Getting BSD to boot with GRUB (https://www.linuxquestions.org/questions/%2Absd-17/getting-bsd-to-boot-with-grub-4175508196/)

wagscat123 06-16-2014 04:47 PM

Getting BSD to boot with GRUB
 
Well... here's another one's dive into BSD.

I am getting into PC-BSD 10.0, and installed it onto the first partition of my second hard disk. Once I rebooted, I found it messed with the first hard disk's MBR, and that on my second hard disk the 2nd partition after my BSD one was corrupted (the Linux installation on it was acting weird - good riddens, and am not trying to recover it).

When I try to boot, GRUB says that a device (it names it by a UUID) isn't available, and then it throws me into the rescue prompt. Is there a way that I can manually change the GRUB settings so it works? It seems the graphical installer does not provide a lot of flexibility in how to configure GRUB.

I've tried using the rescue environment and was going to chroot to the BSD installation to fiddle with GRUB, but I couldn't figure out how to mount the BSD partition. How are disks labeled in BSD? I tried looking it up on online guides, but I couldn't get anything to work. Also, what's a slice?

Here's what my partition layout (from fdisk and parted), as partitioning info is imperative when configuring boot settings.

Code:

ubuntu@ubuntu:~/Documents/firefox$ sudo fdisk /dev/sda

Command (m for help): p

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xdc9d61b2

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1              63      80324      40131    6  FAT16
/dev/sda2  *      81920    31141887    15529984    7  HPFS/NTFS/exFAT
/dev/sda3        31141888  1953521663  961189888    f  W95 Ext'd (LBA)
/dev/sda5        31143936  117159935    43008000    7  HPFS/NTFS/exFAT
/dev/sda6      117161984  143785983    13312000    7  HPFS/NTFS/exFAT
/dev/sda7      143788032  983468031  419840000    7  HPFS/NTFS/exFAT
/dev/sda8      983470080  1618350079  317440000    7  HPFS/NTFS/exFAT

Command (m for help): q

ubuntu@ubuntu:~/Documents/firefox$ sudo parted /dev/sdb
GNU Parted 2.3
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print                                                           
Model: ATA WDC WD20EZRX-00D (scsi)
Disk /dev/sdb: 2000GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt

Number  Start  End    Size    File system    Name    Flags
 1      135MB  10.9GB  10.7GB
 2      10.9GB  37.7GB  26.8GB  zfs                      msftdata
 3      37.7GB  1148GB  1111GB                          msftdata
 4      1148GB  1578GB  429GB  fat32          primary  msftdata
 6      1578GB  1631GB  53.7GB  ext4            primary  msftdata
 7      1631GB  1642GB  10.2GB
 8      1642GB  1642GB  537MB
 5      1998GB  2000GB  2067MB  linux-swap(v1)  primary  msftdata

(parted) q                                                               
ubuntu@ubuntu:~/Documents/firefox$

I've tried a tons of googles on the issues, but can't quite figure it out.

Any tips would be greatly appreciated.

astrogeek 06-16-2014 07:32 PM

Since no one else has stepped up, I'll offer what comments that I can but...

* I am new to BSD myself
* I am not a Grub user
* I have never used Gpt partitions

That said, I have recently installed FreeBSD into a multi-disk, multi-boot config with Slackware using Lilo, and I know that chain booting to the BSD (primary) partition works easily (I did not allow BSD to write to the MBR of either disk).

Although I do not know the Grub syntax, I know that Grub can chain boot just like Lilo, and can even be mixed into a Lilo environment, so you should be able to easily chain boot from your Grub MBR setup to the BSD boot partition just as I did with Lilo.

If you can still boot to Linux on the first drive, I would suggest that you get the id or uuid of the BSD disk/partition, something like this...

Code:

ls -l /dev/disk/by-id/
ls -l /dev/disk/by-uuid/

Then search for the correct Grub syntax to chain boot by disk id and you should be able to get there.

For completeness, the corresponding Lilo chain syntax is something like...

Code:

other = /dev/disk/by-uuid/xxxyyyzzz...
label = FreeBSD-10.0

When referenced by uuid it should have no difficulty identifying the partition - as long as you get the right one!

jefro 06-16-2014 09:16 PM

I tend to use bios to assist me on this sort of two drive issue.

What I do is either remove the first drive or make the second drive the first in the hard drive boot order in bios. This makes the installers and usually me not watching installers use the second drive now as destination for grub and such.

Then I return system to normal and select boot in bios or from F key.

You can try to repair your issue if you want maybe. PC-BSD can use FreeBSD loader or Grub2. If your system has grub then you may have to chain load to grub2 in different location.

wagscat123 06-16-2014 10:11 PM

Do you know how to mount zfs filesystems?

I'll try booting to the second hard disk too.

astrogeek 06-16-2014 11:09 PM

Quote:

Originally Posted by wagscat123 (Post 5189108)
Do you know how to mount zfs filesystems?

I'll try booting to the second hard disk too.

I found this site, zfs on Linux which looks like it probably has the answer, but don't know anything about zfs.... either

wagscat123 06-17-2014 11:36 PM

Thanks for the help, but now in addition to my 2nd Linux partition, the whole partition table is shot after an attempt to use the BSD bootloader from the getgo in the graphical installer. I'm pulling up testdisk on an Ubuntu Live-CDto recover my data, and ditching this Operation Barbarossa. I'll do something else with the space I would have used for BSD, and will try to run FreeBSD in VirtualBox.

astrogeek 06-17-2014 11:55 PM

Quote:

Originally Posted by wagscat123 (Post 5189651)
Thanks for the help, but now in addition to my 2nd Linux partition, the whole partition table is shot after an attempt to use the BSD bootloader from the getgo in the graphical installer. I'm pulling up testdisk on an Ubuntu Live-CDto recover my data, and ditching this Operation Barbarossa. I'll do something else with the space I would have used for BSD, and will try to run FreeBSD in VirtualBox.

Sorry to hear it, but I sympathize.

I have read back over your original post thinking a fresh look might ring some bell or other, but my unfamiliarity with all of Grub, Gpt and Zfs make me reluctant to offer any ill-founded advice!

The fact that existing partitions seem to have been corrupted is a little troubling and would make me double-check the drive itself, as in potential hardware problem. You should be able to use the smartmon tools on it from the working Linux boot.

In any event - good luck! Let us know how it works out.

wagscat123 06-18-2014 05:56 PM

Do either of you have experience with TestDisk?

astrogeek 06-18-2014 06:53 PM

Quote:

Originally Posted by wagscat123 (Post 5190222)
Do either of you have experience with TestDisk?

Again, I do not have that experience.

I have seen quite a few threads on LQ in recent months with advice and instructions for its use. From one of those I found this link to TestDisk Step by Step.

Here is one set of results for testdisk in the LQ hardware section, you might try others as well.

I know that the universal advice for a corrupted drive is to not mount it writeable - copy an image to another drive and work from the image, otherwise it degenerates into mush...

astrogeek 06-18-2014 07:23 PM

... and of course, I would suggest that you open a new thread on the subject, maybe in the hardware or software sections of LQ, to attract responses from others who know but might not visit the BSD forum.

wagscat123 06-18-2014 10:33 PM

OK - if I have any more trouble with that I'll open a new thread there. Thanks for the tips and moral support


All times are GMT -5. The time now is 02:43 AM.