How to add swap file after installation?

I am triple booting Pop OS, Manjaro, Kali, in install chronological order.

inxi -Fazy

[soumi@Hori ~]$ inxi -Fazy
System:
  Kernel: 5.14.10-1-MANJARO x86_64 bits: 64 compiler: gcc v: 11.1.0
  parameters: BOOT_IMAGE=/boot/vmlinuz-5.14-x86_64
  root=UUID=df259137-f86a-44a7-80a9-a84ff6065301 rw quiet apparmor=1
  security=apparmor udev.log_priority=3
  Desktop: KDE Plasma 5.22.5 tk: Qt 5.15.2 wm: kwin_x11 vt: 1 dm: SDDM
  Distro: Manjaro Linux base: Arch Linux
Machine:
  Type: Laptop System: Acer product: Aspire A514-53 v: V1.16 serial: <filter>
  Chassis: type: 10 serial: <filter>
  Mobo: IL model: Sneezy_IL v: V1.16 serial: <filter> UEFI: Insyde v: 1.16
  date: 01/18/2021
Battery:
  ID-1: BAT0 charge: 31.8 Wh (100.0%) condition: 31.8/53.0 Wh (60.1%)
  volts: 16.7 min: 15.4 model: PANASONIC KT004 AP19B5L type: Li-ion
  serial: <filter> status: Charging cycles: 386
CPU:
  Info: Dual Core model: Intel Core i3-1005G1 bits: 64 type: MT MCP
  arch: Ice Lake family: 6 model-id: 7E (126) stepping: 5 microcode: A6 cache:
  L2: 4 MiB
  flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
  bogomips: 9524
  Speed: 2668 MHz min/max: 400/3400 MHz Core speeds (MHz): 1: 2668 2: 2973
  3: 3143 4: 3246
  Vulnerabilities: Type: itlb_multihit status: KVM: VMX disabled
  Type: l1tf status: Not affected
  Type: mds status: Not affected
  Type: meltdown status: Not affected
  Type: spec_store_bypass
  mitigation: Speculative Store Bypass disabled via prctl and seccomp
  Type: spectre_v1
  mitigation: usercopy/swapgs barriers and __user pointer sanitization
  Type: spectre_v2 mitigation: Enhanced IBRS, IBPB: conditional, RSB filling
  Type: srbds status: Not affected
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: Intel Iris Plus Graphics G1 vendor: Acer Incorporated ALI
  driver: i915 v: kernel bus-ID: 00:02.0 chip-ID: 8086:8a56 class-ID: 0300
  Device-2: Chicony HD User Facing type: USB driver: uvcvideo bus-ID: 1-6:3
  chip-ID: 04f2:b64f class-ID: 0e02 serial: <filter>
  Display: x11 server: X.Org 1.20.13 compositor: kwin_x11 driver:
  loaded: modesetting alternate: fbdev,vesa display-ID: :0 screens: 1
  Screen-1: 0 s-res: 1366x768 s-dpi: 96 s-size: 361x203mm (14.2x8.0")
  s-diag: 414mm (16.3")
  Monitor-1: eDP-1 res: 1366x768 hz: 60 dpi: 112 size: 309x173mm (12.2x6.8")
  diag: 354mm (13.9")
  OpenGL: renderer: Mesa Intel UHD Graphics (ICL GT1) v: 4.6 Mesa 21.2.3
  direct render: Yes
Audio:
  Device-1: Intel Ice Lake-LP Smart Sound Audio vendor: Acer Incorporated ALI
  driver: snd_hda_intel v: kernel alternate: snd_sof_pci_intel_icl
  bus-ID: 00:1f.3 chip-ID: 8086:34c8 class-ID: 0401
  Device-2: C-Media USB PnP Sound Device type: USB
  driver: hid-generic,snd-usb-audio,usbhid bus-ID: 1-4:5 chip-ID: 0d8c:013a
  class-ID: 0300
  Sound Server-1: ALSA v: k5.14.10-1-MANJARO running: yes
  Sound Server-2: JACK v: 1.9.19 running: no
  Sound Server-3: PulseAudio v: 15.0 running: yes
  Sound Server-4: PipeWire v: 0.3.38 running: yes
Network:
  Device-1: Intel Ice Lake-LP PCH CNVi WiFi driver: iwlwifi v: kernel
  bus-ID: 00:14.3 chip-ID: 8086:34f0 class-ID: 0280
  IF: wlp0s20f3 state: up mac: <filter>
  Device-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
  vendor: Acer Incorporated ALI driver: r8169 v: kernel port: 3000
  bus-ID: 01:00.0 chip-ID: 10ec:8168 class-ID: 0200
  IF: enp1s0 state: down mac: <filter>
  IF-ID-1: ipv6leakintrf0 state: unknown speed: N/A duplex: N/A mac: <filter>
  IF-ID-2: proton0 state: unknown speed: 10 Mbps duplex: full mac: N/A
Bluetooth:
  Device-1: Intel AX201 Bluetooth type: USB driver: btusb v: 0.8
  bus-ID: 1-10:4 chip-ID: 8087:0026 class-ID: e001
  Report: rfkill ID: hci0 rfk-id: 2 state: down bt-service: enabled,running
  rfk-block: hardware: no software: yes address: see --recommends
RAID:
  Hardware-1: Intel 82801 Mobile SATA Controller [RAID mode] driver: ahci
  v: 3.0 port: 4060 bus-ID: 00:17.0 chip-ID: 8086:282a rev: N/A class-ID: 0104
Drives:
  Local Storage: total: 1.4 TiB used: 104.38 GiB (7.3%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Intel model: HBRPEKNX0202A
  size: 476.94 GiB block-size: physical: 512 B logical: 512 B speed: 15.8 Gb/s
  lanes: 2 type: SSD serial: <filter> rev: G002 temp: 35.9 C scheme: GPT
  ID-2: /dev/nvme1n1 maj-min: 259:5 vendor: Intel model: HBRPEKNX0202AO
  size: 27.25 GiB block-size: physical: 512 B logical: 512 B speed: 15.8 Gb/s
  lanes: 2 type: SSD serial: <filter> rev: K5110440 temp: 49.9 C scheme: GPT
  ID-3: /dev/sda maj-min: 8:0 vendor: Seagate model: ST1000LM048-2E7172
  size: 931.51 GiB block-size: physical: 4096 B logical: 512 B speed: 6.0 Gb/s
  type: HDD rpm: 5400 serial: <filter> rev: 0001 scheme: GPT
Partition:
  ID-1: / raw-size: 279.4 GiB size: 273.95 GiB (98.05%)
  used: 39.35 GiB (14.4%) fs: ext4 dev: /dev/nvme0n1p4 maj-min: 259:4
  ID-2: /boot/efi raw-size: 488 MiB size: 487 MiB (99.80%)
  used: 117.2 MiB (24.1%) fs: vfat dev: /dev/nvme0n1p2 maj-min: 259:2
Swap:
  Alert: No swap data was found.
Sensors:
  System Temperatures: cpu: 65.0 C mobo: N/A
  Fan Speeds (RPM): N/A
Info:
  Processes: 246 Uptime: 3h 14m wakeups: 3 Memory: 7.45 GiB
  used: 3.83 GiB (51.5%) Init: systemd v: 249 tool: systemctl Compilers:
  gcc: 11.1.0 Packages: 1351 pacman: 1345 lib: 384 flatpak: 6 Shell: Bash
  v: 5.1.8 running-in: terminator inxi: 3.3.08

sudo fdisk -l

[soumi@Hori ~]$ sudo fdisk -l
[sudo] password for soumi: 
Disk /dev/nvme0n1: 476.94 GiB, 512110190592 bytes, 1000215216 sectors
Disk model: INTEL HBRPEKNX0202A                     
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: B7143096-DC2D-4B29-B1C8-29873A1D2D94

Device             Start       End   Sectors   Size Type
/dev/nvme0n1p1      2048  31250430  31248383  14.9G Linux swap
/dev/nvme0n1p2  31250432  32249855    999424   488M EFI System
/dev/nvme0n1p3  32249856 344750079 312500224   149G Linux filesystem
/dev/nvme0n1p4 344750080 930686975 585936896 279.4G Linux filesystem


Disk /dev/nvme1n1: 27.25 GiB, 29260513280 bytes, 57149440 sectors
Disk model: INTEL HBRPEKNX0202AO                    
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 87A20D19-00E0-41C6-B8E0-90AB6C110C0B

Device            Start      End  Sectors  Size Type
/dev/nvme1n1p1     2048  1050623  1048576  512M EFI System
/dev/nvme1n1p2  1050624 55148543 54097920 25.8G Linux filesystem
/dev/nvme1n1p3 55148544 57147391  1998848  976M Linux swap


Disk /dev/sda: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: ST1000LM048-2E71
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: BA0C077B-F48E-41E5-9E35-C9C60FA68A6A

Device     Start       End   Sectors   Size Type
/dev/sda1   2048 488282111 488280064 232.8G Microsoft basic data
[soumi@Hori ~]$ 

lsblk

[soumi@Hori ~]$ lsblk
NAME  MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda     8:0    0 931.5G  0 disk 
└─sda1
        8:1    0 232.8G  0 part /run/media/soumi/Luna
nvme0n1
│     259:0    0 476.9G  0 disk 
├─nvme0n1p1
│     259:1    0  14.9G  0 part 
├─nvme0n1p2
│     259:2    0   488M  0 part /boot/efi
├─nvme0n1p3
│     259:3    0   149G  0 part /run/media/soumi/0b3720cd-8f8e-4da4-a78a-77ba26428bf0
└─nvme0n1p4
      259:4    0 279.4G  0 part /
nvme1n1
│     259:5    0  27.3G  0 disk 
├─nvme1n1p1
│     259:6    0   512M  0 part 
├─nvme1n1p2
│     259:7    0  25.8G  0 part /run/media/soumi/a88fd860-2556-41af-838e-60850d4a5b99
└─nvme1n1p3
      259:8    0   976M  0 part 
[soumi@Hori ~]$ 

The problem is, everytime I boot into Manjaro, it shows a line saying something like
[Fail] Failed to access Swap File somethn like that what should I do?

Manjaro Wiki has an excellent guide :slightly_smiling_face: :
https://wiki.manjaro.org/index.php/Swap#Using_a_Swap_Partition

Is everything correct in /etc/fstab?

3 Likes

This is what I needed. It’s fixed now. Thanks

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.