Arch linux btrfs установка

Btrfs установка и использование

lsblk — подсветить все разделы чтобы определиться, что монтировать.

Так как Btrfs не может содержать swap-файл, необходимо заранее позаботиться о разделе с подкачкой, если он вам нужен.

Создаём файловую систему на разделе. Для разделов от 1ГБ и меньше, чтобы более эффективно использовать пространство, рекомендуется передать ключ -M к параметрам mkfs.btrfs .

При желании можно задать лэйбл ключом -L.

Затем создадим два подтома под корень и домашние каталоги пользователей.

Для того, чтобы монтировать подтом подобно обычному разделу диска, команде mount нужно указывать опцию subvol.

Монтируем корень. Сжатие zstd, или lzo.

Создаём директорию и монтируем в неё наш будущий каталог пользователей.

Дальше действуем по вики, т.е. выбираем зеркала и ставим базовую систему. При генерации initramfs mkinitcpio будет ругаться на отсутствие fsck.btrfs — это нормальное явление. Уберём этот хук fsck из конфига, т.к. для Btrfs он не требуется.

Вот данная строка в файле.

И ещё момент по поводу загрузчика, не знаю как другие, а grub точно умеет грузиться с Btrfs, так что выбрать лучше именно его. Так же не забудьте установить пакет btrfs-progs и позаботиться о бэкапах.

Использование btrfs #

Каталоги абсолютно идентичны, и пока мы не начнём изменять файлы, снимки места не занимают.

Откат: грузимся с live CD, монтируем корень ФС и переименовываем подтома. Так же подтома можно переименовать прямо в рабочей системе, если загрузка удачна.

Либо грузимся как обычно, а в меню grub указываем подтом с бэкапом rootflags=subvol=backup .

Копирование при записи (CoW). Если использовать команду cp с ключом —reflink=auto , то копия файла не будет занимать место на диске. И впоследствии, допустим, при изменении скопированного файла, записываться на диск будут только изменённые блоки.

Читайте также:  Linux mint apt mirror

“Онлайн” — проверка ФС. При которой осуществляется чтение всех данных/метаданных с перепроверкой контрольных сумм, при наличии ошибок обнаружение их и исправление по возможности.

Если опустить ключ -B , процесс уйдёт в фон, и о ходе выполнения можно будет узнать командой.

Рекомендуется проводить проверку регулярно (еженедельно). “Оффлайн” — проверка ФС (на отмонтированном разделе). При отсутствии ошибок утилита возвратит 0.

Установка из существующей системы или с live usb #

lsblk — подсветить все разделы что бы определиться что монтировать.

Так как Btrfs не может содержать swap-файл, необходимо заранее позаботиться о разделе с подкачкой, если он вам нужен.

Внимание! это отформатирует весь ваш диск, с потерей данных! В данном примере установка идет на весь диск, а не разделы, если вам нужен swap учтите этот момент.

Создадим два подтома под root @ и домашний каталог пользователя @home .

Создаём директорию и монтируем в неё наш будущий каталог пользователей.

Устанавливаем базовые пакеты.

Создаем директорию и монтируем boot, если нужно.

Начиная с ядра 5.0 можно создать swap-файл, swap-файл должен располагаться целиком на одном устройстве, создаваться с отключенным COW и сжатием.

Выберем локаль для системы.

Прописать в /etc/locale.conf .

 /etc/locale.conf echo "LC_COLLATE=C" >> /etc/locale.conf 
 /etc/vconsole.conf echo "FONT=cyr-sun16" >> /etc/vconsole.conf 

Создаём рам-диск mkinitcpio.

В /etc/mkinitcpio.conf , в разделе HOOKS, должен быть прописан хук keyboard keymap , убрать fsck .

В разделе MODULES нужно прописать свой драйвер видеокарты: i915 для Intel, radeon для AMD, nouveau для Nvidia.

Расскомментировать в /etc/pacman.conf .

Источник

Installing Arch Linux with Btrfs and Encryption

For those looking to install Arch Linux, it is my hope that this guide will prove useful. Most of the information here is from https://wiki.archlinux.org/. The advantage of this guide is all the information being available on one opinionated page. This guide assumes that we know how to download an Arch Linux image and boot into it, along with the system booting into UEFI mode. We will be messing with our systems so I strongly recommend to read this guide carefully. With that out of the way let’s begin.

Читайте также:  Восстановить usb флешку linux

Change console keymap

Those using a different keyboard layout may want to change the console keymap. To change to dvorak, run:

Connectivity

Next we will want to connect to the internet. If your device is plugged in via Ethernet cable then you should be good to go. Otherwise, we can connect to a Wi-Fi network using iwctl:

Update system clock

Partitioning

Now we start the process for partitioning the disks. First we will identify disks in /proc/partitions :

Image description

We are looking for a drive we want to install Arch on. The section labeled Disk model should help us identify what drive we want. In the image above, if we wanted to install on the SanDisk, the location of the block device would be /dev/sda . Since we are going to encrypt our root directory, let’s securely erase the drive. First, create a container called to_be_wiped :

cryptsetup open --type plain -d /dev/urandom /dev/ to_be_wiped 
dd bs=1M if=/dev/zero of=/dev/mapper/to_be_wiped status=progress 
cryptsetup close to_be_wiped 

With the drive erased, we will now use fdisk to partition the disk. fdisk is interactive and we will walk through the process together. First lets manipulate the drive we want to partition:

Image description

We can enter m to see the available commands. The first thing we want to do is create a new partition table. We can do that by entering g .
We need two partitions: An EFI system partition to boot and a root directory / partition to hold our data. Let’s create them now with n .
We will be prompted to assign a partition number, leave it at the default by hitting enter. Similarly, leave the first sector at the default and hit enter. Our first partition will be 512M so for the last sector enter +512M .
Change the partition type with t then 1 for EFI.
Next we create another partition with n and leave everything at their default values.
If we enter p fdisk will print out our partition table and we should see something like this: Finally, we write the partition table to disk with w .

Читайте также:  Linux права доступа обозначения

Format partitions

We can now format the partitions. First we will format the boot partition, we are looking for the device with the type EFI System . Partition it to FAT32 and label it ESP with:

In order to encrypt our data, we will need to create a Linux Unified Key Setup (LUKS) partition. Look for the device with the type Linux filesystem . Format and label it ARCH_LUKS with:

cryptsetup luksFormat --label ARCH_LUKS /dev/

After setting a password, let’s open the LUKS partition and map it to the device name of cryptroot . If using a SSD, we can disable internal read and write workqueue for increased performance with encryption using cryptsetup —perf-no_read_workqueue —perf-no_write_workqueue —persistent open /dev/ cryptroot . Otherwise:

cryptsetup open /dev/ cryptroot 

Our LUKS partition is now mapped to /dev/mapper/cryptroot . Next we’ll finally format cryptroot to Btrfs and label it ARCH :

mkfs.btrfs -L ARCH /dev/mapper/cryptroot 

Источник

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