Linux размер раздела boot

DiskSpace

The goal of this page is to offer advice and strategy on partitioning a Linux system.

Required partitions

Overview

The easiest partitioning scheme, on a non-GPT disk, is simply a root partition and a swap partition.

If the disk is GPT type (this can be checked via the «sudo parted -l» command), you must also add a BIOS-Boot or an EFI partition depending on the boot mode of your BIOS.

On some computers, a separate /boot partition may also be required.

Root partition (always required)

  • Mount point: /
  • Type: Linux type (generally EXT4)
  • Description: the root partition contains by default all your system files, program settings and documents.
  • Size: minimum is 8 GB. It is recommended to make it at least 15 GB. Warning: your system will be blocked if the root partition is full.

Separate /boot (sometimes required)

Some computers can’t see boot files (/boot) if located far (>100GB) from the start of the disk. This is why it is sometimes necessary to create a separate /boot partition at the start of the disk. Remark: don’t use the same /boot for several Linux distributions, as it may mix up their kernels. See this tutorial if you want to create a separate /boot after installing Ubuntu.

BIOS-Boot or EFI partition (required on GPT disks)

If you want to install Ubuntu on a GPT disk (you can check it via the ‘sudo parted -l’ command), you will need either an EFI partition (if your BIOS is set up in EFI mode) or a BIOS-Boot partition (if your BIOS is set up in Legacy mode).

  • Mount point: none
  • Type: no filesystem
  • Description: the BIOS-boot partition contains GRUB 2’s core. It is necessary if you install Ubuntu on a GPT disk, and if the firmware (BIOS) is set up in Legacy (not EFI) mode. It must be located at the start of a GPT disk, and have a «bios_grub» flag.
  • Size: 1MB.
  • Mount point: /boot/efi (no need to set up this mount point as the installer will do it automatically)
  • Type: FAT (generally FAT32)
  • Description: the EFI partition (also called ESP) contains some boot files. It is necessary if the firmware (BIOS) is set up to boot the HDD in EFI mode (which is default on more and more modern, > year 2011 computers). It must be located at the start of a GPT disk, and have a «boot» flag.
  • Size: 100~250MB

Optional partitions

Optionally, some other partitions can be created for specific usages. Be careful, these partitions reduce the flexibility of your disk space, they must be considered only if you are sure not to fill completely your root partition (which would block your system).

Partition for sharing data with Windows, MacOS. (optional)

  • Mount point: /media/thenameyouwish
  • Type: to share data with Windows, choose NTFS. To share data with MacOS, choose HFS+. To share data with another Linux system, choose EXT4.
  • Description: other operating systems (Windows, MacOS..) cannot read nor write in the Ubuntu partitions, but Ubuntu can read and write in any partition. If you want to share files between Ubuntu and the other systems, it is recommended to create a data partition. It is not recommended to share files directly into the Windows system partition (eg files may be overwritten by hibernation).
  • Size: as you wish
Читайте также:  Командная строка linux выбрать

Separate /home (optional)

  • Mount point: /home
  • Type: Linux type (generally EXT4)
  • Description: see HomeFolder. When your hard disk is big enough, a separate /home allows to separate your settings (and also your data if you don’t use a data partition, see previous paragraph) from the rest of the system. A separate /home does not allow to share data with Windows nor MacOS (see previous paragraph).
  • Size: as you wish

More Complex Schemes

For more information on what various directories are used for, see The Linux Filesystem Hierarchy.

More complex schemes could involve creating a separate partition for any number of the default folders used by Ubuntu. System critical folders are important to protect, and since drives, and / or partitions do fail, it is often useful to have your file system broken down into as many small parts as possible. This can be over done however. Installing every core directory to its own partition could cause a noticeable degradation of performance.
Bearing that in mind, the following directories should NEVER be placed in their own separate partitions:

Note about /sbin

It can be argued, and reasonably so, that moving this directory to its own partition is a wise choice. If any of your partitions or drives should fail, then this directory / partition will be the one that most likely contains the tools you will need to repair it. So while moving this would decrease performance marginally, it could also be considered a wise move.

Sizes For Alternative Schemes

On a six month old installation of Ubuntu 10.04.3 LTS the disk usage could resemble something like this: (examples taken from my own system with many extra packages installed)

The above recommendations assume you are using large modern hard drives and can afford the space.

Space Requirements

Absolute Requirements

The required disk space for an out-of-the-box Ubuntu installation is said to be 15 GB. However, that does not take into account the space needed for a file-system or a swap partition.

It is more realistic to give yourself a little bit more than 15 GB of space. Give yourself 15-25 GB to have some space left for actually doing things. If your file-system is full to the brim, you will feel some performance loss.

A certain percentage of an ext3 file-system is dedicated to root, as a way of preventing a rogue process from filling the disk to the point that the system is unusable. This dedicated portion is 5% by default. Also, the anti-fragmentation strategies used by Linux file-systems require that the disk is not close to full. A rule of thumb is to keep them less than 90% full.

Installation on a small disk

(This section is out-of-date & may need research for sizes) During a normal install, the installer copies the packages from the CD to the hard drive (in addition to actually installing them). If you are short on disk space before you install, you can tell the installer not to use extra disk space. The packages take up about xxx Mb. You will be able to install a full Ubuntu system with less than xx GB of hard drive space.

Читайте также:  Размеры всех файлов linux

At the installation prompt (just after you boot from CD) type:

linux archive-copier/copy=false

DiskSpace (последним исправлял пользователь ckimes 2017-09-02 19:35:04)

The material on this wiki is available under a free license, see Copyright / License for details
You can contribute to this wiki, see Wiki Guide for details

Источник

What is the recommended size for a Linux /boot partition? And is it safe to not have a /boot partition? I see some servers don’t have a /boot partition while some servers have a 128 MB /boot partition. I am a little confused. Is /boot partition necessary? If it is, how large should it be?

13 Answers 13

These days, 100 Megabytes or 200 Megabytes is the norm.

You do not need to have a /boot partition. However, it’s good to have for flexibility reasons (LVM, encryption, BIOS limitations).

The recommended size has been increased to 300MB-500MB.

200 MB is the minimum on most modern Linux but I’d increase it to at least 300 MB to avoid the hassle of re-sizing it.

Just today after getting /boot full, I would definitely recommend more than 200MB. Of course you can manually remove old kernels but from a sysadmin point of view that is a bad thing.

@lahjaton_j I don’t see why. Keeping all old kernels is a quirk of debian. There’s normally no need to keep more than the most recent besides the current one.

Tested 9 Aug. 2020: the Ubuntu 20.04 installer gave my boot partition exactly 732.00 MiB, so, if I was doing this manually today, I’d just give it 1 GiB and call it good. See my answer here: serverfault.com/a/1029458/357116.

I’d like also to vouch for 1GiB. I’m running into a huge amount of pain at 512MiB because of a weird triple-boot situation. I’m going to resize to 2GiB, just to be safe.

I tend to create a 1 GB /boot . I leave a live CD image which has various repair tools in my /boot . I mostly do this for systems that at the remote sites I support.

With the right configuration, and enough memory, GRUB 2 can boot the image without extracting the contents. A couple of times I have talked remote staff into rebooting the system to the live CD image and starting networking/ssh on a system that was having issues so I could connect and repair things.

This certainly isn’t required, or even common.

@zoredache I’m installing arch linux on my external hard disk for work purpose, I would like to add live image as you said you did, for rescue, can you please point me any links how to do that?

@pahnin Here are the instructions I found for doing that: help.ubuntu.com/community/Grub2/ISOBoot (this is probably worth being a question of its own)

What is the recommended size for a Linux /boot partition?

The /boot partition contains the GRUB configuration, the kernel with their System.map, . I think ~ 100 MB is enough.

And is it safe to not have a /boot partition?

Yes. But a separate /boot partition has some advantages:

  • As a rescue partition
  • rootfs is on a LVM, RAID, is encrypted, or unsupported by GRUB
  • Maybe saves a few seconds of the boot time
Читайте также:  Отключение swap astra linux

I’ve been surprised relatively recently with a bios that couldn’t access above 1023(?) cylinders, too.

Because usually /boot is at the beginning of the disk, which is usually on the outer sectors has less chances to get fragmented and the path is smaller (less directory reads), it is usually a primary partition (no need to read the logical partition chain). But I doubt that you gain more than 1s.

«a separate /boot partition has some advantages». Note that a separate, non-encrypted /boot partition is also required when doing a LUKS-encrypted installation where all root ( / ) contents are on the LUKS-encrypted partition.

As we have seen quite an increase in linux kernel storage requirements and ever increasing initrds, I nowadays (February 2018) tend to allocate 1 GB of storage for /boot .

As /boot is usually the only thing that is not on LVM, it is the only partition you cannot resize easily. Thus «wasting» a few hundred megabytes usually doesn’t hurt as bad as a /boot filesystem that turns out to be too small in maybe 5 or 10 years.

It also differs distribution from distribution. For example for Fedora minimum is 250 MB [1] and 500 MB is default and if you plan to (pre)upgrade in the future 500 MB is required [2] . If space is not a problem I would go for 1 GB to prevent shuffling partitions later as I had to do when upgrading recently.

Modern systems are generally installed with a much larger /boot partition than in the past. The number has just been growing over time.

RHEL 5 created a 101 MiB /boot partition.

RHEL 5 Partitioning

RHEL 6 created a 500 MiB /boot partition.

RHEL 6 Paritioning

RHEL 7 also created a 500 MiB /boot partition, but this was changed to 1024 MiB in 7.3, because as the release notes state:

In previous releases of Red Hat Enterprise Linux 7, the default size of the /boot partition was set to 500 MB. This could lead to problems on systems with multiple kernels and additional packages such as kernel-debuginfo installed. The /boot partition could become full or almost full in such scenario, which then prevented the system from upgrading and required manual cleanup to free additional space.

In Red Hat Enterprise Linux 7.3, the default size of the /boot partition is increased to 1 GB, and these problems no longer occur on newly installed systems. Note that installations made with previous versions will not have their /boot partitions resized, and may still require manual cleanup in order to upgrade. (BZ#1369837)

RHEL 7 Partitioning

It remains at 1024 MB in RHEL 8.

RHEL 8 Partitioning

My current EL7 and EL8 systems have roughly 250 MiB used in /boot, but I usually don’t install kernel-debug packages.

As the Linux kernel continues to grow over time, mostly due to adding hardware device drivers, this recommendation is likely to continue to grow as well.

And again, as noted by others, a /boot partition isn’t strictly required anymore for most installations. VMs generally do not need it, for instance, and UEFI booting systems also don’t need it (though they have an EFI System partition which must exist and be large enough to hold various UEFI files). A /boot partition is required for some very old legacy systems and for using LUKS full-disk encryption.

Источник

Оцените статью
Adblock
detector