Quelqu'un pourrait il m'indiquer la marche a suivre pour creer un swap sur ma machine. Je trouve pas le wiki francais super clair sur le sujet...
Il s'agit du pc de ma signature avec un ssd de 480 go.
Merci
sudo lsblk -l
sudo cat /etc/fstab
sudo fdisk -l
free
swapon -s
cat /etc/mkinitcpio.conf
[matt@matt-pc ~]$ sudo lsblk -l
[sudo] Mot de passe de matt :
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 447,1G 0 disk
sda1 8:1 0 100M 0 part /boot/efi
sda2 8:2 0 50G 0 part /
sda3 8:3 0 397G 0 part /home
sr0 11:0 1 1024M 0 rom
[matt@matt-pc ~]$ sudo cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a device; this may
# be used with UUID= as a more robust way to name devices that works even if
# disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
UUID=B451-51E1 /boot/efi vfat defaults,noatime 0 2
UUID=809ffc87-6f93-4ae2-b2ca-7972ab44955b / ext4 defaults,noatime,discard 0 1
UUID=6a4c9fd2-2aab-42ac-a2f6-4cd383b7a73d /home ext4 defaults,noatime,discard 0 2
tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0
[matt@matt-pc ~]$ sudo fdisl -l
sudo: fdisl : commande introuvable
[matt@matt-pc ~]$ sudo fdisk -l
Disque /dev/sda : 447,1 GiB, 480103981056 octets, 937703088 secteurs
Modèle de disque : KINGSTON SA400S3
Unités : secteur de 1 × 512 = 512 octets
Taille de secteur (logique / physique) : 512 octets / 512 octets
taille d'E/S (minimale / optimale) : 512 octets / 512 octets
Type d'étiquette de disque : gpt
Identifiant de disque : EF8D0879-83C9-41D6-8041-A0746D661534
Périphérique Début Fin Secteurs Taille Type
/dev/sda1 2048 206847 204800 100M Données de base Microsoft
/dev/sda2 206848 105064447 104857600 50G Système de fichiers Linux
/dev/sda3 105064448 937697951 832633504 397G Système de fichiers Linux
att@matt-pc ~]$ free -m
free: Des options d'unités multiples n'ont aucun sens.
[matt@matt-pc ~]$ swapon -s
[matt@matt-pc ~]$ cat /etc/mkinitcpio.conf
# vim:set ft=sh
# MODULES
# The following modules are loaded before any boot hooks are
# run. Advanced users may wish to specify all system modules
# in this array. For instance:
# MODULES=(piix ide_disk reiserfs)
MODULES=""
# BINARIES
# This setting includes any additional binaries a given user may
# wish into the CPIO image. This is run last, so it may be used to
# override the actual binaries included by a given hook
# BINARIES are dependency parsed, so you may safely ignore libraries
BINARIES=()
# FILES
# This setting is similar to BINARIES above, however, files are added
# as-is and are not parsed in any way. This is useful for config files.
FILES=""
# HOOKS
# This is the most important setting in this file. The HOOKS control the
# modules and scripts added to the image, and what happens at boot time.
# Order is important, and it is recommended that you do not change the
# order in which HOOKS are added. Run 'mkinitcpio -H <hook name>' for
# help on a given hook.
# 'base' is _required_ unless you know precisely what you are doing.
# 'udev' is _required_ in order to automatically load modules
# 'filesystems' is _required_ unless you specify your fs modules in MODULES
# Examples:
## This setup specifies all modules in the MODULES setting above.
## No raid, lvm2, or encrypted root is needed.
# HOOKS=(base)
#
## This setup will autodetect all modules for your system and should
## work as a sane default
# HOOKS=(base udev autodetect block filesystems)
#
## This setup will generate a 'full' image which supports most systems.
## No autodetection is done.
# HOOKS=(base udev block filesystems)
#
## This setup assembles a pata mdadm array with an encrypted root FS.
## Note: See 'mkinitcpio -H mdadm' for more information on raid devices.
# HOOKS=(base udev block mdadm encrypt filesystems)
#
## This setup loads an lvm2 volume group on a usb device.
# HOOKS=(base udev block lvm2 filesystems)
#
## NOTE: If you have /usr on a separate partition, you MUST include the
# usr, fsck and shutdown hooks.
HOOKS="base udev autodetect modconf block keyboard keymap filesystems"
# COMPRESSION
# Use this to compress the initramfs image. By default, gzip compression
# is used. Use 'cat' to create an uncompressed image.
#COMPRESSION="gzip"
#COMPRESSION="bzip2"
#COMPRESSION="lzma"
#COMPRESSION="xz"
#COMPRESSION="lzop"
#COMPRESSION="lz4"
# COMPRESSION_OPTIONS
# Additional options for the compressor
#COMPRESSION_OPTIONS=()
[matt@matt-pc ~]$
free
pour la commande free -m
. Consulter la fichier cat ~/.bashrc
pour plus d'informations.[matt@matt-pc ~]$ free
total utilisé libre partagé tamp/cache disponible
Mem: 3853 986 721 253 2144 2345
Partition d'échange: 0 0 0
[matt@matt-pc ~]$
sudo rm /etc/sysctl.d/100-manjaro.conf
sudo rm /etc/sysctl.d/99-swappiness.conf
echo vm.swappiness=5 | sudo tee -a /etc/sysctl.d/99-sysctl.conf
echo vm.vfs_cache_pressure=50 | sudo tee -a /etc/sysctl.d/99-sysctl.conf
sudo sysctl -p /etc/sysctl.d/99-sysctl.conf
sudo pacman -S systemd-swap
sudo sed -i 's/\(swapfc_enabled=\)[01]/\11/' /etc/systemd/swap.conf && grep "_enabled" /etc/systemd/swap.conf
sudo systemctl start systemd-swap
sudo systemctl enable systemd-swap
cat /proc/sys/vm/swappiness
cat /proc/sys/vm/vfs_cache_pressure
cat /etc/systemd/swap.conf
swapon -s
[matt@matt-pc ~]$ sudo rm /etc/sysctl.d/100-manjaro.conf
[sudo] Mot de passe de matt :
rm: impossible de supprimer '/etc/sysctl.d/100-manjaro.conf': Aucun fichier ou dossier de ce type
[matt@matt-pc ~]$
À une valeur de 5, c'est pratiquement dire au système de ne pas utiliser de swap.
Pas de souci, c'est un fichier que tu aurais effacé s'il avait existé de toute façon.
[matt@matt-pc ~]$ cat /proc/sys/vm/swappiness
5
[matt@matt-pc ~]$ cat /proc/sys/vm/vfs_cache_pressure
50
[matt@matt-pc ~]$ cat /etc/systemd/swap.conf
################################################################################
# Defaults are optimized for general usage
################################################################################
################################################################################
# You can override any settings by files in:
# /etc/systemd/swap.conf.d/*.conf
################################################################################
################################################################################
# Zswap
#
# Kernel >= 3.11
# Zswap create compress cache between swap and memory for reduce IO
# https://www.kernel.org/doc/Documentation/vm/zswap.txt
zswap_enabled=1
zswap_compressor=lz4 # lzo lz4
zswap_max_pool_percent=25 # 1-99
zswap_zpool=zbud # zbud z3fold
################################################################################
# ZRam
#
# Kernel >= 3.15
# Zram compression streams count for additional information see:
# https://www.kernel.org/doc/Documentation/blockdev/zram.txt
zram_enabled=0
zram_size=$(($RAM_SIZE/4)) # This is 1/4 of ram size by default.
zram_streams=$NCPU
zram_alg=lz4 # lzo lz4 deflate lz4hc 842 - for Linux 4.8.4
zram_prio=32767 # 1 - 32767
################################################################################
# Swap File Chunked
# Allocate swap files dynamically
# For btrfs fallback to swapfile + loop will be used
# ex. Min swap size 512M, Max 8*512M
swapfc_enabled=1
swapfc_force_use_loop=0 # Force usage of swapfile + loop
swapfc_frequency=1s # How often check free swap space
swapfc_chunk_size=512M # Allocate size of swap chunk
swapfc_max_count=8 # 0 - unlimited, note: 32 is a kernel maximum
swapfc_free_swap_perc=15 # Add new chunk if free < 15%
# Remove chunk if free > 15+40% & chunk count > 2
swapfc_path=/var/lib/systemd-swap/swapfc/
# Only for swapfile + loop
swapfc_nocow=1 # Disable CoW on swapfile
swapfc_directio=1 # Use directio for loop dev
swapfc_force_preallocated=0 # Will preallocate created files
################################################################################
# Swap devices
# Find and auto swapon all available swap devices
swapd_auto_swapon=1
swapd_prio=1024
[matt@matt-pc ~]$ swapon -s
Nom de fichier Type Taille Utilisé Priorité
/var/lib/systemd-swap/swapfc/1 file 524284 0 -2
[matt@matt-pc ~]$
Une valeur trop faible de swappiness peut entraîner un ralentissement.Quel interet de monter la valeur ?