DEV Community


Posted on

choosing the size of the swap and setting up

choosing the size of the swap:
The appropriate memory size depends on several factors and cannot be specified in general. Depending on system usage, around 1 GB of swap space or 1 GB + RAM capacity for suspend-to-disk is sufficient. If the swap space (and RAM) fills up, the system may crash and all data not synchronized with the hard disk is lost, which is why a generously designed swap area can make sense

what about a Swap:

[martin@martineos ~]$ lsblk
sda      8:0    0 232,9G  0 disk 
├─sda1   8:1    0   300M  0 part /boot/efi
└─sda2   8:2    0 232,6G  0 part /
sr0     11:0    1  1024M  0 rom  
[martin@martineos ~]$ 

Enter fullscreen mode Exit fullscreen mode

see also

[martin@martineos ~]$ df -h
Dateisystem    Größe Benutzt Verf. Verw% Eingehängt auf
dev             1,9G       0  1,9G    0% /dev
run             1,9G    1,3M  1,9G    1% /run
/dev/sda2       228G     33G  184G   15% /
tmpfs           1,9G    201M  1,7G   11% /dev/shm
tmpfs           1,9G     23M  1,9G    2% /tmp
/dev/sda1       300M    296K  300M    1% /boot/efi
tmpfs           383M     60K  383M    1% /run/user/1000
Enter fullscreen mode Exit fullscreen mode

well now i want to set up a swap

that said i want to narrow down the partition abotu 8 gb and then create a swap

$ swapon --show Or to show physical memory as well as swap usage:```

```$ swapon --show```

Or to show physical memory as well as swap usage:

```$ free -h
Swap partition```

A swap partition can be created with most GNU/Linux partitioning tools. Swap partitions are designated as type 82 on MBR and 0657FD6D-A4AB-43C4-84E5-0933C84B4F4F on GPT.

To set up a partition as Linux swap area, the mkswap(8) command is used. For example:

```# mkswap /dev/sdxy```

Warning: All data on the specified partition will be lost.

To enable the device for paging:

```# swapon /dev/sdxy```

To enable this swap partition on boot, add an entry to /etc/fstab:

UUID=device_UUID none swap defaults 0 0
where the device_UUID is the UUID of the swap space.

See fstab for the file syntax.

Note: The fstab-entry is optional if the swap partition is located on a device using GPT. See #Activation by systemd

**querstion** _ how to do that necessary steps - how to lower down the partiion for ´8 gb and have space for swap
Enter fullscreen mode Exit fullscreen mode

Top comments (0)