Partitioning in linux ubuntu

Partitioning basics

When you buy a new hard drive, it usually comes in an unformatted state. There are no partitions or file systems on it and it is ready for partitioning and formatting. It usually comes with a disk with a formatting tool on it which will create one or more partitions on this hard drive based on Microsoft’s FAT file system, but partition creation and formatting can be done with any partitioning tool, though there are certain issues when dealing with Windows on multi-boot systems, and with using Linux partition tools like GParted to modify Windows partitions). Upon launching GPartEd from the Ubuntu Live CD (selecting «System/Administration/Partition Editor» from the Launch Bar at top) and (if necessary) selecting the hard drive, the drive will look like this:

  • UnformDisk.png

Notice that the entire drive is marked «Unallocated» and is called «Free Space.» The drive is ready to create partitions on. I will start with the types of partitions that can be created and their purposes. Drives which have already been partitioned and formatted will follow these conventions, so in order to successfully and efficiently repartition them requires knowledge of these conventions.

There are three types of partitions with which you will be dealing; Primary, Extended, and Logical partitions.

Partitioning Conventions

In «Partitioning Basics», I mentioned the «Unallocated Free Space» on a new drive. All partitions created in this Free Space are created under «Primary partition» rules and conventions.

Primary Partition Rules and Conventions

You can only create four Primary partitions on any single physical hard drive. This partition limit extends to the Linux Swap partition as well as for any Operating System installation or extra special purpose partitions, such as separate /root, /home, /boot, etc., that you might want to create.

If you attempt to create more than four Primary Partitions, you will see the following warning:

  • No-5th-Part.png

Notice that when I tried to create a fifth partition, GPartEd gave me a message warning that this could not be accomplished. How do we circumvent this limitation and create more partitions? With an Extended Partition.

Extended Partitions

While in most circumstances, such as a «Guided Install» from the Live CD on a new Windows computer, four partitions are enough, there are circumstances in which you might need to create more than four partitions. This is the reason for an Extended partition.

  1. When you create an Extended partition, it occupies one of the four Primary partition spots. When an Extended partition exists on a hard drive, only three Primary partitions may co-exist with it. (See Primary Partitions Rules and Conventions) If there are four Primary partitions already on a hard drive and you wish to create an Extended partition in which to create more, one of the Primary partitions must be deleted in order to create it.
  2. Only one extended partition may be created on a hard drive (though you can have one extended partition on each of the hard drives connected to your system). The partition editor will not allow it, and it would serve no purpose at any rate. If you need the extra Extended partition space, you only need expand the one you have.
  3. An Extended partition cannot be formatted with a filesystem, such as ext4, FAT, or NTFS, nor can it directly hold data. That is the function of the Logical Drives which are created within it.
Читайте также:  Vipnet ids hs агент linux

Logical Partitions

A partition created within an Extended partition is called a Logical partition. Any number of Logical partitions may be created within an Extended partition, and they may be formatted with any filesystem.

All Operating Systems that I am aware of are able to access any Logical partition that is formatted to a compatible filesystem. For instance, while Windows will not recognize a Linux ext2 partition without a third-party driver, it will be able to access any partition formatted with FAT or NTFS, depending on the version of Windows. Linux, of course, will access all of these.

HowtoPartition/PartitioningBasics (последним исправлял пользователь cpe-172-116-79-89 2018-01-15 10:28:37)

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

Источник

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.

Читайте также:  Linux command line keys

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

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:

Читайте также:  Partition disks kali linux

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.

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

Источник

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