Various instructions for setting up Linux OS on Clevo N950TP6
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

873 lines
42 KiB

  1. # UEFI partition scheme for Clevo N950TP6
  2. Partitions:
  3. - UEFI (syslinux boot)
  4. - NVMe SSD (Arch Linux file system)
  5. - HDD/SSD (user files + cache files)
  6. ## Table of Contents
  7. - [General overview](#general-overview)
  8. - [Getting started: backups & Arch Linux installation](#getting-started-backups--arch-linux-installation)
  9. - [Partition tables](#partition-tables)
  10. - [Storage roles](#storage-roles)
  11. - [Partition scheme overview](#partition-scheme-overview)
  12. - [Boot loader](#boot-loader)
  13. - [Boot partition structure](#boot-partition-structure)
  14. - [Boot partition permissions](#boot-partition-permissions)
  15. - [Filesystem structure](#filesystem-structure)
  16. - [Mount points overview](#mount-points-overview)
  17. - [/mnt location overview](#mnt-location-overview)
  18. - [fstab configuration file](#fstab-configuration-file)
  19. - [syslinux configuration file](#syslinux-configuration-file)
  20. - [mkinitcpio preset file](#mkinitcpio-preset-file)
  21. - [mkinitcpio configuration file](#mkinitcpio-configuration-file)
  22. - [Additional hints](#additional-hints)
  23. - [Retrieving UUIDs](#retrieving-uuids)
  24. - [RewriteFS](#rewritefs)
  25. - [RewriteFS - installation](#rewritefs---installation)
  26. - [RewriteFS - fstab example](#rewritefs---fstab-example)
  27. ## General overview
  28. - 3 partitions used in this scheme
  29. - Various parts of the file system, such as `/var`, exists in HDD/SSD in order to reduce redundant write operations on NVMe.
  30. - RAM used as a mounting point for `/tmp`
  31. - Swap is stored in a seperate file for modularity. It is located at `/swap/swapfile` (Yes, this is against [FHS](https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard))
  32. - UEFI partition size is 256 MiB in this installation, rest of the SSD (~250 GiB) is reserved for the Arch Linux OS
  33. - This installation method takes advantage of [bind mounting feature](https://wiki.archlinux.org/index.php/EFI_system_partition#Using_bind_mount)
  34. - Only Arch Linux installed
  35. - No Windows or any other OSes installed
  36. - Uses `syslinux` bootloader.
  37. - **NOTE:** When you create UEFI-based boot partition, you don't need to run `extlinux --install` command (unlike on BIOS-based boot partition). Just put necessary boot files, set boot flags for the boot partition and you're good to go.
  38. - **NOTE:** You don't need to run `efibootmgr`, as referred on some websites.
  39. **NOTE:** In general, you can have `EFI` partition on HDD mass storage, too. I mean: NVMe is not mandatory requirement here. However, slightly different `/etc/fstab` configuration is required than presented in [fstab configuration file](#fstab-configuration-file) section. I have tested this custom setup on my spare HDD.
  40. --------------------------
  41. ## Getting started: backups & Arch Linux installation
  42. **1)** Get an external mass storage & a Linux live USB & boot it
  43. **NOTE:** If you intend to use Linux desktop and can't access it, use additional kernel boot parameters `acpi_osi="!Windows 2015" acpi_osi=Linux`
  44. **2)** Mount your mass storage to `/mnt/backupstorage`
  45. ```
  46. mkdir -p /mnt/backupstorage
  47. mount /dev/<backupstorage> /mnt/backupstorage
  48. ```
  49. **2)** Backup your original NVMe partitions to another mass storage as a `.gz` archive (greatly reduces backup file size). Command:
  50. ```
  51. dd if=/dev/nvme0n1 conv=sync,noerror status=progress | gzip -c > /mnt/backupstorage/clevo-nvme.img.gz
  52. ```
  53. **NOTE:** You can restore the backed up partitions with command:
  54. ```
  55. gunzip -c /mnt/backupstorage/clevo-nvme.img.gz | dd of=/dev/nvme0n1 conv=sync,noerror status=progress
  56. ```
  57. **3)** Format NVMe drive (this follows partition scheme defined below):
  58. **WARNING:** Ensure you have proper partition backups before proceeding.
  59. ```
  60. fdisk /dev/nvme0n1
  61. d 1 delete partition 1
  62. d .. delete partition N (all partitions must be deleted)
  63. g create a new GPT partition table
  64. n create a new partition 1 (boot partition)
  65. p primary partition
  66. <default> default first sector
  67. +256M last sector: 256M
  68. n create a new partition 2 (filesystem partition)
  69. p primary partition
  70. <default> default first sector
  71. <default> default last sector (the whole disk. You can adjust this for your needs!)
  72. w
  73. mkfs.vfat /dev/nvme0n1p1 format NVMe boot partition to FAT32
  74. mkfs.ext4 /dev/nvme0n1p2 format NVMe file system partition to Ext4
  75. parted /dev/nvme0n1
  76. toggle 1 boot toggle boot flag on boot partition
  77. toggle 1 esp toggle esp flag (EFI) on boot partition (unless already exists!)
  78. ```
  79. **4)** Install Arch Linux:
  80. **4.1)** Mount `/dev/nvme0n1p2` to `/mnt/archsystem` (`mkdir -p /mnt/archsystem && mount /dev/nvme0n1p2 /mnt/archsystem`)
  81. **4.2)** Deploy Arch Linux system into `/mnt/archsystem`:
  82. A) If you use non-Arch Linux live USB distribution, use [arch-bootstrap](https://github.com/tokland/arch-bootstrap) shell script.
  83. B) On Arch Linux based live USB distribution, use `pacstrap` command which is supplied with [arch-install-scripts](https://www.archlinux.org/packages/extra/any/arch-install-scripts/) package.
  84. **5)** Mount `/dev/nvme0n1p1` to `/mnt/archsystem/boot_efi` (`mkdir -p /mnt/archsystem/boot_efi && mount /dev/nvme0n1p1 /mnt/archsystem/boot_efi`)
  85. **6)** Access the Arch Linux system with `arch-chroot` command.
  86. **7)** In chrooted environment, install [syslinux](https://www.archlinux.org/packages/core/x86_64/syslinux/) & [intel-ucode](https://www.archlinux.org/packages/extra/any/intel-ucode/). Follow file system scheme defined in the following sections:
  87. - [Boot partition structure](#boot-partition-structure)
  88. - [Filesystem structure](#filesystem-structure)
  89. - [fstab configuration file](#fstab-configuration-file)
  90. - [syslinux configuration file](#syslinux-configuration-file)
  91. - [mkinitcpio preset file](#mkinitcpio-preset-file)
  92. - [mkinitcpio configuration file](#mkinitcpio-configuration-file)
  93. **NOTE:** Use default `$HOME` locations for all users (root's home should point to `/root` and other users to `/home/<user>`). Nothing special here, just use defaults.
  94. **8)** Once the system is configured, check your configuration:
  95. - Check basic settings, such as `hostname`, `localectl`, timedatectl`, `locale-gen`, and your user-specific configurations
  96. - Check you have properly set up boot files & configuration (EFI partition, `init` symbolic link, etc.)
  97. - Test that initial RAM disk images (`initramfs.img`, `initramfs-fallback.img`) & Linux kernel image are generated into `/boot_efi` instead of default `/boot` location. You can test this with `mkinitcpio -p linux` command.
  98. - In some rare cases, you may need to reinstall `systemd`. I once dropped into `rootfs` shell, and ultimately fixed this by reinstalling `systemd`
  99. --------------------------
  100. ## Partition tables
  101. The following sheet represents the desired partition tables for various mass storage devides used in this setup.
  102. | Mass Storage | Partition table |
  103. |------------------|-----------------|
  104. | Internal NVMe | gpt * |
  105. | Internal HDD/SSD | gpt/dos |
  106. * GPT (`gpt`) partition table is required for `UEFI` support. GPT partition table should be applied to the mass storage you will install your `EFI` boot partition into.
  107. - DOS (`dos`) partition table is compatible with BIOS only. In UEFI setup, you can use DOS partition table on any mass storage you don't directly intended to use for booting process.
  108. - If you have DOS partition table on your mass storage which contains boot partition, the mass storage can only be used for BIOS-mode booting.
  109. - You can boot this laptop using either BIOS or UEFI mode. UEFI is recommended.
  110. - You can switch between BIOS & UEFI modes in [setup menu](images/bios/bios_4.jpg).
  111. ## Storage roles
  112. The following sheet represents a general overview of desired partition scheme.
  113. | Role | Location | Partition | Partition Size | Type | Flags |
  114. |-------------------|-------------------------|-----------|----------------|-------------|-------------|
  115. | Boot files | Internal NVMe | 1 | 256 MiB | FAT32, EFI | boot, esp * |
  116. | Operating System | Internal NVMe | 2 | Any | Ext4 | - |
  117. | User files & dirs | Internal HDD/SSD (2.5") | Any | Any | Ext4 ** | - |
  118. * `boot, esp` flags are available only for GPT partitioned mass storage. For DOS, only `boot` flag can be used.
  119. ** If you intended to store `$HOME` folders of system users, you should use a partition type which supports Unix-type permission scheme. Thus, NTFS and similar solutions are invalid options for this mass storage. Keep in mind that many Unix-like partition types may be incompatible on Microsoft Windows OSes.
  120. ## Partition scheme overview
  121. - Internal NVMe is referred as `/dev/nvme0n1`
  122. - Internal 1 TiB HDD is referred as `/dev/sda`
  123. ```
  124. > fdisk -l
  125. Disk /dev/nvme0n1: 232.9 GiB, 250059350016 bytes, 488397168 sectors
  126. Units: sectors of 1 * 512 = 512 bytes
  127. Sector size (logical/physical): 512 bytes / 512 bytes
  128. I/O size (minimum/optimal): 512 bytes / 512 bytes
  129. Disklabel type: gpt
  130. Disk identifier: B4ED4BFE-7300-4B6E-8DE4-74D91681A89C
  131. Device Start End Sectors Size Type
  132. /dev/nvme0n1p1 2048 526335 524288 256M EFI System
  133. /dev/nvme0n1p2 526336 488396799 487870464 232.7G Linux filesystem
  134. Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
  135. Disk model: WDC WD10JPVX-75J
  136. Units: sectors of 1 * 512 = 512 bytes
  137. Sector size (logical/physical): 512 bytes / 4096 bytes
  138. I/O size (minimum/optimal): 4096 bytes / 4096 bytes
  139. Disklabel type: gpt
  140. Disk identifier: C4C74840-056F-4C6F-9351-728CB43B2E17
  141. Device Start End Sectors Size Type
  142. /dev/sda1 2048 1953523711 1953521664 931.5G Linux filesystem
  143. ```
  144. ```
  145. > parted -l
  146. Model: ATA WDC WD10JPVX-75J (scsi)
  147. Disk /dev/sda: 1000GB
  148. Sector size (logical/physical): 512B/4096B
  149. Partition Table: gpt
  150. Disk Flags:
  151. Number Start End Size File system Name Flags
  152. 1 1049kB 1000GB 1000GB ext4
  153. Model: Unknown (unknown)
  154. Disk /dev/nvme0n1: 250GB
  155. Sector size (logical/physical): 512B/512B
  156. Partition Table: gpt
  157. Disk Flags:
  158. Number Start End Size File system Name Flags
  159. 1 1049kB 269MB 268MB fat32 boot, esp
  160. 2 269MB 233GB 232GB ext4
  161. ```
  162. --------------------------
  163. ## Boot loader
  164. - Pretty simple to set up
  165. - Existing `syslinux` installation used
  166. ### Boot partition structure
  167. ```
  168. . EFI partition mount point
  169. |
  170. └─────────────────────────────────────EFI─────────────────────────────────────
  171. | | |
  172. BOOT syslinux |
  173. ├── bootx64.efi * ├── syslinux.efi * ├── initramfs-linux-fallback.img (fallback initramfs image)
  174. ├── cat.c32 ├── cat.c32 ├── initramfs-linux.img (initramfs image)
  175. ├── chain.c32 ├── chain.c32 ├── vmlinuz-linux (kernel image)
  176. ├── cmd.c32 ├── cmd.c32 └── intel-ucode.img (from package `intel-ucode`)
  177. ├── cmenu.c32 ├── cmenu.c32
  178. ├── config.c32 ├── config.c32
  179. ├── cptime.c32 ├── cptime.c32
  180. ├── cpu.c32 ├── cpu.c32
  181. ├── cpuid.c32 ├── cpuid.c32
  182. ├── cpuidtest.c32 ├── cpuidtest.c32
  183. ├── debug.c32 ├── debug.c32
  184. ├── dhcp.c32 ├── dhcp.c32
  185. ├── dir.c32 ├── dir.c32
  186. ├── dmi.c32 ├── dmi.c32
  187. ├── dmitest.c32 ├── dmitest.c32
  188. ├── gfxboot.c32 ├── gfxboot.c32
  189. ├── hdt.c32 ├── hdt.c32
  190. ├── hexdump.c32 ├── hexdump.c32
  191. ├── host.c32 ├── host.c32
  192. ├── ifcpu64.c32 ├── ifcpu64.c32
  193. ├── ifcpu.c32 ├── ifcpu.c32
  194. ├── ldlinux.e64 ├── ldlinux.e64
  195. ├── lfs.c32 ├── lfs.c32
  196. ├── libcom32.c32 ├── libcom32.c32
  197. ├── libgpl.c32 ├── libgpl.c32
  198. ├── liblua.c32 ├── liblua.c32
  199. ├── libmenu.c32 ├── libmenu.c32
  200. ├── libutil.c32 ├── libutil.c32
  201. ├── linux.c32 ├── linux.c32
  202. ├── ls.c32 ├── ls.c32
  203. ├── lua.c32 ├── lua.c32
  204. ├── mboot.c32 ├── mboot.c32
  205. ├── meminfo.c32 ├── meminfo.c32
  206. ├── menu.c32 ├── menu.c32
  207. ├── pci.c32 ├── pci.c32
  208. ├── pwd.c32 ├── pwd.c32
  209. ├── reboot.c32 ├── reboot.c32
  210. ├── rosh.c32 ├── rosh.c32
  211. ├── sysdump.c32 ├── sysdump.c32
  212. ├── syslinux.c32 ├── syslinux.c32
  213. ├── syslinux.cfg * ├── syslinux.cfg *
  214. ├── vesa.c32 ├── vesa.c32
  215. ├── vesamenu.c32 ├── vesamenu.c32
  216. ├── vpdtest.c32 ├── vpdtest.c32
  217. ├── whichsys.c32 ├── whichsys.c32
  218. └── zzjson.c32 └── zzjson.c32
  219. ```
  220. * Duplicate files with equivalent contents. Although all files are duplicates, you should pay attention especially to these files.
  221. Basically, you need:
  222. - A) existing `syslinux` installation
  223. - B) Copy files from `/usr/lib/syslinux/efi64/` to the `EFI/BOOT/` and `EFI/syslinux/` subfolders presented above.
  224. Be aware: `.c32` files presented here may vary depending on version of your `syslinux` package. It should be fine, though.
  225. ### Boot partition permissions
  226. **NOTE:** You don't need to set these manually if you use proper `/etc/fstab` entry mask values as defined in [fstab configuration file](#fstab-configuration-file). These values are here so you can just check them.
  227. | Permissions | Owner (user:group) | Type | Item Name |
  228. |------------------|--------------------|-----------|------------------------------------|
  229. | rwxr-xr-x (0755) | root:root | Directory | ./EFI |
  230. | rwxr-xr-x (0755) | root:root | Directory | ./EFI/BOOT |
  231. | rwxr-xr-x (0755) | root:root | Directory | ./EFI/syslinux |
  232. | rw-r--r-- (0644) | root:root | File | ./EFI/initramfs-linux-fallback.img |
  233. | rw-r--r-- (0644) | root:root | File | ./EFI/initramfs-linux.img |
  234. | rw-r--r-- (0644) | root:root | File | ./EFI/vmlinuz-linux |
  235. | rw-r--r-- (0644) | root:root | File | ./EFI/intel-ucode.img |
  236. | ---------------- | --------- | --------- | ---------------------------------- |
  237. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/bootx64.efi |
  238. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/cat.c32 |
  239. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/chain.c32 |
  240. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/cmd.c32 |
  241. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/cmenu.c32 |
  242. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/config.c32 |
  243. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/cptime.c32 |
  244. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/cpu.c32 |
  245. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/cpuid.c32 |
  246. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/cpuidtest.c32 |
  247. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/debug.c32 |
  248. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/dhcp.c32 |
  249. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/dir.c32 |
  250. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/dmi.c32 |
  251. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/dmitest.c32 |
  252. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/gfxboot.c32 |
  253. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/hdt.c32 |
  254. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/hexdump.c32 |
  255. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/host.c32 |
  256. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/ifcpu64.c32 |
  257. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/ifcpu.c32 |
  258. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/ldlinux.e64 |
  259. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/lfs.c32 |
  260. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/libcom32.c32 |
  261. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/libgpl.c32 |
  262. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/liblua.c32 |
  263. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/libmenu.c32 |
  264. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/libutil.c32 |
  265. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/linux.c32 |
  266. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/ls.c32 |
  267. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/lua.c32 |
  268. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/mboot.c32 |
  269. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/meminfo.c32 |
  270. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/menu.c32 |
  271. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/pci.c32 |
  272. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/pwd.c32 |
  273. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/reboot.c32 |
  274. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/rosh.c32 |
  275. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/sysdump.c32 |
  276. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/syslinux.c32 |
  277. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/syslinux.cfg |
  278. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/vesa.c32 |
  279. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/vesamenu.c32 |
  280. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/vpdtest.c32 |
  281. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/whichsys.c32 |
  282. | rw-r--r-- (0644) | root:root | File | ./EFI/BOOT/zzjson.c32 |
  283. | ---------------- | --------- | --------- | ---------------------------------- |
  284. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/cat.c32 |
  285. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/chain.c32 |
  286. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/cmd.c32 |
  287. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/cmenu.c32 |
  288. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/config.c32 |
  289. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/cptime.c32 |
  290. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/cpu.c32 |
  291. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/cpuid.c32 |
  292. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/cpuidtest.c32 |
  293. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/debug.c32 |
  294. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/dhcp.c32 |
  295. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/dir.c32 |
  296. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/dmi.c32 |
  297. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/dmitest.c32 |
  298. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/gfxboot.c32 |
  299. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/hdt.c32 |
  300. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/hexdump.c32 |
  301. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/host.c32 |
  302. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/ifcpu64.c32 |
  303. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/ifcpu.c32 |
  304. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/ldlinux.e64 |
  305. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/lfs.c32 |
  306. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/libcom32.c32 |
  307. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/libgpl.c32 |
  308. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/liblua.c32 |
  309. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/libmenu.c32 |
  310. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/libutil.c32 |
  311. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/linux.c32 |
  312. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/ls.c32 |
  313. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/lua.c32 |
  314. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/mboot.c32 |
  315. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/meminfo.c32 |
  316. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/menu.c32 |
  317. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/pci.c32 |
  318. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/pwd.c32 |
  319. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/reboot.c32 |
  320. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/rosh.c32 |
  321. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/sysdump.c32 |
  322. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/syslinux.c32 |
  323. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/syslinux.cfg |
  324. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/syslinux.efi |
  325. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/vesa.c32 |
  326. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/vesamenu.c32 |
  327. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/vpdtest.c32 |
  328. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/whichsys.c32 |
  329. | rw-r--r-- (0644) | root:root | File | ./EFI/syslinux/zzjson.c32 |
  330. ## Filesystem structure
  331. ### Mount points overview
  332. | Item Name | Item Type | Partition | Partition format |
  333. |-------------|----------------------------------------------|-----------------------|------------------|
  334. | /bin | Symbolic link (to usr/bin) | NVMe, 2 (OS) | Ext4 |
  335. | /boot ***** | Directory | NVMe, 2 (OS) | Ext4 |
  336. | /boot_efi * | Directory | NVMe, 1 (Boot) | FAT32/EFI |
  337. | /dev | Directory | NVMe, 2 (OS) | Ext4 |
  338. | /etc | Directory | NVMe, 2 (OS) | Ext4 |
  339. | /home | Directory (bind) ** | HDD/SSD (User files) | Ext4 |
  340. | /init | Symbolic link (to `usr/lib/systemd/systemd`) | NVMe, 2 (OS) | Ext4 |
  341. | /lib | Symbolic link (to `usr/lib`) | NVMe, 2 (OS) | Ext4 |
  342. | /lib64 | Symbolic link (to `usr/lib`) | NVMe, 2 (OS) | Ext4 |
  343. | /lost+found | Directory | NVMe, 2 (OS) | Ext4 |
  344. | /mnt *** | Directory | NVMe, 2 (OS) | Ext4 |
  345. | /opt | Directory | NVMe, 2 (OS) | Ext4 |
  346. | /proc | Directory | NVMe, 2 (OS) | Ext4 |
  347. | /root | Directory (bind) ** | HDD/SSD (User files) | Ext4 |
  348. | /run | Directory | NVMe, 2 (OS) | Ext4 |
  349. | /sbin | Symbolic link (to `usr/bin`) | NVMe, 2 (OS) | Ext4 |
  350. | /swap **** | Directory (bind) ** | HDD/SSD (Cache files) | Ext4 |
  351. | /srv | Directory | NVMe, 2 (OS) | Ext4 |
  352. | /sys | Directory | NVMe, 2 (OS) | Ext4 |
  353. | /tmp | Directory | RAM | tmpfs |
  354. | /usr | Directory | NVMe, 2 (OS) | Ext4 |
  355. | /var | Directory (bind) ** | HDD/SSD (Cache files) | Ext4 |
  356. * Mount point `/boot_efi` for UEFI boot partition is defined in `/etc/fstab`. Please see [fstab configuration file](#fstab-configuration file) for additional information.
  357. ** `bind` option is defined in `/etc/fstab`. Please see the following diagram.
  358. *** Directory `/mnt` contains directories existing on HDD/SSD (User files). Please see the following diagram.
  359. **** Optional: non-standard location for a SWAP file. Please see [Arch Wiki - Swap file](https://wiki.archlinux.org/index.php/Swap#Swap_file) for additional information.
  360. ***** `/boot` folder contains only `intel-ucode.img` file, provided by Arch Linux package `intel-ucode`. Otherwise, `/boot` folder is empty and all necessary boot files are in `/boot_efi`
  361. ### `/mnt` location overview
  362. | Item Name | Item Type | Partition | Partition format |
  363. |----------------------|-------------------------------|-----------|------------------|
  364. | /mnt/hdd | Directory | HDD/SSD | Ext4 |
  365. | /mnt/hdd/home | Directory (binded to `/home`) | HDD/SSD | Ext4 |
  366. | /mnt/hdd/home/<user> | Directory | HDD/SSD | Ext4 |
  367. | /mnt/hdd/home/root | Directory (binded to `/root`) | HDD/SSD | Ext4 |
  368. | /mnt/hdd/var | Directory (binded to `/var`) | HDD/SSD | Ext4 |
  369. | /mnt/hdd/lost+found | Directory | HDD/SSD | Ext4 |
  370. | /mnt/hdd/swap | Directory (binded to `/swap`) | HDD/SSD | Ext4 |
  371. `<user>` refers to your Linux file system user account(s).
  372. ## fstab configuration file
  373. The following `/etc/fstab` configuration corresponds to the file system structure explained above.
  374. Please configure `UUID` values for your setup. You must use proper `UUID` values instead of the ones presented below (see [Retrieving UUIDs](#retrieving-uuids)). Additionally, use proper username string for `<user>`.
  375. ```
  376. > cat /etc/fstab
  377. #
  378. # /etc/fstab: static file system information
  379. #
  380. # <file system> <dir> <type> <options> <dump> <pass>
  381. #
  382. #########################################
  383. # NVMe: M.2 - FILE SYSTEM PARTITION
  384. # Root system
  385. UUID=9148225b-d661-4e4a-801c-f5bdc48f509e / ext4 defaults,noatime,discard 0 1
  386. #########################################
  387. # Boot files - FAT32 partition, needs mask values
  388. UUID=927D-38E4 /boot_efi vfat defaults,dmask=0022,fmask=0133 0 0
  389. #########################################
  390. # RAM & SWAP
  391. # temporary folders
  392. tmpfs /tmp tmpfs nodev,nosuid,size=20480M,nr_inodes=500k 0 0
  393. # Swap memory file (optional)
  394. /mnt/hdd/swap /swap none bind 0 0
  395. /swap/swapfile none swap defaults 0 0
  396. #########################################
  397. # HDD: SATA - USER FILES PARTITION
  398. UUID=fba31569-c25c-4e30-b117-9ea83c41a8bd /mnt/hdd ext4 defaults,discard 0 2
  399. #########################################
  400. # Bind folders
  401. # /var folder
  402. /mnt/hdd/var /var none bind 0 0
  403. # Home folders
  404. /mnt/hdd/home/root /root none bind 0 0
  405. /root /home/root none bind 0 0
  406. #########################################
  407. # Optional: mount your cache folders to RAM
  408. #tmpfs /home/<user>/.cache tmpfs size=15%,mode=0777,uid=1000,gid=1000 0 0
  409. ```
  410. ## syslinux configuration file
  411. This configuration applies to the files `EFI/BOOT/syslinux.cfg` & `EFI/syslinux/syslinux.cfg` on NVMe partition 1 (Boot). Please configure `APPEND` kernel parameters properly for your setup. At least, you must use proper `UUID` values instead of the ones presented below (see [Retrieving UUIDs](#retrieving-uuids)).
  412. ```
  413. # Config file for Syslinux -
  414. # /boot/syslinux/syslinux.cfg
  415. #
  416. # Comboot modules:
  417. # * menu.c32 - provides a text menu
  418. # * vesamenu.c32 - provides a graphical menu
  419. # * chain.c32 - chainload MBRs, partition boot sectors, Windows bootloaders
  420. # * hdt.c32 - hardware detection tool
  421. # * reboot.c32 - reboots the system
  422. #
  423. # To Use: Copy the respective files from /usr/lib/syslinux to /boot/syslinux.
  424. # If /usr and /boot are on the same file system, symlink the files instead
  425. # of copying them.
  426. #
  427. # If you do not use a menu, a 'boot:' prompt will be shown and the system
  428. # will boot automatically after 5 seconds.
  429. #
  430. # Please review the wiki: https://wiki.archlinux.org/index.php/Syslinux
  431. # The wiki provides further configuration examples
  432. DEFAULT arch
  433. PROMPT 0 # Set to 1 if you always want to display the boot: prompt
  434. TIMEOUT 5
  435. # You can create syslinux keymaps with the keytab-lilo tool
  436. #KBDMAP de.ktl
  437. # Menu Configuration
  438. # Either menu.c32 or vesamenu32.c32 must be copied to /boot/syslinux
  439. UI menu.c32
  440. #UI vesamenu.c32
  441. # Refer to http://syslinux.zytor.com/wiki/index.php/Doc/menu
  442. MENU TITLE Boot Menu
  443. #MENU BACKGROUND splash.jpg
  444. MENU COLOR border 30;44 #40ffffff #a0000000 std
  445. MENU COLOR title 1;36;44 #9033ccff #a0000000 std
  446. MENU COLOR sel 7;37;40 #e0ffffff #20ffffff all
  447. MENU COLOR unsel 37;44 #50ffffff #a0000000 std
  448. MENU COLOR help 37;40 #c0ffffff #a0000000 std
  449. MENU COLOR timeout_msg 37;40 #80ffffff #00000000 std
  450. MENU COLOR timeout 1;37;40 #c0ffffff #00000000 std
  451. MENU COLOR msg07 37;40 #90ffffff #a0000000 std
  452. MENU COLOR tabmsg 31;40 #30ffffff #00000000 std
  453. #MENU RESOLUTION 1920 1080
  454. #Clear the screen when exiting the menu
  455. MENU CLEAR
  456. # boot sections follow
  457. #
  458. # TIP: If you want a 1024x768 framebuffer, add "vga=773" to your kernel line.
  459. # 895 = 1920x1080x32 framebuffer
  460. #
  461. LABEL arch
  462. MENU LABEL Arch Linux
  463. LINUX ../vmlinuz-linux
  464. INITRD ../initramfs-linux.img
  465. APPEND root=UUID=9148225b-d661-4e4a-801c-f5bdc48f509e rw vga=895 acpi_osi="!Windows 2015" acpi_osi=Linux nowatchdog nogpumanager rd.udev.log-priority=3 vm.swappiness=10 net.ifnames=0 biosdevname=0 cgroup_no_v1=all
  466. LABEL archshell
  467. MENU LABEL Arch Linux (shell)
  468. LINUX ../vmlinuz-linux
  469. INITRD ../initramfs-linux.img
  470. APPEND root=UUID=9148225b-d661-4e4a-801c-f5bdc48f509e rw vga=895 systemd.unit=multi-user.target nowatchdog vm.swappiness=10 net.ifnames=0 biosdevname=0 cgroup_no_v1=all
  471. LABEL archfallback
  472. MENU LABEL Arch Linux Fallback
  473. LINUX ../vmlinuz-linux
  474. INITRD ../initramfs-linux-fallback.img
  475. APPEND root=UUID=9148225b-d661-4e4a-801c-f5bdc48f509e rw vga=895 acpi_osi="!Windows 2015" acpi_osi=Linux nowatchdog vm.swappiness=10 net.ifnames=0 biosdevname=0
  476. LABEL archfallback-rescue
  477. MENU LABEL Arch Linux Fallback (rescue mode)
  478. LINUX ../vmlinuz-linux
  479. INITRD ../initramfs-linux-fallback.img
  480. APPEND root=UUID=9148225b-d661-4e4a-801c-f5bdc48f509e vga=895 systemd.unit=multi-user.target nowatchdog vm.swappiness=10 net.ifnames=0 biosdevname=0
  481. #LABEL windows
  482. # MENU LABEL Windows
  483. # COM32 chain.c32
  484. # APPEND hd0 1
  485. ## These do not work with UEFI
  486. #LABEL hdt
  487. # MENU LABEL HDT (Hardware Detection Tool)
  488. # COM32 hdt.c32
  489. #LABEL reboot
  490. # MENU LABEL Reboot
  491. # COM32 reboot.c32
  492. #LABEL poweroff
  493. # MENU LABEL Poweroff
  494. # COM32 poweroff.c32
  495. ```
  496. ## mkinitcpio preset file
  497. Custom `/etc/mkinitcpio.d/linux.preset` file is recommended for this setup. Each time you run `mkinitcpio -p linux` or update Linux kernel or systemd configuration, proper initrd and kernel files are automatically generated in proper location (`/boot_efi/` in this setup) without additional hassle.
  498. ```
  499. > cat /etc/mkinitcpio.d/linux.preset
  500. # mkinitcpio preset file for the 'linux' package
  501. ESP_DIR="/boot_efi/EFI"
  502. ALL_config="/etc/mkinitcpio.conf"
  503. ALL_kver="${ESP_DIR}/vmlinuz-linux"
  504. PRESETS=('default' 'fallback')
  505. #default_config="/etc/mkinitcpio.conf"
  506. default_image="${ESP_DIR}/initramfs-linux.img"
  507. default_options="-A esp-update-linux"
  508. #fallback_config="/etc/mkinitcpio.conf"
  509. fallback_image="${ESP_DIR}/initramfs-linux-fallback.img"
  510. fallback_options="-S autodetect"
  511. ```
  512. ## mkinitcpio configuration file
  513. The following `/etc/mkinitcpio.conf` file works in this setup. The file is used to configure initial RAM disk files (`initramfs.img`, `initramfs-fallback.img`). Not all modules listed in `MODULES` array are required, but they have been left for [Optimus/Intel GPU passthrough setup](https://gist.github.com/agentsim/e89beb42ede85714a24529b2a6798bb8) I once had.
  514. ```
  515. # vim:set ft=sh
  516. # MODULES
  517. # The following modules are loaded before any boot hooks are
  518. # run. Advanced users may wish to specify all system modules
  519. # in this array. For instance:
  520. # MODULES=(piix ide_disk reiserfs)
  521. MODULES=(vfio vfio_iommu_type1 vfio_pci vfio_virqfd vhost-net pci-stub)
  522. # BINARIES
  523. # This setting includes any additional binaries a given user may
  524. # wish into the CPIO image. This is run last, so it may be used to
  525. # override the actual binaries included by a given hook
  526. # BINARIES are dependency parsed, so you may safely ignore libraries
  527. BINARIES=()
  528. # FILES
  529. # This setting is similar to BINARIES above, however, files are added
  530. # as-is and are not parsed in any way. This is useful for config files.
  531. FILES=()
  532. # HOOKS
  533. # This is the most important setting in this file. The HOOKS control the
  534. # modules and scripts added to the image, and what happens at boot time.
  535. # Order is important, and it is recommended that you do not change the
  536. # order in which HOOKS are added. Run 'mkinitcpio -H <hook name>' for
  537. # help on a given hook.
  538. # 'base' is _required_ unless you know precisely what you are doing.
  539. # 'udev' is _required_ in order to automatically load modules
  540. # 'filesystems' is _required_ unless you specify your fs modules in MODULES
  541. # Examples:
  542. ## This setup specifies all modules in the MODULES setting above.
  543. ## No raid, lvm2, or encrypted root is needed.
  544. # HOOKS=(base)
  545. #
  546. ## This setup will autodetect all modules for your system and should
  547. ## work as a sane default
  548. # HOOKS=(base udev autodetect block filesystems)
  549. #
  550. ## This setup will generate a 'full' image which supports most systems.
  551. ## No autodetection is done.
  552. # HOOKS=(base udev block filesystems)
  553. #
  554. ## This setup assembles a pata mdadm array with an encrypted root FS.
  555. ## Note: See 'mkinitcpio -H mdadm' for more information on raid devices.
  556. # HOOKS=(base udev block mdadm encrypt filesystems)
  557. #
  558. ## This setup loads an lvm2 volume group on a usb device.
  559. # HOOKS=(base udev block lvm2 filesystems)
  560. #
  561. ## NOTE: If you have /usr on a separate partition, you MUST include the
  562. # usr, fsck and shutdown hooks.
  563. HOOKS=(base udev autodetect modconf block filesystems keyboard fsck)
  564. # COMPRESSION
  565. # Use this to compress the initramfs image. By default, gzip compression
  566. # is used. Use 'cat' to create an uncompressed image.
  567. #COMPRESSION="gzip"
  568. #COMPRESSION="bzip2"
  569. #COMPRESSION="lzma"
  570. #COMPRESSION="xz"
  571. #COMPRESSION="lzop"
  572. #COMPRESSION="lz4"
  573. # COMPRESSION_OPTIONS
  574. # Additional options for the compressor
  575. #COMPRESSION_OPTIONS=()
  576. ```
  577. --------------------------
  578. ## Additional hints
  579. ### Retrieving UUIDs
  580. Run `blkid` command as root or with `sudo`.
  581. --------------------------
  582. ## RewriteFS
  583. RewriteFS is a solution to force writing of all hidden [dot files]() into `$HOME/.config` location. Of course, this is just a default setup and can be configured further.
  584. RewriteFS is available in AUR as [rewritefs-git](https://aur.archlinux.org/packages/rewritefs-git/) package.
  585. **WARNING:** Using `rewritefs` may increase your HDD usage in heavy file operations.
  586. ### RewriteFS - installation
  587. **1)** Install RewriteFS (AUR: [rewritefs-git](https://aur.archlinux.org/packages/rewritefs-git/))
  588. **2)** Move all your dotfiles and dotfolders from `$HOME` to `$HOME/.config/` folder (excluding `.config`, `.cache` & `.local` folders). Remove the dot prefix from the names of those moved dotfiles/folders. You should end up of having only three dotfolders in your `$HOME` directory: `.cache`, `.config` and `.local` (and no dotfiles at all). All your previous dotfiles/folders are now in `$HOME/.config`, without the dot prefix in their name. Right? Good. Go ahead.
  589. **3)** Add file `/etc/rewritefs.conf` with the following contents:
  590. ```
  591. m#^(?!\.)# .
  592. m#^\.(cache|config|local)# .
  593. m#^\.# .config/
  594. ```
  595. **4)** Uncomment `user_allow_other` in `/etc/fuse.conf`. According to the rewritefs author, you must do it:
  596. ```
  597. The files are owned by the user of the process that create them, which is rewritefs, not your applications. You have to run rewritefs as [user], not root.
  598. ```
  599. **5)** Configure your fstab. Use `/etc/fstab` example below as a configuration reference.
  600. **NOTE:** It is important to set `<user>` UID and `<user>` GID bits in `/etc/fstab`. Otherwise you may end up creating new files which belong to group root instead of your actual primary group in `$HOME`.
  601. **6)** Log out, switch to another TTY and login as another user or alternatively unmount the partition where your `$HOME` locates at.
  602. **7)** Reboot the system
  603. ### RewriteFS - fstab example
  604. ```
  605. > cat /etc/fstab
  606. #
  607. # /etc/fstab: static file system information
  608. #
  609. # <file system> <dir> <type> <options> <dump> <pass>
  610. #
  611. #########################################
  612. # NVMe: M.2 - FILE SYSTEM PARTITION
  613. # Root system
  614. UUID=9148225b-d661-4e4a-801c-f5bdc48f509e / ext4 defaults,noatime,discard 0 1
  615. #########################################
  616. # Boot files - FAT32 partition, needs mask values
  617. UUID=927D-38E4 /boot_efi vfat defaults,dmask=0022,fmask=0133 0 0
  618. #########################################
  619. # RAM & SWAP
  620. # temporary folders
  621. tmpfs /tmp tmpfs nodev,nosuid,size=20480M,nr_inodes=500k 0 0
  622. # Swap memory file (optional)
  623. /mnt/hdd/swap /swap none bind 0 0
  624. /swap/swapfile none swap defaults 0 0
  625. #########################################
  626. # HDD: SATA - USER FILES PARTITION
  627. UUID=fba31569-c25c-4e30-b117-9ea83c41a8bd /mnt/hdd ext4 defaults,discard 0 2
  628. #########################################
  629. # Bind folders
  630. # /var folder
  631. /mnt/hdd/var /var none bind 0 0
  632. # Home folders
  633. /mnt/hdd/home/root /root none bind 0 0
  634. /root /home/root none bind 0 0
  635. /mnt/hdd/home/<user> /home/<user> rewritefs config=/etc/rewritefs.conf,allow_other,uid=1000,gid=1000 0 0
  636. #########################################
  637. # Optional: mount your cache folders to RAM
  638. NOTE: When rewritefs is being used, mount order must be /tmp and then /home folders. This is because contents of user's .cache folder is written to /tmp/user_cache folder
  639. #tmpfs /home/<user>/.cache tmpfs size=15%,mode=0777,uid=1000,gid=1000 0 0
  640. ```
  641. ```
  642. > stat -c "%A %G:%U %n" /etc/rewritefs.conf
  643. -rw-r--r-- root:root /etc/rewritefs.conf
  644. ```
  645. Common syntax for RewriteFS fstab entry is as follows (not related in this setup):
  646. ```
  647. /mnt/home/<user> /home/<user> rewritefs config=/etc/rewritefs.conf,allow_other,uid=<user UID>,gid=<user GID> 0 0
  648. ```