BSD equivalent of GNU parted


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers BSD equivalent of GNU parted
# 1  
Old 03-15-2009
BSD equivalent of GNU parted

I use GNU (parted)set to change boot flags when doing multibooting.

Alas, FreeBSD does not have GNU parted, out of the box.

Is there a way to set/remove flags quickly and easily from the command line in BSD? I'm still learning all the 'unique' BSD utilities.
# 2  
Old 03-15-2009
There's probably a version of fdisk available.

Other than that, why not use a boot loader like grub for multi-booting instead of switching the boot-flag?
# 3  
Old 03-15-2009
re: BSD equivalent of GNU parted

> There's probably a version of fdisk available.

On my FreeBSD 7.1 system there's an fdisk in /sbin/fdisk; it's not the same as what you would find on a Linux system, but then, neither is the way one "carves up" a drive on a BSD system.

I've had good and bad experiences with just about every boot loader out there; how well a given boot loader is going to work seems to depend primarily on what OSs you're trying to boot. I personally try to avoid multi-boot systems whenever possible and use virtualization technologies whereever possible.

> Is there a way to set/remove flags quickly and easily from the command line in BSD? I'm still learning all the 'unique' BSD utilities.

Have you tried running sysinstall and using it to try and determine what utility performs what function?
# 4  
Old 03-17-2009
Thanks for the info. I will read more about BSD's fdisk.
I suspect that is what sysinstall uses. I also want to understand more about bsdlabel.

On the topic of boot loaders... I can only tell you what works for me...

How does the boot process work? Someone please correct this if this is wrong...

1. BIOS ROM reads MBR of 1st disk
2. MBR reads boot sector of active (primary) partition (the one with the boot flag)
3. Bootloader on that partition boots the OS it was designed for

You can have up to 4 partitions and hence 4 OS's specified to the MBR... these are the four 16 byte table entries often called the partition table. They're tacked onto the MBR. Selecting a partition (OS) to boot from is as easy as setting a flag (0x00 --> 0x80 at offset 0x000) in this table.

Four is more than enough OS selection for my needs

If you want to have more than that or have a need to put an OS on an extended partition (i.e. on one of the logical drives contained therein), then a "universal" bootloader like GRUB makes sense

You have to insert this (foreign) bootloader into the process, between steps 2 and 3
The MBR has to find the foreign bootloader
I do not understand exactly how that works
There is a simpler more direct way

If you are only booting a few OS's and have the disk space to create a few primary partitions, why be so indirect when booting? Make the partition you want active and let the boot process proceed as it is expected to do... by the people who develop these OS's.

Last edited by uiop44; 03-17-2009 at 06:40 PM..
# 5  
Old 03-18-2009
Quote:
Originally Posted by uiop44
[...]
How does the boot process work? Someone please correct this if this is wrong...

1. BIOS ROM reads MBR of 1st disk
2. MBR reads boot sector of active (primary) partition (the one with the boot flag)
3. Bootloader on that partition boots the OS it was designed for
[...]
Basically correct so far.
Quote:
Originally Posted by uiop44
You can have up to 4 partitions and hence 4 OS's specified to the MBR... these are the four 16 byte table entries often called the partition table. They're tacked onto the MBR. Selecting a partition (OS) to boot from is as easy as setting a flag (0x00 --> 0x80 at offset 0x000) in this table.
One correction: you can have 4 primary/extended partitons when using DOS disklabels. Each extended can have up to 4 logical partitions. BSD disklabels allow for up to 8 partitons/slices, but that would probably break Windows booting.

Quote:
Originally Posted by uiop44
[...]
You have to insert this (foreign) bootloader into the process, between steps 2 and 3
The MBR has to find the foreign bootloader
I do not understand exactly how that works
[...]
When you install the bootloader (eg GRUB) into the partitions boot section, then yes, the MBR has to find the bootloader. If you install it into the MBR, however, it's this (simplified) scheme
  1. Load the bootloader (GRUB/LILO/...)
  2. Select the OS you want to boot & that the bootloader knows about
  3. The bootloader then loads the usual startup code from the partitions bootsector
GRUB has the added bonus that it knows about filesystems and can read it's configuration from there, meaning you can modify and use it without having to reinstall the bootloader (as was the case with LILO).

Quote:
Originally Posted by uiop44
There is a simpler more direct way

If you are only booting a few OS's and have the disk space to create a few primary partitions, why be so indirect when booting? Make the partition you want active and let the boot process proceed as it is expected to do... by the people who develop these OS's.
Bootloaders usually don't interfere with this. As soon as the user made his/her selection, control is handed back to the OS for the booting process. Said OS isn't even aware that there was a bootloader involved.
# 6  
Old 03-18-2009
Thanks for the explanation. I have a question. You said:

When you install the bootloader (eg GRUB) into the partitions boot section, then yes, the MBR has to find the bootloader. If you install it into the MBR, however, it's this (simplified) scheme
  1. Load the bootloader (GRUB/LILO/...)
  2. Select the OS you want to boot & that the bootloader knows about
  3. The bootloader then loads the usual startup code from the partitions bootsector

How does GRUB "install itself into" the MBR?
Do you mean it replaces the existing MBR with it's own implementation? If I understand correctly MBR's are not all the same. Different OS may write it differently. And if I reinstall the OS on my first partition, and it's e.g. Windows, it's going to write its own version of an MBR, correct?

This is good IMO if GRUB gets into the boot prcess at the "MBR stage".

Because, as you say, and as I read in an old Microsoft technet article, at this stage the OS is unaware. It cannot cause problems.

Controlling the choice of OS at the "MBR stage" (i.e. not trying to use an OS's bootloader to boot other OS's) is I think a key to avoiding troubles with multi-booting. And that's why I do it by changing the boot flags.

I need more technical doc on GRUB. The manual over at GNU is being rewritten I guess and is "unifinished".

I have this feeling that what I'm doing with the boot flags is not much different than what GRUB does, except GRUB offers a "boot time menu": it can identify filesystems by their respective ID flags and it changes the boot flags DURING reboot; whereas I'm choosing my next OS choice BEFORE I reboot. In other words, GRUB is also a partition identifier and MBR editor just like the tools I'm using, it's just doing the editing at a different time.
# 7  
Old 03-18-2009
Quote:
Originally Posted by uiop44
How does GRUB "install itself into" the MBR?
Do you mean it replaces the existing MBR with it's own implementation?
Yes.
Quote:
If I understand correctly MBR's are not all the same. Different OS may write it differently. And if I reinstall the OS on my first partition, and it's e.g. Windows, it's going to write its own version of an MBR, correct?
Right.
Quote:
I need more technical doc on GRUB. The manual over at GNU is being rewritten I guess and is "unifinished".
A few things, then..

GRUB is, for a bootloader, very large and complex. Most of the program is not in the boot sector, but in ordinary files stored on a partition in the system. When GRUB boots, the code in the boot sector will find and load the rest of the program, which loads a config file, which instructs it what menu options to display. It can do things like load other bootloaders -- necessary for things like MS Windows -- or make the relevant partition look active before booting something.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

GNU & BSD Makefile Directives & Conditions Compatibility

Firstly, I would like to apologize if this is not the appropriate sub-forum to post about GNU/BSD makefile scripting. Though my code is in C++, because I am focusing on the makefile I thought it would go better in shell scripting. Please correct me if I am wrong. Secondly, I am not interested in... (0 Replies)
Discussion started by: AntumDeluge
0 Replies

2. Linux

Date from GNU to BSD

Dear all, This should be simple but I cannot figure it out despite reading all the man pages. Could someone please help me translate this code (GNU date) to one that can be read by BSD date?: myDate=$(date -d "$h -$l days" +%Y/%m/%d), where h is a variable of the form DD/MM/YYYY, and l is... (3 Replies)
Discussion started by: thomchad
3 Replies

3. Shell Programming and Scripting

AIX equivalent to GNU grep's -B and -A [print lines after or before matching lines]

Hi folks I am not allowed to install GNU grep on AIX. Here my code excerpt: grep_fatal () { /usr/sfw/bin/gegrep -B4 -A2 "FATAL|QUEUE|SIGHUP" } Howto the same on AIX based machine? from manual GNU grep ‘--after-context=num’ Print num lines of trailing context after... (4 Replies)
Discussion started by: slashdotweenie
4 Replies

4. BSD

BSD equivalent of rmmod

In Linux if you want to get rid of the PC speaker (beep!) without rebooting you can type rmmod pcspkr I'm looking for a way to remove (if possible) the BSD equivalent of the "pcspkr" module. I scrolled quickly through GENERIC and didn't see any entries that looked conspicuously like the... (2 Replies)
Discussion started by: uiop44
2 Replies

5. BSD

Anyone using GNU BSD?

Is anyone using or planning to use GNU BSD in production yet? I'd like to hear experiences. (Debian GNU/NetBSD) (8 Replies)
Discussion started by: vpsville
8 Replies

6. UNIX for Dummies Questions & Answers

I've created a partition with GNU Parted, how do I mount the partition?

I've created a partition with GNU Parted, how do I mount the partition? The manual information at http://www.gnu.org/software/parted/manual/parted.html is good, but I am sure about how I mount the partition afterwards. Thanks, --Todd (1 Reply)
Discussion started by: jtp51
1 Replies

7. BSD

for linux and BSD users interested in Unix system V/bsd

for all you unix/linux interested heres an online book for free that covers the basics of BSD SysV Unix commands and applications . giving the average linux user a perspective on the differences in context of the two operating systems and for BSD users covers material as a refernce guide. ... (0 Replies)
Discussion started by: moxxx68
0 Replies
Login or Register to Ask a Question