Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Partitioning with parted - need some advise...
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
pmam
Veteran
Veteran


Joined: 30 Dec 2013
Posts: 1145

PostPosted: Fri Jul 22, 2016 10:15 am    Post subject: Partitioning with parted - need some advise... Reply with quote

So far used to use fdisk for partitioning. Now, a new installation,
I want to switch to parted and after reading this wiki I am quite lost:
https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Disks
Many technical terms like: EFI, GPT, MBR etc. I would appreciate a short explanation, especially:
How can know if I have/need EFI or GPT?

Anyway, I created these partitions as ‘primary’ with parted – I still do not have xserver so here the partitions layout:
mklabel gpt

size File system Name Flags
1 size=2MB ntfs grub bios_grub
2 size=134MB boot boot,esp
3 size=21.3GB rootfs
4 size=4295MB swap
5 size=rest volume home

Please advise:
Why there is ‘esp’ flag in boot partition - Does parted identified EFI automatically? I did not set it manually…
Why filesytem of Bios is ntfs?
In general: Is this a good partitioning scheme for amchine with 2G RAM?
_________________
“You can take our property, our sweet homes, even our cloths...
But don't touch the streets, Ah, That's NO, NO, NO!
The streets are our @world's compilable kernel ...”
Back to top
View user's profile Send private message
Solour
Tux's lil' helper
Tux's lil' helper


Joined: 01 Jul 2006
Posts: 106

PostPosted: Fri Jul 22, 2016 11:30 am    Post subject: Reply with quote

I believe that parted shows "Partition Table: msdos" for MBR or "Partition Table: gpt" for EFI.
Also, I read that changing this deletes all partitions.
Back to top
View user's profile Send private message
frostschutz
Advocate
Advocate


Joined: 22 Feb 2005
Posts: 2970
Location: Germany

PostPosted: Fri Jul 22, 2016 12:04 pm    Post subject: Reply with quote

Knowing if you need GPT is easy... nobody uses anything else anymore. :lol:

So do use GPT unless you have good reason not to (like an USB stick / SD card that needs to work in old computer / camera / ...).

Using GPT does not force you to use UEFI... that's a matter of personal preference, again unless something forces you to use one or the other (dualboot windows install?).

Quote:
1 size=2MB ntfs grub bios_grub


That's a bit of confusion... it says ntfs (old filesystem on disk that used to be there?), and bios_grub. The thing to note here is: bios_grub is a special partition for GRUB only. It is not a filesystem.

bios_grub needs to be at most 1MiB in size, it can even be smaller. I usually squeeze it in before the 1st MiB (64s-2047s). GRUB only uses a few KiB of it.

Quote:
2 size=134MB boot boot,esp


That would be an UEFI boot partition, it could be larger... (depends if you put all your kernel initramfs in there or if those stay on your rootfs).

This is the one that should have a (fat32) filesystem (as opposed to bios_grub above which has no filesystem).

If you want to boot legacy mode (to be selected as such in bios) you don't need an esp partition at all. GRUB should be happy with the bios_grub partition, no UEFI/esp.

Quote:
In general: Is this a good partitioning scheme for amchine with 2G RAM?


2G RAM is not much at all nowadays, how old is this box, does it support UEFI at all, if not the decision is already made for you (must use legacy boot).

In legacy boot mode on some systems you will also need to 'disk_set pmbr_boot on' which sets the boot flag in GPT's fake msdos MBR.
Back to top
View user's profile Send private message
pmam
Veteran
Veteran


Joined: 30 Dec 2013
Posts: 1145

PostPosted: Fri Jul 22, 2016 1:25 pm    Post subject: Reply with quote

Thanks for the advise! However still confused... :(

Yes - This is an old machine of a friend - Pentium 4 3 GHZ - Does it mean that can not use GPT?

Quote:
Knowing if you need GPT is easy... nobody uses anything else anymore. :lol:

So this means: Mklabel gpt (not msdos) as I have choose - right?

Quote:
Using GPT does not force you to use UEFI... that's a matter of personal preference, again unless something forces you to use one or the other (dualboot windows install?).

No need of dual boot windows.
Quote:
I believe that parted shows "Partition Table: msdos" for MBR or "Partition Table: gpt" for EFI.

Consequently of choosing 'mklabel gpt' parted automatically set 'esp' for boot partition? I did not set EFI (esp) maually...

Quote:
That's a bit of confusion... it says ntfs

Do not know from where ntfs came here - I did not set it... How to cancel?

Quote:
2G RAM is not much at all nowadays, how old is this box, does it support UEFI at all, if not the decision is already made for you (must use legacy boot).

How to set legacy boot? Need to switch to mklabel msdos? (I know that this action removes all partitions...)
In general: How to verify if machine support UEFI?

Quote:
bios_grub needs to be at most 1MiB in size, it can even be smaller.

I just followed wiki that says: "Now create a 2 MB partition that will be used by the GRUB2 boot loader later."

Quote:
If you want to boot legacy mode (to be selected as such in bios) you don't need an esp partition at all. GRUB should be happy with the bios_grub partition, no UEFI/esp.

How to cancel EFI (esp)? I guess legacy boot is preferred in this case.

Regarding swap partition: Hope 4G is ok for 2G RAM?
_________________
“You can take our property, our sweet homes, even our cloths...
But don't touch the streets, Ah, That's NO, NO, NO!
The streets are our @world's compilable kernel ...”
Back to top
View user's profile Send private message
Logicien
Veteran
Veteran


Joined: 16 Sep 2005
Posts: 1369
Location: Montréal

PostPosted: Fri Jul 22, 2016 1:56 pm    Post subject: Reply with quote

You can see in the Bios setup if your computer support Efi. In plus when you press the key to choose which media to boot, there is an Efi choice if the media you want to boot support Efi. With livecds who support Efi mode, the boot screen is generally black in Efi boot mode in contrast with Bios boot mode where the boot screen is colored.

After booting in Efi mode, there is a mount point in /sys/firmware/efi/efivars use by Efi variables. You can see it in the output of the command mount.

If your computer do not support Efi mode, it is simpler to use a Dos/Mbr partitions table, of course it is now legacy like Bios mode. On old computers you do not have any other boot mode than Bios. You do not need any Bios and Efi partition. The Grub boot loader install itself in the Mbr, and refer to the contain of the /boot directory of the root partition to complete it's own boot.

You can create a dedicated boot partition if you want instead, if it do not confuse you. This boot partition need to be mounted in /boot before anything is write in this directory otherwise, it is written in the /boot directory of the root partition instead of the boot partition.

In Efi mode, the Efi partition can be use as a boot partition too if you want. One Fat filesystem for several purposes, Efi stuff, kernels, initramfs, bootloaders files, Memtest binary, etc.
_________________
Paul
Back to top
View user's profile Send private message
pmam
Veteran
Veteran


Joined: 30 Dec 2013
Posts: 1145

PostPosted: Fri Jul 22, 2016 2:27 pm    Post subject: Reply with quote

Logicien,

Quote:
If your computer do not support Efi mode, it is simpler to use a Dos/Mbr partitions table, of course it is now legacy like Bios mode. On old computers you do not have any other boot mode than Bios. You do not need any Bios and Efi partition. The Grub boot loader install itself in the Mbr, and refer to the contain of the /boot directory of the root partition to complete it's own boot.

After checking according your info, this machine does not support EFI.
Thus, using parted > mklabel msdos, no need of bios and boot, and need only these partitions:
1 swap
2 root
3 home (optionally)
Please confirm if I well understand you?

Thanks
_________________
“You can take our property, our sweet homes, even our cloths...
But don't touch the streets, Ah, That's NO, NO, NO!
The streets are our @world's compilable kernel ...”
Back to top
View user's profile Send private message
Logicien
Veteran
Veteran


Joined: 16 Sep 2005
Posts: 1369
Location: Montréal

PostPosted: Fri Jul 22, 2016 2:48 pm    Post subject: Reply with quote

Yes it's ok. 4 gigabytes of swap space is sufficiant for 2 gigabytes of Ram. I like to have a /home partition. A lot of data are generally written, modified and delete there so, I can try to optimise it without take any risk with the root partition.
_________________
Paul
Back to top
View user's profile Send private message
pmam
Veteran
Veteran


Joined: 30 Dec 2013
Posts: 1145

PostPosted: Fri Jul 22, 2016 2:58 pm    Post subject: Reply with quote

Paul,

So only 3 partitions in total... Nice to know :)

Quote:
I like to have a /home partition.

I am also, but other users may prefer to have a big root partition...

Thanks a lot
_________________
“You can take our property, our sweet homes, even our cloths...
But don't touch the streets, Ah, That's NO, NO, NO!
The streets are our @world's compilable kernel ...”
Back to top
View user's profile Send private message
pmam
Veteran
Veteran


Joined: 30 Dec 2013
Posts: 1145

PostPosted: Sat Jul 23, 2016 9:12 pm    Post subject: Reply with quote

OK, I see that boot partition is optionally, however, I would like to know how grub uses boot partition:
I am not talking about cases that really require boot partition, like: initramfs, LVM, RAID etc;
In case of regular system like mine - What is the rule of separate boot partition?
What is the content of this partition? Is there any advantage to have it?
Handbook recommends to have boot partition, and I wonder why...
_________________
“You can take our property, our sweet homes, even our cloths...
But don't touch the streets, Ah, That's NO, NO, NO!
The streets are our @world's compilable kernel ...”
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43207
Location: 56N 3W

PostPosted: Sat Jul 23, 2016 9:40 pm    Post subject: Reply with quote

pmam,

There is a lot of history behind the /boot partition. For all the detail, see the Large Hard Disk HOWTO on tdp.
Briefly, the BIOS must be used to read the boot loader. That means that the boot code must be in an area hof the HDD that the BIOS can read.
That's not been a problem for a few years now but during the history of the PC, HDD have got bigger than the BIOS could read from on several occasions.
From memory, some of the limits have been 528Mb, 2GB, 4Gb, 33Gb and 137Gb. The current limit is 512*2^48 bytes.

When boot files can be scattered all over the drive but the BIOS can't read it all, there is a risk of doing a kernel update and the boot loader not being able to read the kernel.
To ensure that this doesn't happen, a small /boot partition at the start of the drive was adopted to hold all the files needed to boot.

With UEFI, /boot must be formatted VFAT (its a brain dead design) but you can't install onto a VFAT filesystem, so you need a separate /boot.

If your system uses BIOS (not UEFI) to boot, you can use either MSDOS or GPT disklables. There are a few oddball systems what won't let you mix BIOS and GPT.
MSDOS disklables have a hard limit at 2^32 disk blocks, that usually 2TB. For larger drives, you need to use GPT.

bios_boot is separate again and is only required when GPT is in use. Its used in its raw form far a part of the boot loader.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
pmam
Veteran
Veteran


Joined: 30 Dec 2013
Posts: 1145

PostPosted: Tue Jul 26, 2016 1:32 pm    Post subject: Reply with quote

Thanks for the useful info!
However I have another issue regarding parted -
When I create another partition, I get an alignment message:
Code:
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel?

and if ignore, I see that next partition does not start at the end of the previous one - there is a gap of some Giga.
After removing and creating again the new partition with another starting block, the above alignment warning disappear but still there is a gap.
Looks that many Giga are wasted or I miss something... I did not have such issue with fdisk
_________________
“You can take our property, our sweet homes, even our cloths...
But don't touch the streets, Ah, That's NO, NO, NO!
The streets are our @world's compilable kernel ...”
Back to top
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3688
Location: Hamburg

PostPosted: Tue Jul 26, 2016 1:56 pm    Post subject: Reply with quote

my recommendation : use GPT, but avoid (U)EFI
Back to top
View user's profile Send private message
pmam
Veteran
Veteran


Joined: 30 Dec 2013
Posts: 1145

PostPosted: Tue Jul 26, 2016 2:09 pm    Post subject: Reply with quote

Quote:
my recommendation : use GPT, but avoid (U)EFI

As you may see in this topic, I need a 'legacy boot' - Can do it with mklabel GPT? instead of mklabel msdos as it now
_________________
“You can take our property, our sweet homes, even our cloths...
But don't touch the streets, Ah, That's NO, NO, NO!
The streets are our @world's compilable kernel ...”
Back to top
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3688
Location: Hamburg

PostPosted: Tue Jul 26, 2016 2:17 pm    Post subject: Reply with quote

This was my way (2 years ago) :
Code:
==============================================================================                                                                                       
                                                                                                                                                                     
Gentoo handbook:        http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?full=1                                                                             
                                                                                                                                                                     
                                                                                                                                                                     
The partitionning :                                                                                                                                                 
==============================================================================                                                                                       
                                                                                                                                                                     
root@rescue ~ # parted -a optimal /dev/sda                                                                                                                           
GNU Parted 2.3                                                                                                                                                       
Using /dev/sda                                                                                                                                                       
Welcome to GNU Parted! Type 'help' to view a list of commands.                                                                                                       
(parted) mklabel gpt                                                                                                                                                 
(parted) print                                                                                                                                                       
Model: ATA ST3000DM001-9YN1 (scsi)                                                                                                                                   
Disk /dev/sda: 3001GB                                                                                                                                               
Sector size (logical/physical): 512B/4096B
Partition Table: gpt

Number  Start  End  Size  File system  Name  Flags

(parted) unit mib
(parted) mkpart primary 1 3
(parted) name 1 grub
(parted) set 1 bios_grub on
(parted) print
Model: ATA ST3000DM001-9YN1 (scsi)
Disk /dev/sda: 2861588MiB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt

Number  Start    End      Size     File system  Name  Flags
 1      1.00MiB  3.00MiB  2.00MiB               grub  bios_grub

(parted) mkpart primary 3 515
(parted) name 2 boot
(parted) mkpart primary 515 16899
(parted) name 3 swap
(parted) mkpart primary 16899 279043
(parted) name 4 root
(parted) mkpart primary 279043 1327619
(parted) name 5 var
(parted) print
Model: ATA ST3000DM001-9YN1 (scsi)
Disk /dev/sda: 2861588MiB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt

Number  Start      End         Size        File system  Name  Flags
 1      1.00MiB    3.00MiB     2.00MiB                  grub  bios_grub
 2      3.00MiB    515MiB      512MiB                   boot
 3      515MiB     16899MiB    16384MiB                 swap
 4      16899MiB   279043MiB   262144MiB                root
 5      279043MiB  1327619MiB  1048576MiB               var

(parted)


Back to top
View user's profile Send private message
pmam
Veteran
Veteran


Joined: 30 Dec 2013
Posts: 1145

PostPosted: Tue Jul 26, 2016 2:35 pm    Post subject: Reply with quote

toralf,

Looks very nice partitioning, without any gap between partitions.
I tried to use GPT (as you can see at the beginning of this topic) -
Do not know why had a ‘esp’ flag in boot partition?
Anyway I will try it again later - Switching to GPT means deleting of all partitions...

Thanks
_________________
“You can take our property, our sweet homes, even our cloths...
But don't touch the streets, Ah, That's NO, NO, NO!
The streets are our @world's compilable kernel ...”
Back to top
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3688
Location: Hamburg

PostPosted: Tue Jul 26, 2016 2:54 pm    Post subject: Reply with quote

BTW please note that I reserved a 2 MB partition at the beginning just for the sake to switch later to (U)EFI if it would be mandatory - but it wasn't.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43207
Location: 56N 3W

PostPosted: Tue Jul 26, 2016 4:45 pm    Post subject: Reply with quote

pmam,

Use wgetpaste to put your partition table on the web.

If you must use BIOS, use an MSDOS partition table unless your HDD is bigger than 2TiB.
When you mix BIOS and GPT, you also got a fake MSDOS partition table for free. If your BIOS checks the bootable flag, it needs to be set in the fake MSDOS partition table.
That's OK, the handbook covers that. A few BIOSes that are far too clever for their own good, then refuse to boot because they don't like the fake MSDOS partition type of 0xee.
If you have one of these, mixing BIOS and GPT is like mixing water and oil.

There is another complication. The MSDOS disk label leaves some free space before the start of the first partition. Boot loaders have often helped themselves to this space because they are all too big to fit in the 446B in the MBR. GPT disk labels don't leave this space. Instead, a 2MB bios_boot partition is required that the boot loader can use for itself. You never mount or make a filesystem here.
Grub2 will complain if there is no bios_boot partition an a GPT formatted drive. You can force it to install using block lists.
Grub1 also complains and installs anyway.

Block lists work fine ... until you update grub, then you must reinstall it again to update the block list.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Logicien
Veteran
Veteran


Joined: 16 Sep 2005
Posts: 1369
Location: Montréal

PostPosted: Tue Jul 26, 2016 6:04 pm    Post subject: Reply with quote

Tell me please, is there any advantage to use a Gpt partitions table in Bios boot mode? Because me, I apply the rule of Dos/Mbr for Bios boot mode and Gpt for Efi boot mode. I never had any hard disk bigger than 2TB.
_________________
Paul
Back to top
View user's profile Send private message
frostschutz
Advocate
Advocate


Joined: 22 Feb 2005
Posts: 2970
Location: Germany

PostPosted: Tue Jul 26, 2016 6:13 pm    Post subject: Reply with quote

pmam wrote:

Code:
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel?



parted uses stupid unit by default. "unit mib" should be one of the first commands in any parted session ("unit s" if you prefer do to math or already have alignment problems with existing partitions).

example (only about partition alignment, not related to either booting mode):

Code:

mklabel gpt
unit MiB
mkpart boot 1 512
mkpart root 512 20480
mkpart home 20480 -1


you can also explicitely write MiB behind each number.

Another very useful command is "print free" which shows you what you have & what is available for the next partition
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43207
Location: 56N 3W

PostPosted: Tue Jul 26, 2016 6:18 pm    Post subject: Reply with quote

Logicien,

It only matters if the HDD is bigger than 2TiB, since an MSDOS partition table cannot describe all that space.

GPT is more robust. There are two copies of the partition table, one at the start and one at the end of the drive.
GPT can have 128 or 256 primary partitions, MSDOS, only four.
That's a nice to have since you should be using LVM if you thing you need lots of partitions.
GPT has 64 bit partition table entries, so HDD won't outgrow it any time soon.

GPT was designed. MSDOS partition tables were a dirty hack, introduced when HDD got bigger than 32 MB. (Yes MB).
The Extended Partition was another hack to make MSDOS work with HDD bigger than 128MB. (Really MB again.)
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
pmam
Veteran
Veteran


Joined: 30 Dec 2013
Posts: 1145

PostPosted: Tue Jul 26, 2016 7:16 pm    Post subject: Reply with quote

NeddySeagoon,

Here my partition table - You can see a gap in the 4th partition:
http://paste.pound-python.org/show/OZoKeeoUPRQ578q8PUrK/

Just a moment... Now link is ok

EDIT: I will try to use MiB as frostschutz said
_________________
“You can take our property, our sweet homes, even our cloths...
But don't touch the streets, Ah, That's NO, NO, NO!
The streets are our @world's compilable kernel ...”
Back to top
View user's profile Send private message
pmam
Veteran
Veteran


Joined: 30 Dec 2013
Posts: 1145

PostPosted: Tue Jul 26, 2016 7:30 pm    Post subject: Reply with quote

frostschutz,

Quote:
"unit mib" should be one of the first commands in any parted session

Looks that with MiB it is ok as you said - no gap between partitions.
parted does not like GiB... :)

Thanks
_________________
“You can take our property, our sweet homes, even our cloths...
But don't touch the streets, Ah, That's NO, NO, NO!
The streets are our @world's compilable kernel ...”
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum