Linux hard disk layout. It should be mentioned that the disk cannot be divided indefinitely. hard disk partitions.

💖 Like it? Share the link with your friends

Volume manager (LVM2) - a layer between the file system and hardware. It allows you to resize partitions, create and delete partitions. I am skeptical about it and only use static disk partitioning. In defense of my point of view, I can give several arguments against using LVM:

  1. I don't need to resize partitions every day.
  2. An extra layer affects the speed of accessing the disk.
  3. I have enough static markup.

The latest versions of Solaris (and now linux and BSD) allow you to install the system on partitions with ZFS. With ZFS, you can resize partitions and take snapshots.

Back to the main partitioning window, you will see all the newly created partitions. Did you notice that we didn't create a boot partition? The menu should look something like this. Continue installation. Set the default boot manager: After successfully completing step 2, restart your computer.

This image shows the entries in the startup menu of a computer used for this manual. In this case, the safest procedure is to use a separate section for sharing your data. The question is, what is the best file system for this partition?

Why would you want to partition a disk?

  • To protect data.
  • Use different file systems.
  • Be able to unmount a partition.
  • Use different mount options for different partitions (ro, nodev, nosuid, noexec)
  • Place them on different hard drives.

/ - Root

This section must be present.
In the absence of other partitions, all system and user files will be stored on it. This must be taken into account when determining its size. Typically, the distribution manufacturer will give recommendations on the minimum size of the root partition.

The downside is that this file system does not restrict access and is limited to a maximum file size of 4 GB. If you can live with these restrictions, it is the best choice. If, on the other hand, you need files larger than 4 GB, for your sharing partition, you can use.

It's no longer a dual boot, but a system on one controlled by the other, so you can instantly switch between the two systems and share files between two computers on the network. There are disks large capacity at affordable prices. Attention. Before performing any operation, you must backup data, especially if you need to resize partitions.

Swap

The swap file or swap is needed to allocate memory pages that are in this moment are not used. Swap can be done as a separate partition or put in a file on any partition (a file for swap can be created using the utility dd). The first option is, of course, preferable.

If you do not use sleep mode, do not run heavy applications and have a lot of random access memory, you can reduce the size of the swap or disable it altogether.

Free up disk space

If you install on empty disk, allow a partition of sufficient size for exchanges that will be empty at the beginning. However, this operation remains accidental and dangerous. A hard drive is a mass storage used primarily in computers. This is where all the files on your computer will be stored. Masterpiece, HDD deserves your attention.

Hard drives may have different interfaces. The most common at present are. On microcomputers, partition allows you to determine the amount of available hard disk space. Information about the first 4 partitions of a disk is written to the disk itself in an area known as the partition table.

Boot

This partition is placed at the beginning of the disk. Moreover, it can not be mounted at all at boot or mounted with the option ro.
The kernel size is ~1.5-2M, so 15-20M for this partition will be enough.
The recommended file system is ext2.

Home

Section with user home directories /home can be isolated for security reasons (mount it with noexec, nosuid, nodev options) or to increase system reliability.

Here is an example of a split. Mainly for security reasons. If a partition is corrupted, the rest of the system can still be accessed. It might be enough just to restore backup damaged partition to fix the problem. But also for separating sections that might be uploaded files, the rest of the system will always work.

This requires an "intact" root. The small size will quickly render your system unusable. The size is too large to remove disk space. Don't expect to get clear help on the separation, you are alone in this choice, which should be made according to your materials and your needs, which you will need to determine long before anything else.

You can also use one section /home for multiple operating systems on the same machine.
The size of this section is determined according to the needs of the users.

Var

On servers (mail, web, caching proxies), this section can be clogged with a large number of small files. In this case, it is quite reasonable to format it in raiserfs.

Catalog organization

Be clear about your specifications that you will make use of in your system, you are the only one who knows what you expect from your machine. You must have at least 500 MB of disk space. If you want to install more packages, you must increase the disk space allocated to this directory.

The location you need depends on how you use your computer. In most cases, the size of this partition will be determined by the package management tools, which take up a lot of space. For a minimal install, you can switch between 50MB and 100MB.

And, for example, on a machine with gentoo, when compiling OpenOffice, up to five gigabytes of free space is required in /var/tmp.
The size of this partition will depend on the task the system is performing.

opt

Using third-party software, which requires a lot of disk space, you can move /opt to a separate partition and put this software in it. It also increases the reliability of the system (the failure of this software will not affect the main system in any way).

You can start with a minimal installation, then install packages slowly, in which case you can install from 300 to 500 MB. For some, this partition is up to 10 GB or more. The space required depends on the number of users on the system and the type of files they need to store. As a rule, the largest place is reserved for this assessment. . Then you must prepare the partition before installation with the following command.

Of course, there are exceptions to this rule. It would be useless for "classic" use. On 32-bit architectures, the maximum size of a swap partition is 2 GB. This is sufficient for almost all systems. The kernel will balance the use of swap space between different partitions to get better performance. Hibernation can only be performed on one swap partition.

Usr

User files, documentation, various icons and other junk are stored here. There are lovers to separate this section as well.

tmpfs

The information in the /tmp /var/tmp /var/lock partitions does not need to be stored on disk.
These partitions contain temporary files. When mounted in tmpfs, all content will be placed in memory or in swap. Additionally, you can specify mount options for these sections: noexec, nodev, nosuid, which will increase system security.

You are limited to 4 primary partitions, or 3 primary partitions and one extended partition, which is a logical partition container. A logical partition containing a pointer to the beginning of the next logical partition, so the number of logical partitions can be infinite. But for device naming reasons, this maximum number had to be limited.

A file system or file system is a way of storing information and organizing it into files on a medium. They are file systems built on the same structure, but with added features and different algorithms depending on the version. That's why defrag tools don't exist for these file systems. Simple regular use enough to defragment the system.

Other sections

You can create a partition with information not related to the main system, or mount a partition from another hard drive. Example: /mnt/pron or /mnt/anime.

fstab

Information about file systems, mount points, and options is contained in the file /etc/fstab, or /etc/vfstab in solaris.
For more information about mount options, see the help. man mount
about the file format - man fstab.

This check is recommended and is performed by default on a regular basis. Can't convert existing partition from one file system to another, so the choice of file system is final. You see that, just like the number of partitions and the size of the partitions, choosing a filesystem isn't necessarily easy.

It is designed to create, reorder and delete disk partitions. Perform various actions on partitions such as create, delete, resize, move, inspect, mark, copy and paste.

  • Create a disk partition.
  • Enable or disable partition flags such as "load" or "hide".
However, data loss can still occur due to an abnormality in the program, a hardware problem, or a power failure.

Utilities

Disk partitioning is usually carried out when installing the system using the installer program.
If during installation an unallocated space was left or it became necessary to change the markup, you can use the following utilities:

  • fdisk
  • cfdisk
  • format - in Solaris
  • parted

Conclusion

Several ways to partition a disk:

This is especially true for encrypted data, as it can become permanently inaccessible after a failure. The toolbar contains a subset of commands in the form of icons, which you can also access from the menu bar. The graphical display area contains a representation of the partitions of the selected drive.

The text display area contains a list of partitions on the selected drive. The information panel of the device displays information about the selected drive. By default, the device information bar is not displayed. To view it, click View→Device Information.

For desktop:

swap 2 x ram_size / 10G /home - all remaining space /boot 20M (noauto,noatime) swap 2 x ram_size / 10G /home optional (noatime,noexec,nodev) /tmp, /var/tmp, /var/lock - to tmpfs (noexec,nodev)

For the server:

/ 10G swap 2 x ram_size /var 10G

Linux disk partitioning - In this post I will talk about file systems and share my opinion on how best to partition a disk. At the moment in linux there are many file systems and options for how to partition a disk. But, not all of them are actively used.

The Pending Operations panel displays a list of queue operations. The Pending Operations bar is not displayed by default when an operation is not in progress. To view it, select View → Pending Operations. When you click on any of the display areas, you select the section to be used for section editing operations.

When you right-click on one of the display areas, a pop-up menu will appear containing the basic steps for changing sections. To work with multiple disks from command line, type the following command, and then press ENTER.

Linux file systems.

ext2- The main disadvantage, which is also a plus - is absence journaling, whereby high performance. Ideal for boot partition/boot.

ext4- This logged filesystem, the main filesystem, used on all other partitions except /boot.

To view the actions supported by different file systems, choose View → File System Support. A dialog box will open with various options. To close the File System Support dialog box, click the Close button.

Device operations

The partitions on the selected drive are then displayed in graphics and text areas. To view information on a disk. To close the Device Information panel, click View → Device Information again to deselect.

Device update

Create a new partition table. To create a new partition table on the drive.

In addition to these two brothers, there are even less popular ones, it makes no sense to talk about all file systems. Below are the ones that are commonly used:

ReiserFS- Journaled file system, in some cases faster ext4 but less stable. Works fast with small files, well suited for storing and working with multimedia, torrents. Mainly used for sections /home, /var, /tmp

Data recovery attempt

To try to recover data from disk device.

Basic actions by section

These actions do not change the partitions on your drive. To select a partition, use one of the following options.
  • Click on a section in the graphics display area.
  • Click on a section in the text display area.
Partition operations such as Delete, Move, Copy, Format, Inspect, Label, and Resize Frequently require the partition to be unmounted.

To select unallocated space, use one of the following options.

  • Click "Unassigned" in the graphic display area.
  • Click "Unallocated" in the text display area.
If you don't have a drive with unallocated space, you can try.

Reiser4- 4th version ReiserFS, also a fast file system, works well with a large number of small files, but there is minusthe absence of a file system in the main branch of the kernel.

tmpfs- Temporary file storage /tmp , placed in RAM, not on physical disk. This is also called "ram drive". Many *nix distributions use it by default. tmpfs- especially useful for those, who uses SSD, it prolongs life by storing a temporary file in RAM. tmpfs- varies in size and, if necessary, expands with a swap. I advise all owners of a large amount of RAM.

Section information display

Staging section actions

These actions modify the partitions on your drive without changing the start and end limits. Create a new section. If you delete a logical partition, all partitions that appear after that partition will be subject to the device name change.

These logical partitions are recognized by the operating system as follows. Renaming a drive can be a problem if the partition is mounted using the drive name. Drive name changes can seriously affect the following files. Disks with cycles or partition tables do not contain a partition or partition table.

swap- Standing apart from file systems, this is the swap partition (file). Used in cases of lack of RAM.

So, with file systems, more or less figured out who needs more detailed information - there is Wikipedia.

Now I will share my subjective opinion on how best to partition the disk. I'll start with what the main sections are and what they are for:

Determining the file system label of a partition

To delete file system and virtual partition, select erasable formatting.

Partition Detail Indication

Specifying section details is useful when you perform actions such as creating, resizing, or moving. Specify the size and location of the partition. To specify the partition size and location, use one of the following methods, or a combination of these methods.

Click the middle of a section in the graphics area and drag the section to the right or left. Modify the selection fields to customize the following fields: Previous free space New size Next free space. Click and drag the arrows to the end graphic representation section. . The application updates the graphics area and the numbers in the three numeric fields.

/ - This is the root section, it is root. The most important one, all subsequent partitions are mounted to it and the most important OS files are stored in it. /boot - Contains core OC and files to download. /usr - All important programs and user libraries. /tmp - Partition contains temporary files. /var - Stores log, cech files, and mail, Sometimes web. /opt - Additional - third-party programs are installed there. /home - All user home directories are placed here.

That's all the main sections, there are also such as: /etc, /bin, /llib, /mnt and many others, but that's another topic...

There are many options for how to partition a disk for Linux, and among them not 100% correct. To choose the most suitable option, you need to decide on the goal. Whether it's a web server, an email server, ftp, desktop, or something else.

It should be mentioned that the disk cannot be divided indefinitely.

There are only 4 primary partitions ( Primary partition). If necessary, one of the primary partitions can be declared extended ( extended partition) And in extended , you can create logical ( Logical partition) sections, up to 15pcs (if I am not mistaken).

Distribution linux, does not play the role of choice, as if it ubuntu, Fedora, OpenSUS or something else. Even, by and large, the layout of the disk, you can trust the installer of the distribution kit or use the entire disk space. Partition disk hands is necessary in order to be able, with failure one partition, save the information of other partitions and the system as a whole (/home is enough to store information).

(Linux disk partitioning) I will show my working example, on a laptop, desktop (desktop). Winchester 250gb, operating system- ArchLinux.

Primary/boot( ext2) - 100mb This is the ceiling, I have never loaded more than 50mb. Primary/swap - recommend RAM x 2, but if you have 6 or more gb then you can RAM x 1 or RAM x 0.5. Primary/usr ( ext4) 50gb - This is the main section where the OS and programs will be, I have installed KDE+ a lot of programs, more than 15gb did not exceed. Logical/tmp ( ext4) 7gb - Also enough for now. Logical/var( ext4) 5gb - Enough for the eyes, if not stored mail at home. Logical/var/log( ext4) 2gb - I did this to limit the space for logs (event log). Logical/opt ( ext4) 20gb - Installed on it xampp and sites lie. Logical/ home ( ext4) ~150gb (remaining space) under the home directory.

Many people prefer to separate the /usr partition from / (root), allegedly safer and create more /media to store media. Also many people format /tmp And/var in ReiserFS, so supposedly faster, but in my opinion, still better ext4.

If you have 6gb or more of RAM and have an SSD , then I would recommend placing the /tmp section in tmpfs. It will be faster and the SSD will last longer.

For example, if you do under the email server , then section /var should be the largest .

About how and what partition disk for linux I will not speak on this topic. Each distribution Linux is your installer and your programs, although there are common ones, such as: fdisk , sfdisk, cfdisk.



tell friends