Comandos de la terminal/swapon

De WikiCabal
Saltar a: navegación, buscar

swapon

[root@Pridd ~]# swapon --help

Usage:
 swapon [options] [<spec>]

Options:
 -a, --all                enable all swaps from /etc/fstab
 -d, --discard[=<policy>] enable swap discards, if supported by device
 -e, --ifexists           silently skip devices that do not exist
 -f, --fixpgsz            reinitialize the swap space if necessary
 -p, --priority <prio>    specify the priority of the swap device
 -s, --summary            display summary about used swap devices
     --show[=<columns>]   display summary in definable table
     --noheadings         don't print headings, use with --show
     --raw                use the raw output format, use with --show
     --bytes              display swap size in bytes in --show output
 -v, --verbose            verbose mode

 -h, --help     display this help and exit
 -V, --version  output version information and exit

The <spec> parameter:
 -L <label>             synonym for LABEL=<label>
 -U <uuid>              synonym for UUID=<uuid>
 LABEL=<label>          specifies device by swap area label
 UUID=<uuid>            specifies device by swap area UUID
 PARTLABEL=<label>      specifies device by partition label
 PARTUUID=<uuid>        specifies device by partition UUID
 <device>               name of device to be used
 

Available discard policy types (for --discard):
 once	  : only single-time area discards are issued. (swapon)
 pages	  : discard freed pages before they are reused.
 * if no policy is selected both discard types are enabled. (default)

Available columns (for --show):
 NAME  device file or partition path
 TYPE  type of the device
 SIZE  size of the swap area
 USED  bytes in use
 PRIO  swap priority

For more details see swapon(8).

[root@Pridd ~]# swapon --version
swapon from util-linux 2.24

[root@Pridd ~]# swapon -v /mnt/swapfile
swapon /mnt/swapfile
swapon: /mnt/swapfile: found swap signature: version 1, page-size 4, same byte order
swapon: /mnt/swapfile: pagesize=4096, swapsize=2147483648, devsize=2147483648

[root@Pridd ~]# swapon -v /mnt/MiSwapfile
swapon /mnt/MiSwapfile
swapon: /mnt/MiSwapfile: found swap signature: version 1, page-size 4, same byte order
swapon: /mnt/MiSwapfile: pagesize=4096, swapsize=512000000, devsize=512000000

[root@Pridd ~]# swapon -s
Filename				Type		Size	Used	Priority
/dev/sda2                              	partition	4087700	0	-1
/mnt/swapfile                          	file	2097148	0	-2
/mnt/MiSwapfile                        	file	499996	0	-3

[root@Pridd ~]# cat /proc/swaps 
Filename				Type		Size	Used	Priority
/dev/sda2                               partition	4087700	0	-1
/mnt/swapfile                           file		2097148	0	-2
/mnt/MiSwapfile                         file		499996	0	-3

[root@Pridd ~]# swapon  --show
NAME            TYPE        SIZE USED PRIO
/dev/sda2       partition   3.9G   0B   -1
/mnt/swapfile   file          2G   0B   -2
/mnt/MiSwapfile file      488.3M   0B   -3

Si tiene más de un archivo de swap o partición de swap debería<br /> considerar la asignación de un valor de prioridad (0 a 32767) para<br />
cada área de swap. El sistema usará áreas de swap de la prioridad más alta antes de usar áreas de swap de la prioridad inferior. Por ejemplo, si tiene un disco más rápido (/dev/sda) y un disco más lento (/dev/sdb), asigna una prioridad más alta con el área de swap localizada en el dispositivo más rápido. Las prioridades se pueden asignar en fstab vía el parámetro -p o --priority

[root@Pridd ~]# swapoff -a
[root@Pridd ~]# swapon  --show  /mnt/MiSwapfile

[root@Pridd ~]# swapon -vp 100 /dev/sda2
swapon /dev/sda2
swapon: /dev/sda2: found swap signature: version 1, page-size 4, same byte order
swapon: /dev/sda2: pagesize=4096, swapsize=4185808896, devsize=4185811456

[root@Pridd ~]# swapon  --show
NAME      TYPE      SIZE USED PRIO
/dev/sda2 partition 3.9G   0B  100

[root@Pridd ~]# swapon -vp 50 /mnt/MiSwapfile
swapon /mnt/MiSwapfile
swapon: /mnt/MiSwapfile: found swap signature: version 1, page-size 4, same byte order
swapon: /mnt/MiSwapfile: pagesize=4096, swapsize=512000000, devsize=512000000

[root@Pridd ~]# swapon  --show
NAME            TYPE        SIZE USED PRIO
/dev/sda2       partition   3.9G   0B  100
/mnt/MiSwapfile file      488.3M   0B   50

[root@Pridd ~]# swapon -vp 500 /mnt/swapfile
swapon /mnt/swapfile
swapon: /mnt/swapfile: found swap signature: version 1, page-size 4, same byte order
swapon: /mnt/swapfile: pagesize=4096, swapsize=2147483648, devsize=2147483648

[root@Pridd ~]# swapon  --show 
NAME            TYPE        SIZE USED PRIO
/dev/sda2       partition   3.9G   0B  100
/mnt/MiSwapfile file      488.3M   0B   50
/mnt/swapfile   file          2G   0B  500