Bonjour,
j’ai un raspberry pi auquel j’ai ajouté un disque dur. J’essaye de transférer le swam de la carte sd vers le hdd. Mais je ne sais pas si ce que j’ai fait est correct.
Tout d’abord j’ai créé une partition de 1GB dédiée au swap.
Puis j’ai ajouté le hdd à /etc/fstab ce qui me donne ceci :
proc /proc proc defaults 0 0
PARTUUID=89e64b20-01 /boot vfat defaults 0 2
PARTUUID=89e64b20-02 / ext4 defaults,noatime 0 1
# USB Flash for SWAP space
/dev/sda1 /mnt/usb-flash/ ext4 noatime,defaults 0 2
# USB space
/dev/sda2 /mnt/space/ ext4 noatime,defaults 0 2
# a swapfile is not a swap partition, no line here
# use dphys-swapfile swap[on|off] for that
Puis j’ai changé la configuration swap avec sudo nano -w /etc/dphys-swapfile
pour ceci :
# /etc/dphys-swapfile - user settings for dphys-swapfile package
# author Neil Franklin, last modification 2010.05.05
# copyright ETH Zuerich Physics Departement
# use under either modified/non-advertising BSD or GPL license
# this file is sourced with . so full normal sh syntax applies
# the default settings are added as commented out CONF_*=* lines
# where we want the swapfile to be, this is the default
CONF_SWAPFILE=/mnt/usb-flash/swap.file
# set size to absolute value, leaving empty (default) then uses computed value
# you most likely don't want this, unless you have an special disk situation
CONF_SWAPSIZE=900
# set size to computed value, this times RAM size, dynamically adapts,
# guarantees that there is enough swap without wasting disk space on excess
# where we want the swapfile to be, this is the default
CONF_SWAPFILE=/mnt/usb-flash/swap.file
# set size to absolute value, leaving empty (default) then uses computed value
# you most likely don't want this, unless you have an special disk situation
CONF_SWAPSIZE=900
# set size to computed value, this times RAM size, dynamically adapts,
# guarantees that there is enough swap without wasting disk space on excess
#CONF_SWAPFACTOR=2
# restrict size (computed and absolute!) to maximally this limit
# can be set to empty for no limit, but beware of filled partitions!
# this is/was a (outdated?) 32bit kernel limit (in MBytes), do not overrun it
# but is also sensible on 64bit to prevent filling /var or even / partition
#CONF_MAXSWAP=2048
Puis re-démarré avec : sudo /etc/init.d/dphys-swapfile start
Mais comment savoir si ce que j’ai fait est correct et pris en compte ?
Quand je fais free -h
j’ai :
free -h
total used free shared buff/cache available
Mem: 926M 401M 33M 30M 490M 430M
Swap: 899M 0B 899M
Merci. Ce qui m’inquiète surtout c’est que le swap est à 0 pour son utilisation.