0

I am running endeavourOS and I want to create a swap partition, I have already installed the OS but did not choose swap when I installed the OS.

I tried to shrink a partition to make it into a swap partition. but the new partition did not show up on lsblk, following Arch Wiki but I don't know what to put in mkswap /dev/sdxy (i mean xy, as I am expected to replace it with swap partition).

After running sudo fdisk -l /dev/sda

Disk /dev/sda: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: HGST HTS721010A9
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: 4C19DF52-AD65-4D4A-84CD-9B5A23F52B57

Device          Start        End    Sectors   Size Type
/dev/sda1        2048     534527     532480   260M EFI System
/dev/sda2      534528     567295      32768    16M Microsoft reser
/dev/sda3      567296 1478139903 1477572608 704.6G Microsoft basic
/dev/sda4  1510909952 1920509951  409600000 195.3G Linux filesyste
/dev/sda5  1920509952 1922516991    2007040   980M Windows recover
/dev/sda6  1922516992 1953511423   30994432  14.8G Microsoft basic
sahil
  • 23
  • 3
  • 3
    Do you have an objection to using a swap _file_ (as distinct from a swap _partition_)? – roaima Jul 25 '22 at 21:25
  • @roaima edited question – sahil Jul 25 '22 at 21:44
  • 2
    You appear to have created a 15.7GiB disk partition. Unless you have exceedingly specialist requirements that's way too large for a swap. – roaima Jul 25 '22 at 22:56
  • 1
    In far too many cases people can actually run swapless, only they remember this myth: SWAP = 2 * RAM. It's a myth. It was relevant for certain specific situations in the past. – Artem S. Tashkinov Jul 26 '22 at 09:26
  • and in modern systems no normal swap is needed, just use zram. [How do I use swap space for emergencies only?](https://unix.stackexchange.com/q/499485/44425) – phuclv Jul 26 '22 at 15:27

1 Answers1

0

sda3 and sda4 are not contiguous so I am guessing you shrunk sda3 using Windows disk management. That would leave unformatted space between sda3 and sda4. That action alone will not create a partition for lsblk to list.

If you use a tool like GParted all will become obvious. You just need to create a swap partition with GParted in the space between sda3 and sda4 or you can do it with a command line tool like parted.

I usually recommend making a backup of any data you cannot afford to lose before starting this kind of operation.

Good luck

PonJar
  • 371
  • 1
  • 6