2

I have an updated desktop, to work with office/internet and some virtual machines. I have a:

  • MSI Z370-A Pro
  • Samsung SSD 970 EVO PCI-E NVMe M.2 500 GB
  • G.Skill Ripjaws V DDR4 3200 PC4-25600 16GB 2x8GB CL16
  • Intel Core i5-8400 2.8GHz BOX

I’ve read that recently Ubuntu has changed the swap partition to a file.

1 - Which size of partition/file would you recommend? Some people say to have almost no swap, others say that the same as RAM... I think that having swap is bad for me as I have a high RAM speed...

2 - How can I pass from a partition to a file? Suppose I have to disable swap partition, delete it, merge with home or root and then create a swap file.

Disco /dev/nvme0n1: 465,8 GiB, 500107862016 bytes, 976773168 sectores
Unidades: sectores de 1 * 512 = 512 bytes
Tamaño de sector (lógico/físico): 512 bytes / 512 bytes
Tamaño de E/S (mínimo/óptimo): 512 bytes / 512 bytes
Tipo de etiqueta de disco: dos
Identificador del disco: 0x00042ea4

Dispositivo    Inicio  Comienzo     Final  Sectores Tamaño Id Tipo
/dev/nvme0n1p1 *           2048   1048575   1046528   511M 83 Linux      /boot
/dev/nvme0n1p2          1048576   9433087   8384512     4G 82 Linux swap /swap Solaris
/dev/nvme0n1p3          9433088 811874303 802441216 382,6G 83 Linux     /
/dev/nvme0n1p4        811874304 976773119 164898816  78,6G 83 Linux     /home

3 - Can I stay without any swap partition or file?

  • You have a 1G swap partition on a 465G disk. Unless you are really running out of space, I would skip the merging step. Just create a swap file like in this question (third answer). When that works, disable the swap partition by uncommenting it in /etc/fstab and reboot. – Jos Aug 29 '18 at 11:22
  • I have 4G..But how much space to the file ? 16 g? 1G ? Thanks – Eduardo Gutierrez Aug 29 '18 at 11:28
  • You have 1G now, I see no reason to change that. – Jos Aug 29 '18 at 11:29
  • “I think that having swap is bad for me as I have a high RAM speed...” That’s not a problem. Swap is not really used until the RAM is exhausted. – Melebius Aug 29 '18 at 11:57
  • 1
    My mistake, you are right, your swap partition is 4G. And in theory you don't need a swap file. It is just an extra precaution against programs that use too much memory at the same time, or have severe memory leakage. I'm simplifying things a bit though. – Jos Aug 29 '18 at 16:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.