Discussion:
[gentoo-user] Grub, gpt partitions and BIOS, not uefi thing.
(too old to reply)
Wojciech Kuzyszyn
2024-04-27 17:00:01 UTC
Permalink
On Sat, 27 Apr 2024 11:53:25 -0500
Howdy,
I'm installing Gentoo on another old box.  To be consistent I like to
use cgdisk, GPT I think it is called, to partition all my drives,
regardless of size.  Thing is, Grub works differently with GPT than it
does with the old DOS or whatever it is called, like fdisk does in the
old days.  I did some research but still find myself in some muddy
waters.  My take on some things I've read, I need a boot partition,
not to be confused with the /boot for kernels, init thingys and such.
Where I get lost, most use gdisk.  I like cgdisk.  Before that I
liked cfdisk.  Anyway, how do I set up that partition with cgdisk?
Any minimum size requirements or tiny is enough?  Does it have to be a
specific type?  Does it need to be in a specific place?  Formatted
with a file system?  Also, when I do grub-install, do I still point to
/dev/sda or to /dev/sda1, if sda1 is the special boot partition?
I tried to find a step by step howto with this info but the ones I
find either don't work or leaves me more confused.  Given that the
method is also aging out, it's hard to find good guides.  I'd be real
happy just to have a link to a good howto that I can make sense of.
I can save a copy local and even print it.  Maybe someone has some
notes that will help.  I just need something to help clear up the
muddy waters. 
Thanks to anyone who has a link, some notes or something.  :-D 
Dale
:-)  :-) 
I don't use cgdisk nor gdisk. Here's a link to Arch's wiki about GPT on
BIOS systems:

https://wiki.archlinux.org/title/GRUB#GUID_Partition_Table_(GPT)_specific_instructions

I guess you need to set the same code as in gdisk, or something similar
to BIOS boot or bios_grub as are in other such tools.

Good luck!

Wojciech
--
xWK
Mark Knecht
2024-04-27 17:50:01 UTC
Permalink
Howdy,
I'm installing Gentoo on another old box. To be consistent I like to
use cgdisk, GPT I think it is called, to partition all my drives,
regardless of size. Thing is, Grub works differently with GPT than it
does with the old DOS or whatever it is called, like fdisk does in the
old days. I did some research but still find myself in some muddy
waters. My take on some things I've read, I need a boot partition, not
to be confused with the /boot for kernels, init thingys and such. Where
I get lost, most use gdisk. I like cgdisk. Before that I liked
cfdisk. Anyway, how do I set up that partition with cgdisk? Any
minimum size requirements or tiny is enough? Does it have to be a
specific type? Does it need to be in a specific place? Formatted with
a file system? Also, when I do grub-install, do I still point to
/dev/sda or to /dev/sda1, if sda1 is the special boot partition?
I tried to find a step by step howto with this info but the ones I find
either don't work or leaves me more confused. Given that the method is
also aging out, it's hard to find good guides. I'd be real happy just
to have a link to a good howto that I can make sense of. I can save a
copy local and even print it. Maybe someone has some notes that will
help. I just need something to help clear up the muddy waters.
Thanks to anyone who has a link, some notes or something. :-D
Dale
:-) :-)
I think I'm not really understanding your request because I only
remember fdisk from the old days, and none of your cfdisk and
cgdisk apps.

If you're working with disk in your new old-box machine then
I'd suggest trying gparted as it pretty much does everything
I've ever needed. It's minimally graphical, can changes the
partition type and boot flags.

This is just one of a billion pages you might look at:

https://linuxiac.com/how-to-use-gparted-to-create-and-resize-partitions/

Wishing you the best of luck,
Mark
Michael
2024-04-27 18:40:01 UTC
Permalink
Howdy,
I'm installing Gentoo on another old box. To be consistent I like to
use cgdisk, GPT I think it is called, to partition all my drives,
regardless of size.
GPT is the partition table structure, which is more advanced than the old DOS
partition table structure.
Thing is, Grub works differently with GPT than it
does with the old DOS or whatever it is called, like fdisk does in the
old days.
GRUB works the same, but the disk/partition table structure is different.
I did some research but still find myself in some muddy
waters. My take on some things I've read, I need a boot partition, not
to be confused with the /boot for kernels, init thingys and such. Where
I get lost, most use gdisk. I like cgdisk. Before that I liked
cfdisk. Anyway, how do I set up that partition with cgdisk? Any
minimum size requirements or tiny is enough?
1MB
Does it have to be a
specific type?
Yes, it has to be set up as a "BIOS Boot Partition", with the "ef02", or GUID
21686148-6449-6E6F-744E-656564454649.
Does it need to be in a specific place?
Not necessarily, but since you're not booting this disk on a UEFI MoBo and
consequently won't be using an EFI System Partition (ESP), the very first
partition is fine and will be out of the way of the remaining disk.
Formatted with a file system?
Do not format it. The raw 1MB partition will be used by GRUB to install its
core.img file.
Also, when I do grub-install, do I still point to
/dev/sda or to /dev/sda1, if sda1 is the special boot partition?
Sector 0 of your disk /dev/sda is where GRUB will drop its boot loader image
'boot.img'. This is the Master Boot Record region.

Normally, with a DOS partition table, GRUB's core.img would be dropped in the
empty space of sector 1, following sector 0. However, in the GPT structure
sector 1 is where the GPT partition array data is stored. You don't want GRUB
making a mess by dropping it's core.img on top of it!

So, from what I recall you'd install GRUB like so:

grub-install --boot-directory=/mnt/gentoo/boot --force /dev/sda

If this won't do it, I'll have to boot an old system of mine to check the disk
layout in more detail.
I tried to find a step by step howto with this info but the ones I find
either don't work or leaves me more confused. Given that the method is
also aging out, it's hard to find good guides. I'd be real happy just
to have a link to a good howto that I can make sense of. I can save a
copy local and even print it. Maybe someone has some notes that will
help. I just need something to help clear up the muddy waters.
Thanks to anyone who has a link, some notes or something. :-D
Dale
:-) :-)
Dale
2024-04-28 05:30:01 UTC
Permalink
Post by Michael
Howdy,
I'm installing Gentoo on another old box. To be consistent I like to
use cgdisk, GPT I think it is called, to partition all my drives,
regardless of size.
GPT is the partition table structure, which is more advanced than the old DOS
partition table structure.
I just wasn't 100% sure what it was called. 
Post by Michael
Thing is, Grub works differently with GPT than it
does with the old DOS or whatever it is called, like fdisk does in the
old days.
GRUB works the same, but the disk/partition table structure is different.
I did some research but still find myself in some muddy
waters. My take on some things I've read, I need a boot partition, not
to be confused with the /boot for kernels, init thingys and such. Where
I get lost, most use gdisk. I like cgdisk. Before that I liked
cfdisk. Anyway, how do I set up that partition with cgdisk? Any
minimum size requirements or tiny is enough?
1MB
OK.  You know that "alignment" thing that is always on the beginning of
a drive, could it use it?  I think it is like 2MBs or something. 
Post by Michael
Does it have to be a
specific type?
Yes, it has to be set up as a "BIOS Boot Partition", with the "ef02", or GUID
21686148-6449-6E6F-744E-656564454649.
Light bulb moment.  I've seen 8300 and friends, 8200 etc but never seen
EF02 before.  Now I see what that type means.  That cleared up some
muddy water.  That lead me to finding this, it has a nice table of
common codes. 

https://wiki.archlinux.org/title/GPT_fdisk
Post by Michael
Does it need to be in a specific place?
Not necessarily, but since you're not booting this disk on a UEFI MoBo and
consequently won't be using an EFI System Partition (ESP), the very first
partition is fine and will be out of the way of the remaining disk.
Formatted with a file system?
Do not format it. The raw 1MB partition will be used by GRUB to install its
core.img file.
Also, when I do grub-install, do I still point to
/dev/sda or to /dev/sda1, if sda1 is the special boot partition?
Sector 0 of your disk /dev/sda is where GRUB will drop its boot loader image
'boot.img'. This is the Master Boot Record region.
Normally, with a DOS partition table, GRUB's core.img would be dropped in the
empty space of sector 1, following sector 0. However, in the GPT structure
sector 1 is where the GPT partition array data is stored. You don't want GRUB
making a mess by dropping it's core.img on top of it!
grub-install --boot-directory=/mnt/gentoo/boot --force /dev/sda
If this won't do it, I'll have to boot an old system of mine to check the disk
layout in more detail.
I may look on youtube and see if I can find someone setting up a disk. 
It may have a video, old one for sure.  Maybe that will help me make
sense of it even more.  I think I got figured out how to use cgdisk now
but installing grub may require some more details. 

What I find odd, most of the howtos I found don't show example outputs. 
Then again, it could just work.  O_o

Thanks to all. 

Dale

:-)  :-)
Michael
2024-04-28 09:20:02 UTC
Permalink
[snip ...]
Post by Michael
I did some research but still find myself in some muddy
waters. My take on some things I've read, I need a boot partition, not
to be confused with the /boot for kernels, init thingys and such. Where
I get lost, most use gdisk. I like cgdisk. Before that I liked
cfdisk. Anyway, how do I set up that partition with cgdisk? Any
minimum size requirements or tiny is enough?
1MB
OK. You know that "alignment" thing that is always on the beginning of
a drive, could it use it? I think it is like 2MBs or something.
It should be 1MB, sector 2048. For 512 byte sector size you'd get:

2048 x 512 = 1,048,576 bytes

This is coded in on modern partitioning tools to ensure alignment of logical
and physical sectors by default. This alignment is critical for the
performance of so called "Advanced Format" disks with 4096 byte size of
physical sectors. Therefore I strongly suggest you let the partitioning tool
align its logical partitions where it feels best - at the 1MB boundary and not
change it.

HOWEVER ...

If you are partitioning an old disk on a BIOS MoBo with logical/physical
sector sizes both at 512/512 bytes, then you can take matters into your own
hands and force it to start your 'BIOS Boot Partition' at sector 34. Sectors
0-33 are used by the MBR and the GPT headers, so leave these alone.

Start sector 34
End sector 2047
Post by Michael
Does it have to be a
specific type?
Yes, it has to be set up as a "BIOS Boot Partition", with the "ef02", or
GUID 21686148-6449-6E6F-744E-656564454649.
Light bulb moment. I've seen 8300 and friends, 8200 etc but never seen
EF02 before. Now I see what that type means. That cleared up some
muddy water. That lead me to finding this, it has a nice table of
common codes.
https://wiki.archlinux.org/title/GPT_fdisk
If you select [Type] in cgdisk and then press "L" it will list all the
partition types available.

I suggest you familiarise yourself with gdisk, which has more options, or as
already suggested GParted has an easy GUI to navigate through.
Grant Edwards
2024-04-28 17:20:01 UTC
Permalink
Post by Michael
Howdy,
I'm installing Gentoo on another old box. To be consistent I like
to use cgdisk, GPT I think it is called, to partition all my
drives, regardless of size.
GPT is the partition table structure, which is more advanced than
the old DOS partition table structure.
Thing is, Grub works differently with GPT than it does with the old
DOS or whatever it is called, like fdisk does in the old days.
GRUB works the same, but the disk/partition table structure is different.
No, grub doesn't work the with GPT disk labels as it did with DOS disk
labels.

With DOS disk lables, Grub uses empty space between the boot sector
and the first partition as a location to store it's core image file.
That empty space does not exist when using GPT disk label. When using
a GPT disk label, Grub requires that you need to create a "BIOS Boot"
or "Grub Boot" partition so that Grub has somwhere to store it's core
image[1].

https://wiki.gentoo.org/wiki/GRUB#BIOS_with_GPT
https://wiki.archlinux.org/title/GRUB#BIOS_systems


[1] There is an alternative installation method where Grub will record
the disk block numbers occupied by the core image files as they
reside in the normal filesystem. That's extra work to maintain
and might not be reliable for some filesystem types, so it's not
recommended.
Grant Edwards
2024-04-28 17:50:01 UTC
Permalink
Post by Grant Edwards
With DOS disk lables, Grub uses empty space between the boot sector
and the first partition as a location to store it's core image file.
That empty space does not exist when using GPT disk label. When using
a GPT disk label, Grub requires that you need to create a "BIOS Boot"
or "Grub Boot" partition so that Grub has somwhere to store it's core
image[1].
And it bears repeating that the bios/grub boot partition only needs to
be 1 or 2MB in size, is _not_ formatted with a filesystem, and is
_not_ the same as either

1) The "boot" directory where the kernel images and grubs other files
are installed within a Linux filesystem. [Which you still need
when booting in Legacy/BIOS mode.]

or

2) The UEFI partition that's formated with a FAT filesystem and used
in UEFI boot mode [which you don't need when booting in
Legacy/BIOS mode.]
Dale
2024-04-28 18:40:01 UTC
Permalink
Post by Grant Edwards
Post by Grant Edwards
With DOS disk lables, Grub uses empty space between the boot sector
and the first partition as a location to store it's core image file.
That empty space does not exist when using GPT disk label. When using
a GPT disk label, Grub requires that you need to create a "BIOS Boot"
or "Grub Boot" partition so that Grub has somwhere to store it's core
image[1].
And it bears repeating that the bios/grub boot partition only needs to
be 1 or 2MB in size, is _not_ formatted with a filesystem, and is
_not_ the same as either
1) The "boot" directory where the kernel images and grubs other files
are installed within a Linux filesystem. [Which you still need
when booting in Legacy/BIOS mode.]
or
2) The UEFI partition that's formated with a FAT filesystem and used
in UEFI boot mode [which you don't need when booting in
Legacy/BIOS mode.]
I think I got a grasp on this now.  Basically, partitions should be like
this. 


First spot is the alignment thing.  Usually a few MBs or so and unused.

Grub boot partition with ef02 setting, not to be formatted.

/boot partition for kernel and init thingy.  Usually 1GB or so, enough
for memtest, bootable rescue image etc. 

/ or root partition that is around 150GBs or so.  Enough to expand a bit
and includes /usr and /var.

/home  rest of disk unless some needed for something else.


Do you recall when running grub-install what that command looks like? 
Lets say the Grub partition with ef02 setting is sda1, would it be
grub-install /dev/sda1 or just sda and it finds the empty partition on
its own?  That's the only thing I'm not real sure of at this point.  I
think it is sda.  Maybe. ;-)

Or is all that above just plain wrong?  O-o 

Dale

:-)  :-) 

P. S.  Been on tractor with a box blade.  Did three very long driveways
and a couple short ones.  My neighbors have smooth driveways again.  :-D 
Michael
2024-04-28 20:40:01 UTC
Permalink
Post by Grant Edwards
Post by Grant Edwards
With DOS disk lables, Grub uses empty space between the boot sector
and the first partition as a location to store it's core image file.
That empty space does not exist when using GPT disk label. When using
a GPT disk label, Grub requires that you need to create a "BIOS Boot"
or "Grub Boot" partition so that Grub has somwhere to store it's core
image[1].
And it bears repeating that the bios/grub boot partition only needs to
be 1 or 2MB in size, is _not_ formatted with a filesystem, and is
_not_ the same as either
1) The "boot" directory where the kernel images and grubs other files
are installed within a Linux filesystem. [Which you still need
when booting in Legacy/BIOS mode.]
or
2) The UEFI partition that's formated with a FAT filesystem and used
in UEFI boot mode [which you don't need when booting in
Legacy/BIOS mode.]
I think I got a grasp on this now. Basically, partitions should be like
this.
First spot is the alignment thing. Usually a few MBs or so and unused.
This is created automatically by the partitioning tool, in your case cgdisk,
when you create the first partition on the disk and accept the default
starting sector.
Grub boot partition with ef02 setting, not to be formatted.
/boot partition for kernel and init thingy. Usually 1GB or so, enough
for memtest, bootable rescue image etc.
/ or root partition that is around 150GBs or so. Enough to expand a bit
and includes /usr and /var.
/home rest of disk unless some needed for something else.
Do you recall when running grub-install what that command looks like?
Lets say the Grub partition with ef02 setting is sda1, would it be
grub-install /dev/sda1 or just sda and it finds the empty partition on
its own?
The unformatted and empty /dev/sda1 'BIOS Boot Partition' will be found by
GRUB when you run grub-install and it will store its core.img in there.

You install GRUB's boot.img in the MBR and therefore you have to specify the
disk, NOT a partition, e.g.:

grub-install /dev/sda

This command should:

1. Install GRUB's boot.img in the MBR of /dev/sda.
2. Install GRUB's core.img in /dev/sda1 which you created as a 'BIOS boot
partition', type EF02.
3. Create directory /boot/grub to install all the grub fs drivers and files.

If you have mounted /boot, all is well. If you are repairing an installation
from a liveUSB you can mount the /boot partition, e.g. /mnt/gentoo/boot and
specify this in the CLI:

grub-install --boot-directory=/mnt/gentoo/boot /dev/sda

NOTE: As per the link Grant helpfully posted you can create the 'BIOS boot
partition' with cgdisk "... by setting the partition type to 0xEF02 and giving
it a label of gptbios".

https://wiki.gentoo.org/wiki/GRUB#BIOS_with_GPT
Dale
2024-04-28 21:10:01 UTC
Permalink
Post by Michael
Post by Grant Edwards
Post by Grant Edwards
With DOS disk lables, Grub uses empty space between the boot sector
and the first partition as a location to store it's core image file.
That empty space does not exist when using GPT disk label. When using
a GPT disk label, Grub requires that you need to create a "BIOS Boot"
or "Grub Boot" partition so that Grub has somwhere to store it's core
image[1].
And it bears repeating that the bios/grub boot partition only needs to
be 1 or 2MB in size, is _not_ formatted with a filesystem, and is
_not_ the same as either
1) The "boot" directory where the kernel images and grubs other files
are installed within a Linux filesystem. [Which you still need
when booting in Legacy/BIOS mode.]
or
2) The UEFI partition that's formated with a FAT filesystem and used
in UEFI boot mode [which you don't need when booting in
Legacy/BIOS mode.]
I think I got a grasp on this now. Basically, partitions should be like
this.
First spot is the alignment thing. Usually a few MBs or so and unused.
This is created automatically by the partitioning tool, in your case cgdisk,
when you create the first partition on the disk and accept the default
starting sector.
Grub boot partition with ef02 setting, not to be formatted.
/boot partition for kernel and init thingy. Usually 1GB or so, enough
for memtest, bootable rescue image etc.
/ or root partition that is around 150GBs or so. Enough to expand a bit
and includes /usr and /var.
/home rest of disk unless some needed for something else.
Do you recall when running grub-install what that command looks like?
Lets say the Grub partition with ef02 setting is sda1, would it be
grub-install /dev/sda1 or just sda and it finds the empty partition on
its own?
The unformatted and empty /dev/sda1 'BIOS Boot Partition' will be found by
GRUB when you run grub-install and it will store its core.img in there.
You install GRUB's boot.img in the MBR and therefore you have to specify the
grub-install /dev/sda
1. Install GRUB's boot.img in the MBR of /dev/sda.
2. Install GRUB's core.img in /dev/sda1 which you created as a 'BIOS boot
partition', type EF02.
3. Create directory /boot/grub to install all the grub fs drivers and files.
If you have mounted /boot, all is well. If you are repairing an installation
from a liveUSB you can mount the /boot partition, e.g. /mnt/gentoo/boot and
grub-install --boot-directory=/mnt/gentoo/boot /dev/sda
NOTE: As per the link Grant helpfully posted you can create the 'BIOS boot
partition' with cgdisk "... by setting the partition type to 0xEF02 and giving
it a label of gptbios".
https://wiki.gentoo.org/wiki/GRUB#BIOS_with_GPT
That's what I was thinking.  I think I got it.  I need to make notes of
this tho.  Before I forget.  :/ 

Thanks to all.

Dale

:-)  :-) 
Dale
2024-04-28 21:40:02 UTC
Permalink
Post by Dale
Post by Michael
Post by Grant Edwards
Post by Grant Edwards
With DOS disk lables, Grub uses empty space between the boot sector
and the first partition as a location to store it's core image file.
That empty space does not exist when using GPT disk label. When using
a GPT disk label, Grub requires that you need to create a "BIOS Boot"
or "Grub Boot" partition so that Grub has somwhere to store it's core
image[1].
And it bears repeating that the bios/grub boot partition only needs to
be 1 or 2MB in size, is _not_ formatted with a filesystem, and is
_not_ the same as either
1) The "boot" directory where the kernel images and grubs other files
are installed within a Linux filesystem. [Which you still need
when booting in Legacy/BIOS mode.]
or
2) The UEFI partition that's formated with a FAT filesystem and used
in UEFI boot mode [which you don't need when booting in
Legacy/BIOS mode.]
I think I got a grasp on this now. Basically, partitions should be like
this.
First spot is the alignment thing. Usually a few MBs or so and unused.
This is created automatically by the partitioning tool, in your case cgdisk,
when you create the first partition on the disk and accept the default
starting sector.
Grub boot partition with ef02 setting, not to be formatted.
/boot partition for kernel and init thingy. Usually 1GB or so, enough
for memtest, bootable rescue image etc.
/ or root partition that is around 150GBs or so. Enough to expand a bit
and includes /usr and /var.
/home rest of disk unless some needed for something else.
Do you recall when running grub-install what that command looks like?
Lets say the Grub partition with ef02 setting is sda1, would it be
grub-install /dev/sda1 or just sda and it finds the empty partition on
its own?
The unformatted and empty /dev/sda1 'BIOS Boot Partition' will be found by
GRUB when you run grub-install and it will store its core.img in there.
You install GRUB's boot.img in the MBR and therefore you have to specify the
grub-install /dev/sda
1. Install GRUB's boot.img in the MBR of /dev/sda.
2. Install GRUB's core.img in /dev/sda1 which you created as a 'BIOS boot
partition', type EF02.
3. Create directory /boot/grub to install all the grub fs drivers and files.
If you have mounted /boot, all is well. If you are repairing an installation
from a liveUSB you can mount the /boot partition, e.g. /mnt/gentoo/boot and
grub-install --boot-directory=/mnt/gentoo/boot /dev/sda
NOTE: As per the link Grant helpfully posted you can create the 'BIOS boot
partition' with cgdisk "... by setting the partition type to 0xEF02 and giving
it a label of gptbios".
https://wiki.gentoo.org/wiki/GRUB#BIOS_with_GPT
That's what I was thinking.  I think I got it.  I need to make notes of
this tho.  Before I forget.  :/ 
Thanks to all.
Dale
:-)  :-) 
One last update.  I found a video.  They were using gdisk but the
crucial part, he got it to display the partition layout.  It was like I
described as for as the alignment thing, tiny partition with ef02 and
then carry on as usual from there. 

I need to do this on a disk complete with notes, so I don't forget.  My
brain is going fast.  One day, I'll forget how to turn the puter on. 
:'(  I already forget what I went to the kitchen for, it's only 20 feet
away.  :/

Thanks again. 

Dale

:-)  :-)
Dale
2024-05-01 19:40:02 UTC
Permalink
Post by Dale
One last update.  I found a video.  They were using gdisk but the
crucial part, he got it to display the partition layout.  It was like I
described as for as the alignment thing, tiny partition with ef02 and
then carry on as usual from there. 
I need to do this on a disk complete with notes, so I don't forget.  My
brain is going fast.  One day, I'll forget how to turn the puter on. 
:'(  I already forget what I went to the kitchen for, it's only 20 feet
away.  :/
Thanks again. 
Dale
:-)  :-)
OK.  One last update in case someone googles and runs up on this
thread.  I'm using gdisk to display this, because I think it will do
better in email.  If I use cgdisk, it is wider and will wrap more.  This
is what the partition table looks like for GPT, old BIOS and no uefi
thingy.  Just a straight forward and simple old school setup.  Once the
first one is done, the rest can be anything.


Number  Start (sector)    End (sector)  Size       Code     Name
   1            2048             10239          4.0 MiB     EF02  BIOS-boot
   2           10240            4204543      2.0 GiB     8300  boot
   3         4204544          12593151    4.0 GiB     8300  swap
   4        12593152        327165951   150.0 GiB   8300  root
   5       327165952       625141759   142.1 GiB   8300  home


I'm about to start a fresh install on this so if it isn't right, let me
know soon.  I did make it a little larger than everyone says it needs to
be since grub does seem to grow.  That should be bigger than I'll ever
need in the lifetime of this old rig anyway. 

Dale

:-)  :-) 
Grant Edwards
2024-05-01 20:10:01 UTC
Permalink
Post by Dale
OK.  One last update in case someone googles and runs up on this
thread.  I'm using gdisk to display this, because I think it will do
better in email.  If I use cgdisk, it is wider and will wrap more. 
This is what the partition table looks like for GPT, old BIOS and no
uefi thingy.  Just a straight forward and simple old school setup. 
Once the first one is done, the rest can be anything.
Number  Start (sector)    End (sector)  Size       Code     Name
   1            2048             10239          4.0 MiB     EF02  BIOS-boot
   2           10240            4204543      2.0 GiB     8300  boot
   3         4204544          12593151    4.0 GiB     8300  swap
   4        12593152        327165951   150.0 GiB   8300  root
   5       327165952       625141759   142.1 GiB   8300  home
The partition type code for 'swap' is wrong -- it should be
8200. According to the gdisk help info Linux /home is supposed to be
8302, but I've always used the same generic "Linux filesystem" type
for both /home and root.

Is the 'boot' partition for future possible UEFI use, for Linux /boot,
or both? [I've never used a separate partition for Linux /boot, I
just use a /boot directory on the root FS.]

--
Grant
Dale
2024-05-01 20:30:01 UTC
Permalink
Post by Grant Edwards
Post by Dale
OK.  One last update in case someone googles and runs up on this
thread.  I'm using gdisk to display this, because I think it will do
better in email.  If I use cgdisk, it is wider and will wrap more. 
This is what the partition table looks like for GPT, old BIOS and no
uefi thingy.  Just a straight forward and simple old school setup. 
Once the first one is done, the rest can be anything.
Number  Start (sector)    End (sector)  Size       Code     Name
   1            2048             10239          4.0 MiB     EF02  BIOS-boot
   2           10240            4204543      2.0 GiB     8300  boot
   3         4204544          12593151    4.0 GiB     8300  swap
   4        12593152        327165951   150.0 GiB   8300  root
   5       327165952       625141759   142.1 GiB   8300  home
The partition type code for 'swap' is wrong -- it should be
8200. According to the gdisk help info Linux /home is supposed to be
8302, but I've always used the same generic "Linux filesystem" type
for both /home and root.
Is the 'boot' partition for future possible UEFI use, for Linux /boot,
or both? [I've never used a separate partition for Linux /boot, I
just use a /boot directory on the root FS.]
--
Grant
I noticed the other day that some new ones was added.  I always leave it
as 8300 and it works.  It even works for swap.  I dunno. 

The /boot is where kernels and init thingys go.  Keep in mind, this is
on a old rig that has no idea what UEFI is.  When I build my new rig
later, I'll do a install from scratch anyway.  Also, it will go on a SSD. 

I mostly want to post so that a person can see the layout.  Really, the
first one is what a person wanting to use GPT on a old BIOS system needs
to see.  After that, they can do partitions anyway they want.  I just
hope I got it right.  Right now, I'm to the stage where I do a emerge
-auDN world.  On that old rig, may take a little bit.  It's not bad
tho.  Old rig has 6 cores now. 

Dale

:-)  :-) 
Grant Edwards
2024-05-01 20:30:01 UTC
Permalink
Post by Dale
Post by Grant Edwards
The partition type code for 'swap' is wrong -- it should be
8200. According to the gdisk help info Linux /home is supposed to be
8302, but I've always used the same generic "Linux filesystem" type
for both /home and root.
Is the 'boot' partition for future possible UEFI use, for Linux /boot,
or both? [I've never used a separate partition for Linux /boot, I
just use a /boot directory on the root FS.]
I noticed the other day that some new ones was added.  I always leave it
as 8300 and it works.  It even works for swap.  I dunno. 
If you have an entry in /etc/fstab for swap, it might not matter if
the partition type is set to 'Linux swap' or not. I always set the
swap parition type to 'Linux swap', and then it doesn't seem to matter
if there's a swap entry in the fstab or not.
Post by Dale
The /boot is where kernels and init thingys go.  Keep in mind, this is
on a old rig that has no idea what UEFI is.  When I build my new rig
later, I'll do a install from scratch anyway.  Also, it will go on a SSD. 
OK, so 'boot' is for the Linux /boot directory. I was just curious
since I had never used one.
Post by Dale
I mostly want to post so that a person can see the layout.  Really, the
first one is what a person wanting to use GPT on a old BIOS system needs
to see.  After that, they can do partitions anyway they want.
Right.
Michael
2024-05-02 09:40:01 UTC
Permalink
Post by Grant Edwards
The partition type code for 'swap' is wrong -- it should be
8200. According to the gdisk help info Linux /home is supposed to be
8302, but I've always used the same generic "Linux filesystem" type
for both /home and root.
Is the 'boot' partition for future possible UEFI use, for Linux /boot,
or both? [I've never used a separate partition for Linux /boot, I
just use a /boot directory on the root FS.]
I noticed the other day that some new ones was added. I always leave it
as 8300 and it works. It even works for swap. I dunno.
In the legacy DOS partition tables the space available was limited to 32 bits,
while the GPT table specification provides 128 bytes for each block entry.
The extra space can be used to store information related to the intended OS
usage of each partition, by adding the corresponding Partition Type UUID.

This has a number of benefits, described here:

https://uapi-group.org/specifications/specs/
discoverable_partitions_specification/

Besides the automation this feature affords, I find it useful to know what a
partition contains without having to mount it. On GPT labelled disks I make
use both of the Partition Type UUID and the Partition Name. A quick glance at
the gdisk output and if need be its 'i' option has saved my day from
formatting the wrong partition more than once! ;-)
Dale
2024-05-02 10:50:01 UTC
Permalink
Post by Michael
Post by Grant Edwards
The partition type code for 'swap' is wrong -- it should be
8200. According to the gdisk help info Linux /home is supposed to be
8302, but I've always used the same generic "Linux filesystem" type
for both /home and root.
Is the 'boot' partition for future possible UEFI use, for Linux /boot,
or both? [I've never used a separate partition for Linux /boot, I
just use a /boot directory on the root FS.]
I noticed the other day that some new ones was added. I always leave it
as 8300 and it works. It even works for swap. I dunno.
In the legacy DOS partition tables the space available was limited to 32 bits,
while the GPT table specification provides 128 bytes for each block entry.
The extra space can be used to store information related to the intended OS
usage of each partition, by adding the corresponding Partition Type UUID.
https://uapi-group.org/specifications/specs/
discoverable_partitions_specification/
Besides the automation this feature affords, I find it useful to know what a
partition contains without having to mount it. On GPT labelled disks I make
use both of the Partition Type UUID and the Partition Name. A quick glance at
the gdisk output and if need be its 'i' option has saved my day from
formatting the wrong partition more than once! ;-)
I always use labels which show up with cgdisk.  If I'm unsure how I
partitioned a drive for some reason, I just check it with cgdisk to see
what is what.  I use labels even tho a lot of the time I put UUIDs in
fstab.  I do similar when using LVM as well. 

There is more than one way to organize things tho.  ;-) 

Dale

:-)  :-) 
Peter Humphrey
2024-05-02 10:50:01 UTC
Permalink
Post by Grant Edwards
OK, so 'boot' is for the Linux /boot directory. I was just curious
since I had never used one.
When I started using Linux, the received wisdom was to keep a separate /boot,
and leave it unmounted during normal operation. The idea was that a successful
hacker would not, supposedly, be able to corrupt the kernel ready for a reboot
into their system.

Old habits die hard, though, and besides, a separate /boot has been handy in
the copious reinstallations I've been through.
I've used one ever since I started using Linux and it's as much habit as
anything. Given the size of drives nowadays, I have started putting
/usr and /var on the root partition. When I build my new rig tho, odds
are /var will be on its own partition. That way if a log file goes
wonky, it can fill it up and not really do any harm.
I do that too. It also helps with backups and new installations.
--
Regards,
Peter.
Wol
2024-04-28 22:50:01 UTC
Permalink
Post by Grant Edwards
Post by Grant Edwards
With DOS disk lables, Grub uses empty space between the boot sector
and the first partition as a location to store it's core image file.
That empty space does not exist when using GPT disk label. When using
a GPT disk label, Grub requires that you need to create a "BIOS Boot"
or "Grub Boot" partition so that Grub has somwhere to store it's core
image[1].
And it bears repeating that the bios/grub boot partition only needs to
be 1 or 2MB in size, is _not_ formatted with a filesystem, and is
_not_ the same as either
1) The "boot" directory where the kernel images and grubs other files
are installed within a Linux filesystem. [Which you still need
when booting in Legacy/BIOS mode.]
or
2) The UEFI partition that's formated with a FAT filesystem and used
in UEFI boot mode [which you don't need when booting in
Legacy/BIOS mode.]
Note that, for new installs, I generally say always create a decent
sized partition for UEFI, so if you want to change you can, although it
sounds like in your case it probably doesn't matter :-)


Cheers,

Wol
Wols Lists
2024-04-27 19:30:02 UTC
Permalink
Howdy,
I'm installing Gentoo on another old box.  To be consistent I like to
use cgdisk, GPT I think it is called, to partition all my drives,
regardless of size.  Thing is, Grub works differently with GPT than it
does with the old DOS or whatever it is called, like fdisk does in the
old days.  I did some research but still find myself in some muddy
waters.  My take on some things I've read, I need a boot partition, not
to be confused with the /boot for kernels, init thingys and such.  Where
I get lost, most use gdisk.  I like cgdisk.  Before that I liked
cfdisk.  Anyway, how do I set up that partition with cgdisk?  Any
minimum size requirements or tiny is enough?  Does it have to be a
specific type?  Does it need to be in a specific place?  Formatted with
a file system?  Also, when I do grub-install, do I still point to
/dev/sda or to /dev/sda1, if sda1 is the special boot partition?
I tried to find a step by step howto with this info but the ones I find
either don't work or leaves me more confused.  Given that the method is
also aging out, it's hard to find good guides.  I'd be real happy just
to have a link to a good howto that I can make sense of.  I can save a
copy local and even print it.  Maybe someone has some notes that will
help.  I just need something to help clear up the muddy waters.
Hmm ...

Michael's version does not ring any bells with me, and indeed my system
is *not* set up that way. It's UEFI-capable, but at the time I didn't
have a clue what I was doing, so the mobo dumped me into BIOS, and I
just installed everything the old way I knew.

I do, however, have a 512MB partition configured as type "Microsoft
basic data". This is meant to be for the UEFI partition if I get round
to converting the system.

If you want to "suck it and see", just install grub to /dev/sda. All
your GPT disks, by default, leave the first 2MB empty, and grub will
stick itself in there I believe.

Cheers,
Wol
Mickaël Bucas
2024-04-28 08:50:02 UTC
Permalink
Hi
Howdy,
I'm installing Gentoo on another old box.
I was wondering how old this box could be and if it had a BIOS with
UEFI and GPT.

I didn't find a precise date for BIOS, but Wikipedia[1] shows that the
first version of Windows for x64 that can read and write GPT was
published on 2005-04-25. To boot with UEFI, a later version was
published on 2006-07-22.
I think this means most BIOSes were compatible to various degrees at this time.

So if your box is less than 20 years old, it should be OK !
I don't remember how powerful the boxes were at this time, but they
still had floppy disk drives :)
Thanks to anyone who has a link, some notes or something. :-D
Dale
:-) :-)
Good luck

Mickaël Bucas

[1] https://en.wikipedia.org/wiki/GUID_Partition_Table#Windows:_64-bit_versions
Dale
2024-04-28 13:00:01 UTC
Permalink
Post by Mickaël Bucas
Hi
Howdy,
I'm installing Gentoo on another old box.
I was wondering how old this box could be and if it had a BIOS with
UEFI and GPT.
I didn't find a precise date for BIOS, but Wikipedia[1] shows that the
first version of Windows for x64 that can read and write GPT was
published on 2005-04-25. To boot with UEFI, a later version was
published on 2006-07-22.
I think this means most BIOSes were compatible to various degrees at this time.
So if your box is less than 20 years old, it should be OK !
I don't remember how powerful the boxes were at this time, but they
still had floppy disk drives :)
Thanks to anyone who has a link, some notes or something. :-D
Dale
:-) :-)
Good luck
Mickaël Bucas
[1] https://en.wikipedia.org/wiki/GUID_Partition_Table#Windows:_64-bit_versions
.
Well, this thing is old enough it is only BIOS.  It's a old Dell
Inspiron 546.  It has a AMD Phenom II X4 955 CPU in it.  I upgraded it a
bit.  It is maxed out at 8GBs of memory.  No floppy but I wouldn't be
surprised to see a connector on the mobo for one tho. 

I mostly use these as rigs to do backups with but could serve as a rig
to watch TV with if my main rig goes to puter heaven.  This one is in a
case at least.  My usual NAS/backup box rig sits on a piece of plywood. 
Good ventilation during compiles tho.  ROFL 

I just got to figure out how to make it so I can login as root via ssh
again.  I set PermitRootLogin to yes in ssh config but still refuses.  I
did it on my NAS box but can't recall what else I had to do.  No
monitor, power plug or anything for it right now.  I moved it to the
kitchen table so I could hook this old Dell to the router. 

Now to see what else I can get into. 

Dale

:-)  :-) 
Dale
2024-04-28 13:20:01 UTC
Permalink
Post by Dale
I just got to figure out how to make it so I can login as root via ssh
again. I set PermitRootLogin to yes in ssh config but still refuses. I
did it on my NAS box but can't recall what else I had to do.
Just checking the obvious, did you start sshd?
Is a port open and listening for ssh connections (use nc, telnet, nmap to find
out).
Will it let you login as a plain user, then 'su' to run as root?
Make sure the plain user is in the wheel group.
Right now, I can login as a user then su to root, and password.  I just
can't login as root directly.  I use Dolphin and the fish thingy to
access config files etc so I can use Kwrite to edit files etc.  Thing
is, I have to login as root for some files.  No way to su to root with
Dolphin, that I know of anyway. 

I'm pretty sure I set this up on the old NAS box.  My searches shows the
PermitRootLogin set to yes should do it but I guess I missed something. 

Any ideas?  I did search old threads but only found the option above,
mentioned by Neil I think. 

Dale

:-)  :-) 
Dale
2024-05-05 06:40:01 UTC
Permalink
Post by Dale
Post by Dale
I just got to figure out how to make it so I can login as root via ssh
again. I set PermitRootLogin to yes in ssh config but still refuses. I
did it on my NAS box but can't recall what else I had to do.
Just checking the obvious, did you start sshd?
Is a port open and listening for ssh connections (use nc, telnet, nmap to find
out).
Will it let you login as a plain user, then 'su' to run as root?
Make sure the plain user is in the wheel group.
Right now, I can login as a user then su to root, and password.  I just
can't login as root directly.  I use Dolphin and the fish thingy to
access config files etc so I can use Kwrite to edit files etc.  Thing
is, I have to login as root for some files.  No way to su to root with
Dolphin, that I know of anyway. 
I'm pretty sure I set this up on the old NAS box.  My searches shows the
PermitRootLogin set to yes should do it but I guess I missed something. 
Any ideas?  I did search old threads but only found the option above,
mentioned by Neil I think. 
Dale
:-)  :-) 
I figured it out.  I was editing ssh_config when I should be editing
sshd_config.  Note the "d" in there.  After doing some digging, a lot of
digging, I finally noticed that extra "d" in there.  Now it works and I
can use a file manager like Dolphin or something and fish to edit files,
move them around etc. 

Amazing how one letter can really mess things up.  ;-) 

Dale

:-)  :-) 

Michael
2024-04-28 13:20:01 UTC
Permalink
Post by Dale
I just got to figure out how to make it so I can login as root via ssh
again. I set PermitRootLogin to yes in ssh config but still refuses. I
did it on my NAS box but can't recall what else I had to do.
Just checking the obvious, did you start sshd?

Is a port open and listening for ssh connections (use nc, telnet, nmap to find
out).

Will it let you login as a plain user, then 'su' to run as root?

Make sure the plain user is in the wheel group.
Loading...