Competent Disk Partitioning for Linux

Partitioning a Linux disk breaks it logically into smaller parts that will be used by different programs. On solid state devices, the word “partition” refers to space. Linux is usually installed on the first. Such a layout on a PC can be presented in a simplified form, like a library. An operating system is a librarian providing a directory tree as available files.

On computers, each OS has its own type of file system, which is not subject to the others, because they cannot read it. This does not apply to Linux, which is universal and understands the files used in Windows 95/98, as well as in many other modern operating systems.

Linux installation planning

Linux installation planning

Each distribution installation guide contains a section on Linux disk partitioning. The KISS (Keep It Simple Stupid) principle is used for beginners. Desktop systems for personal use do not have such complexity, requiring the installation of many partitions. For the correct placement of Linux recommend three mandatory: swap, root and home. This is a logical, not a physical disconnect, so you can edit and manipulate them for various purposes.

Despite the many varieties of file systems, only 3 are used: the basic, advanced and logical form. There is a limitation for marking up a Linux disk - it should have no more than four parts. This requirement is related to the capabilities of Master Boot Record, which tells the PC the boot location and the main sections for the OS. But if you still need more, then perform extended Linux disk partitioning.

It will serve as a hollow container for any number of smaller gates. You can create as many as you need, as well as execute it as a part that is not related to the OS. However, with this positive, extended partitions did not receive widespread use, because the user cannot boot directly from this drive. There are ways around this requirement, but it’s better to coordinate the main system correctly.

Linux mount points

Linux Mount Points

Disk partitioning is usually done when installing Linux, which works in such a way that it puts everything in a tree. The next section is mounted as a branch in a specific folder, usually media or mnt. The mounted directory is called the mount point. This method works better with a tree system, but you can create folders anywhere.

The standard disk partitioning scheme for installing Linux is as follows:

  1. The 12-20 GB partition for the OS is called root.
  2. A small section for increasing RAM, called swap.
  3. Great for personal use - home.

The exact size requirements for Linux disk partitioning depend on your needs. If the user edits a lot of multimedia or has little RAM, he should use a larger swap swap volume. The rule of thumb is that double the amount of RAM is selected as space and is placed in the place of quick access, for example, at the beginning or at the end of the disk.

Even if the user sets a “ton” of software for the root partition when marking up a disk under Linux, a maximum of 20 GB is sufficient. Distributions use ext 3/4 as a file system with an independent self-cleaning mechanism that does not require defragmentation. However, for this there should be a free space of 25-35% of the volume. Home stores personal documents and programs. Functionally, it is equivalent to the Users directory in Windows. It is useful to have it in a separate element, because during the update or reinstallation of the OS, the data in this directory will not be changed.

Swap swap file

Swap Swap File

Swap is the layout of a Linux hard disk to provide a swap function that exists as a logical area on the disk or simply in a file. Instead of using the physical volume in RAM, it takes up disk space for storing temporary files, thereby reducing the use of RAM. The combined set of RAM and swap creates virtual memory larger than the default on the computer. In this way, the Linux kernel can execute processes that require more memory than is physically available.

The swappiness function represents the kernel's preference for using swap. The permutation can have a value from 0 to 100, but the default value is 60. It is necessary to clarify: this value may not be equally effective in all cases, since it will depend on individual use, technical characteristics of the equipment, and user needs.

The user needs one gpt-layout of the Linux disk, used as a space for virtual swap. For simplicity, they create a file with a size from 50% to 100% of physical memory in the OS. If the PC has little RAM and a large amount of disk space, then increase the volume.

Root file system

Root file system

Presented as a slash (/). This top of the directory tree contains Linux and everything that is installed on the system and is equivalent to the “C:” DOS or Windows disk. The user creating the partition for the root directory should not confuse it with the root account, which is a function of the system administrator.

The layout of Kali Linux drives and the size of the root element will depend on what is installed or planned to be placed. They get acquainted with the distribution documentation in advance and reserve enough space for a maximum installation, as well as at least 100 MB for temporary space.

If the user plans to download and try a lot of software, leave more space. If your PC has a small hard drive, you can trim installed packages to save space. In general, if a PC has a root partition between 2 GB and 8 GB, then this is quite enough for the operational operation of the system.

Home catalog

Home catalog

The third and final step that is performed when marking up partitions for installing Linux is creating a home directory. This is the place where user files are stored, in other words, data. This is equivalent to the “My Documents” folder on the MS Windows desktop if MS Office is installed.

In a multi-user system, each user has his own home directory. The contents of the home directory are protected by file permissions and are accessible to all authenticated subscribers. Any user with administrator privileges has the right to access the protected file, including the home directories of other users.

Separating user data from system-wide data avoids redundancy and greatly simplifies the backup of important documents. Malicious programs and viruses running under the user name and with its privileges can only modify files in the home directory and workgroup files, of which the user is a part, but not the current system files.

Strictly speaking, there is no need to create a separate place for home. If this is not done, it will be in the root partition, like all other system directories. If there is not enough space, you may need to configure your computer with the creation of a separate storage, which in the future will allow you to reinstall Linux without losing personal data.

Partition Magic Partitioning

Typically, Partition Magic is used to create partitions and partitions, which can be found on the BOOTABLE CD. BootCD is launched and the first option is Disk Partition Tools.

Partition Magic Partitioning

Algorithm of actions:

  1. Select a hard drive and press an additional button in the form of a "menu", where they assign the amount of GB for Linux.
  2. Next, a section will appear that you will have to create Unallow.
  3. Press the button on it and select "Create."
  4. The setup menu will appear. The Linux partition must be primary and formatted in Ext3 or Ext2.
  5. In LABEL put the label - Ubuntu, because the distribution will be installed.
  6. The cluster size is left at “Default.”
  7. Once it is configured, confirm with the button on the OK screen.

Mint Systems Layout

To create a layout for disk layout for Linux Mint, change the installer page to “something else”, after which they will be shown on the hard drive.

Mint Systems Layout

The process of creating new partitions:

  1. Click the “+” button to add a new one and adjust the size in which you want to create Linux Mint.
  2. Set the mount point to root and leave the ext4 file system.
  3. Create a swap and select the “swap area”.
  4. Open a terminal application and enter the following: sudo su.
  5. Enter your current password to gain root privileges. The command will change from ~ to #.
  6. Activate the swap file, open the file with the Nano editor: # nano / etc / fstab.
  7. The following text is written: / swapfile none swap defaults 0 0.
  8. Pressing Ctrl + O together confirms that the / etc / fstab file is saved.
  9. Press Ctrl + X to confirm the exit from Nano.
  10. After rebooting, the operating system will use the / swapfile file as the swap file.
  11. To verify this, enter the following command in the terminal: $ cat / proc / swaps.
  12. The user will see which device, partition or file is used for sharing purposes and how it is used.

Similarly, you can create any partition Linux Mint.

Recommended Ubuntu Partition

The recommended Ubuntu partitioning can be demonstrated, for example, for a 500 GB SATA drive and a primary boot = 1 GB partition.

Ubuntu 14.04 setup steps:

  1. In the LiveCD assistant, select the installation, in the fourth paragraph, check the option "Advanced options" to create a separation. A 500 GB hard drive appears.
  2. Click "Create table", a warning will open that all content will be lost.
  3. Click "Continue", an empty settings table will open.
  4. Select a free space and click on the “+” icon to add a partition, for example: Size: 1024 MB (1 GB)> Type: Main> File system: ext4> Mount point: boot.
  5. Create a partition for SWAP: Size: 8192 MB (8 GB)> 4 GB of computer RAM double> Type: Logic> File system: Exchange area> Attachment point.
  6. Create for OS and work programs: Size: 51,200 MB (50 GB)> Type: Logic> File system: ext4> Attachment point.
  7. Create a home where users usually save torrent downloads, movies, music, thousands of photos: Size: 476,454 MB (more or less what’s left of the disk)> Type: Logic> File system: ext4> Mount point: home.

Disk Partitioning for Linux and Windows

Disk Partitioning for Linux and Windows

Sometimes it is necessary to install Linux on a Windows PC. To do this, you need to allocate disk space. They recommend using the GParted partitioning tool to resize Windows and create new partitions for Linux.

In general, Linux distributions have good hardware support. But precautions are needed. Whenever the correct partitioning of a Linux disk is not applied, there is a risk of data loss, regardless of which OS is installed. It is important to make sure that critical data is stored on external media and that the backups are not damaged and can be restored.

Ubuntu, like many other Linux distributions, ships as a bootable LiveCD. This means that you can download it and check equipment compatibility without making any changes to existing installations.

The process of planning the layout of the hard disk for installing Linux:

  1. After clicking on the Install button, Linux installation will begin. You should not use the small Windows system partition, but you can resize the NTFS partition to free up space.
  2. The default installation choice is to install Win and Linux side by side.
  3. Linux needs three partitions (root, swap, home). Windows already uses two. Only four basic discs are allowed on the disc. This means that you will need to include the additional space resulting from the compression of Windows 7, otherwise you will have to abandon the use of a separate swap partition or home in Linux.
  4. Change the occupied Windows size (sda2). Create advanced - will be called sda3.
  5. Create logical root, swap, home inside Extended - will be called sda5, sda6 and sda7.
  6. Change the section.
  7. Use GParted to create a layout. GParted ships with Ubuntu. It can be found in System> Administration> Editor.
  8. The next step is to create an extended partition that will occupy all the free space, including the new 2 GB freed from Windows.
  9. GParted is pretty friendly and will start working. First, a compression task will be launched, then a simulation will be launched to make sure that the marker can complete the desired task. It will then perform an NTFS consistency check and correct errors if it finds them. Then it will resize and copy all the data.

Top Drive Managers

Top Drive Managers

There are many programs that can help manage partitions on disks in Linux. But often, such a huge number of alternatives becomes a problem for beginners in this field and makes them doubt which one to choose.

Managing hard drive partitions is a high-risk practice, because if the user does not know exactly what he is doing, then he can make the system inoperative. Beginners are advised to start with the graphical options of the tools and forget about the command line.

More advanced users should recommend the two best command-line tools that can be used to manage partitions and hard drives:

  1. Fdisk is a powerful command-line tool with a text-mode interface that is used to manage partitions. Help makes it easier to work with, each command of its interactive menu can be called up with one letter, such as m for reference, n for creating new ones, p for displaying a table, t for formatting, w for writing.
  2. Parted is a tool in text mode, the main difference from the previous one is that all actions of the sent commands will be applied immediately. Therefore, it is necessary to handle it even more carefully than with the previous one.

The three most relevant GUI tools are:

  1. GParted is recommended for all users because its graphical interface is simple and intuitive, it allows you to perform many operations from creating a new one, formatting, creating tables, resizing.
  2. GNOME - the native disk tool is installed by default, its interface is simple, but to be honest, many people recommend GParted.
  3. KDE - Provided its Plasma desktop environment with another tool for creating default partitions. In this case, the interface is more similar to GParted and simple, so it can be another good option for power.

Some distributions, such as Ubuntu, offer GParted as a utility for LiveCD. Therefore, if the user learns to use the program, he will be able to correctly split the disks in order to have two or more operating systems on the PC, while the information on it will be better organized.

Source: https://habr.com/ru/post/K12511/


All Articles