- Partitioning¶
- Disks and partitions under Linux¶
- Dedicated /home partition¶
- How to Create a Disk Partitions in Linux
- Creating a Disk Partition in Linux
- If You Appreciate What We Do Here On TecMint, You Should Consider:
- Разбивка диска для установки Linux
- Немного теории
- Зачем так делать?
- Разбивка диска для Linux
- Раздел /boot
- Раздел /
- Раздел swap
- Домашний раздел — /home
- Динамическое изменение размера разделов
- Выводы
- Linux Mint Forums
- [Linux Mint 19 + Cinnamon] Manual install: Correct Partition sizes, Partition Order, File System types, and Encryption..
- [Linux Mint 19 + Cinnamon] Manual install: Correct Partition sizes, Partition Order, File System types, and Encryption..
Partitioning¶
Disks and partitions under Linux¶
If you are not familiar with the Linux naming scheme for devices and partitions, or the concept of filesystems and mount points, read:
Dedicated /home partition¶
In Linux, the /home directory is used to store user data and preferences.
This directory contains one subdirectoy for each user account. Say your username is john , your home directory is /home/john , your downloads are in /home/john/Downloads , your documents in /home/john/Documents , your Firefox bookmarks somewhere in /home/john/.mozilla and so on…
By giving /home its own dedicated partition, you separate the user data from the rest of the operating system.
The advantage is that you can wipe the operating system and replace it without affecting the user data.
When installing Linux Mint:
- Assign the / mount point to the partition dedicated to the operating system, and tell the installer to format it.
- Assign the /home mount point to the partition dedicated to the user data, and if it contains user data already, make sure to tell the installer not to format it.
This is not recommended for novice users. A misstep during the installation could wipe all your data. Always make backups, make sure to select the right partitions and to carefully review formatting options.
A Linux Mint operating system takes about 15GB and grows as you install additional software. If you can spare the size, give it 100GB. Keep most of your free space for the home partition. User data (downloads, videos, pictures) takes a lot more space.
© Copyright 2017, Linux Mint Revision 11740971 .
Источник
How to Create a Disk Partitions in Linux
In order to effectively use storage devices such as hard drives and USB drives on your computer, you need to understand and know how to structure them before using in Linux. In most cases, big storage devices are split into separate portions called partitions.
Partitioning enables you to split your hard drive into multiple parts, where each part acts as its own hard drive and this is useful when you are installing multiple operating systems in the same machine.
In this article, we will explain how to partition a storage disk in Linux systems such as CentOS, RHEL, Fedora, Debian and Ubuntu distributions.
Creating a Disk Partition in Linux
In this section, we will explain how to partition a storage disk in Linux using the parted command.
The first step is to view the partition table or layout on all block devices. This helps you identify the storage device you want to partition. You can do this using parted or fdisk command. We will use the former for purposes of demonstration, as follows, where the -l flag means list partition layout on all block devices.
List Partitions in Linux
From the output of the above command, there are two hard disks attached to the test system, the first is /dev/sda and the second is /dev/sdb .
In this case, we want to partition hard disk /dev/sdb . To manipulate disk partitions, open the hard disk to start working on it, as shown.
At the parted prompt, make a partition table by running mklabel msdos or gpt, then enter Y/es to accept it.
Make Disk Label
Important: Make sure to specify the correct device for partition in the command. If you run parted command without a partition device name, it will randomly pick a storage device to modify.
Next, create a new primary partition on the hard disk and print the partition table as shown.
Create Partition in Linux
You can create another partition for the reaming space as shown.
Create Another Partition
To quit, issue the quit command and all changes are automatically saved.
Next, create the file system type on each partition, you can use the mkfs utility (replace ext4 with the file system type you wish to use).
Create Filesystem Type on Partition
Last but not least, to access the storage space on the partitions, you need to mount them by creating the mount points and mount the partitions as follows.
To check if the partitions are actually mounted, run the df command to report file system disk space usage.
Check Partitions Disk Space Usage
Important: You may need to update /etc/fstab file to mount newly created partitions automatically at boot time.
You might also like to read these following related articles:
That’s all! In this article, we have shown how to partition a storage disk, create a file system type on a partition and mount it in Linux systems. You can ask questions or share you thoughts with us via the comment form below.
If You Appreciate What We Do Here On TecMint, You Should Consider:
TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.
If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.
We are thankful for your never ending support.
Источник
Разбивка диска для установки Linux
Для установки Windows достаточно просто выбрать раздел диска. Система сама его отформатирует и установит туда все файлы. Но Linux позволяет намного гибче настроить расположение системы и ее файлов. Во время установки вы можете разместить различные папки с системными или пользовательскими файлами на разных разделах.
Это очень интересная функция, повышающая надежность системы, а также удобство ее использования. Наша сегодняшняя статья ориентирована на новичков, мы рассмотрим как нужно выполнять разбивку диска для установки linux. Поговорим зачем это нужно, какие размеры для разделов выбирать и так далее.
Немного теории
Начнем с того, что в Linux не существует дисков, таких какими мы их знаем в Windows. Здесь все намного более прозрачно. Есть разделы диска, а также существует одна корневая файловая система.
В качестве корневой файловой системы подключается выбранный вами для этого раздел, а уже к нему, в подкаталоги подключаются другие разделы. Сюда же подключаются флешки, DVD диски и другие внешние носители. Например, раздел загрузчика подключается в /boot, в качестве /sys, /proc, /dev подключаются виртуальные файловые системы ядра, а в качестве /tmp присоединяется оперативная память.
Но для пользователя все это выглядит как единая файловая система. Складывается впечатление, что все файлы находятся на корневом разделе, а не раскиданы по нескольким. Вообще говоря, можно установить Linux на один раздел, не разбивая файловую систему, но так делать не рекомендуется, ниже мы рассмотрим почему.
Зачем так делать?
У каждого из разделов своя задача. Разбивка диска для linux между несколькими разделами изолирует их один от другого. Если на одном разделе, например, домашнем закончится место, то система все еще сможет нормально работать, потому что это никак не касается корневого раздела.
Вынесение домашнего раздела также очень полезно при переустановках. Так вы сможете переустановить систему но сохранить все свои данные. Или же еще можно использовать одного пользователя в нескольких системах.
Загрузчик выносится на отдельный раздел, если файловая система вашего корневого раздела не поддерживается Grub, например, если вы используете Btrfs, xfs и т д. Также такая разбивка диска на разделы linux нужна если вы применяете технологию LVM или шифрование. Кроме того, загрузчик быстрее обнаружит свои файлы, если они будут на небольшом разделе в начале диска, а не где-то в дебрях много — гигабайтовой файловой системы.
На серверах иногда выделяются разделы /var и /usr. Это нужно опять же для изоляции и безопасности, например, вы можете запретить с помощью опции монтирования выполнение файлов с раздела /var.
Разбивка диска для Linux
В стандартной разбивке диска для Linux используется четыре раздела:
- / — корень, основной раздел для файловой системы;
- /boot — файлы загрузчика;
- /home — раздел для файлов пользователя;
- swap — раздел подкачки, для выгрузки страниц из оперативной памяти, если она будет переполнена.
Все что здесь перечислено кроме swap — это точки монтирования в файловой системе. Это значит, что указанные разделы, будут подключены в соответствующие папки в файловой системе.
Сейчас мы не будем рассматривать как выполняется разбивка диска для установки linux на практике. Все это делается в установщике в пару кликов. Но более детально остановимся на файловых системах и их размерах, чтобы вы точно знали какие значения выбирать.
Раздел /boot
Разбивка жесткого диска linux начинается с создания этого раздела. Здесь все очень просто. На этом разделе размещаются файлы настройки и модули загрузчика, которые считываются при старте Grub, а также ядро и initrd образ. Эти файлы занимают не так много пространства, около 300 Мегабайт, но в некоторых дистрибутивах здесь могут размещаться еще и темы Grub, а также со временем будут накапливаться старые версии ядер, так что лучше запастись местом и выделить 500 Мегабайт. Этого будет вполне достаточно.
Что касается файловой системы, то нам нужна самая быстрая и простая. Задача этого раздела сводится к тому, чтобы как можно быстрее выдать файлы во время загрузки. Журналирование здесь не нужно, поскольку оно только замедлит загрузку, а файлы изменяются очень редко. Поэтому наш выбор ext2.
Раздел /
Это главный раздел вашей системы. На нем будут находиться все системные файлы, и к нему будут подключаться другие разделы. Сюда же мы будем устанавливать все свои программы и игры.
Учитывая все это нужно выделить достаточное количество места. Минимальные требования, чтобы вместились все файлы из установочного диска — 8 Гигабайт. Но когда вы установите все нужные вам программы система начнет занимать около 20 Гигабайт (это без игр). С каждым обновлением размер системы будет еще увеличиваться на 200-500 мегабайт. А теперь добавьте сюда игры. Если возьмете 50 Гигабайт под корень — не ошибетесь.
Файловая система должна быть стабильной, потому что в инном случае вы рискуете потерять всю систему при неудачном выключении компьютера. А поэтому нам нужна журналируемая файловая система. Можно брать ext4, resierfs или btrfs. Сейчас последняя стала заметно стабильнее. Но строго не рекомендуется брать что-то вроде XFS, потому что она очень чувствительна к сбоям.
Но нельзя использовать ntfs или fat. Дело в том, что ядро использует некоторые особенности файловых систем для правильной работы, например, жесткие ссылки на конфигурационные файлы или система inotify для уведомления об изменениях в файловой системе. А эти файловые системы таких функций не поддерживают.
Раздел swap
Это раздел подкачки, куда будут отправляться неиспользуемые страницы памяти, если она переполнена. Также сюда записывается все содержимое памяти когда компьютер уходит в режим сна или гибернации. Конечно, раздел swap может быть размещен в виде файла на диске, как и в WIndows, но так будет работать быстрее. Размер рассчитывается очень просто, он должен быть равным количеству оперативной памяти. Файловая система специальная — swap.
Домашний раздел — /home
Это раздел для ваших файлов. Здесь будут ваши загрузки, документы, видео, музыка, а также настройки программ. Тут мало места быть не может поэтому берем все оставшееся. Файловая система так же как и для корня нужна стабильная и быстрая. Можно брать ту же ext4 или btrfs, или даже xfs, если вы уверенны что неожиданных сбоев и отключений питания быть не должно. разметка диска для linux для этого раздела выполняется в последнюю очередь.
Динамическое изменение размера разделов
Очень часто бывает, что разметка диска для установки linux уже выполнена система установлена и нормально работает, а через некоторое время мы понимаем, что места под тот или иной раздел было выделено мало. В таких случаях нас ждет долгая переразметка или даже полное удаление разделов, если вы сразу не предвидели такой вариант.
Во-первых, можно создать резервный раздел, после того, для которого в будущем может потребоваться много места, оставить 10 Гб про запас, чтобы потом не было проблем, не такая уж плохая идея.
Во-вторых, можно использовать LVM. Это виртуальная прослойка для работы с дисками в Linux, позволяющая динамически изменять размер разделов независимо от свободного места после и до них.
Выводы
Теперь вы знаете как выполняется разбивка диска linux и сможете справиться этой задачей. Правильная разбивка сэкономит вам потом очень много времени. Если у вас остались вопросы, спрашивайте в комментариях!
Источник
Linux Mint Forums
Welcome to the Linux Mint forums!
[Linux Mint 19 + Cinnamon] Manual install: Correct Partition sizes, Partition Order, File System types, and Encryption..
[Linux Mint 19 + Cinnamon] Manual install: Correct Partition sizes, Partition Order, File System types, and Encryption..
Post by iunlock » Tue Oct 16, 2018 1:58 am
1024GB for Linux, nothing else.)
- 24GB RAM
- I am really OCD.
Instead of installing LM19 the default way of «Erase disk and install Linux Mint*,» I would like to install it manually via «Something else,» option so that I can:
- . manage the swap area to my desired size. (I don’t need 24GB of swap area. Is 1GB enough? I don’t use hibernate, sleep etc. )
- . possibly set aside some unallocated space for provisioning? (Even necessary for SSD health with newer drives?) Update: The answer is NO. Newer SSD’s come already provisioned from the factory so unless you plan to provision 10%, in my case 100GB which is unreasonable and irrelevant to my usage scenario, don’t bother provisioning.)
- . Encrypt the partitions / volumes that need to be encrypted.
Can someone please confirm the following and verify that the:
1. Partition Sizes,
2. Partition Order,
3. Mount points,
4. File Type(s)
. are all correct for a Manual Install?
=======================copy/paste================================
- Partition 1: boot /efi (512MB) -> fat32?
+ Type for the new partition: Primary
+ Location: Beginning of this space
- Partition 2: boot (732MB) -> ext4 or ext2?
- Partition 3: main partition (rest of what’s available) -> ext4
- Partition 4: swap (1GB) -> swap area
==========================end==================================
Questions:
The reason I have listed (boot /efi) and (boot) + the partition sizes shown is because that is what it showed in ‘gparted’ on my default* (Erase disk and install Linux Mint) install, therefore I had just mimicked that. Is having both even necessary?
When creating the boot partition, should I keep it ext4 (journaled) or ext2 (not journaled)? The boot partition doesn’t need to be journaled correct? If so, I’m curious as to why by default LM19 creates the /boot as ext4 if it doesn’t need to be journaled and why some people say to set it to ext2 since it does not need to be journaled?
* Please see the attached picture(s) of the gparted screen shot of my default* install. You’ll see that the first two partitions are boot/efi (fat32) and the second partition as /boot (ext4). Also, the swap area is nowhere to be seen as it’s hidden within the main encrypted volume, which is why I am not able to resize it.
It is to my understanding that only the boot /EFI needs to be first in order. Correct?
Encryption:
If I’m wanting to Encrypt my Home folder, should anything else be encrypted as well or is there no need to encrypt other non essential partitions such as the /boot etc. ?
Is it best to Encrypt everything or to leave everything unencrypted and to just encrypt individual folders within the system?
I’m aware that this is personal preference with the con’s of encrypting your drive, potentially making it difficult for when it comes to data recovery, but I was just curious what method some of you who do encrypt use.
For the other question specifically regarding encryption and swap area, please see the 3rd post below titled:
[Linux Mint 19 + Cinnamon] How to resize swap area on an encrypted volume?
Thanks in advance to those that can shed light on this. I really appreciate it very much. Upon my hours of researching this, there are so many ways around the mountain, but all I’d like for me and for others who may be seeking this info, is a clean, basic, straight forward and concise answer for a basic manual install.
Would you be able to please copy/paste the partition info above, make edits and reply as I’ll create it in that order when performing the manual install.
* I’ll update the OP accordingly for those who may be seeking this info in the future.
Источник