SWAP in file: mudanças entre as edições
Ir para navegação
Ir para pesquisar
(Criou página com '=Commands= <syntaxhighlight lang=bash> #Create a static file $ dd if=/dev/zero of=/swapfile bs=1M count=1024 1024+0 records in 1024+0 records out #Fix file mask chmod 600 /sw...') |
Sem resumo de edição |
||
(6 revisões intermediárias pelo mesmo usuário não estão sendo mostradas) | |||
Linha 1: | Linha 1: | ||
=Commands= | =Commands= | ||
<syntaxhighlight lang=bash> | <syntaxhighlight lang=bash> | ||
#Create a static file | #Create a static file with 16GB | ||
$ dd if=/dev/zero of=/swapfile bs=1M count=1024 | $ dd if=/dev/zero of=/swapfile bs=1M count=$(expr 16 \* 1024) | ||
16384+0 records in | |||
16384+0 records out | |||
#Extend swapfile | |||
$ dd if=/dev/zero of=/swapfile bs=1M count=$(expr 4 \* 1024) oflag=append conv=notrunc | |||
#Fix file mask | #Fix file mask | ||
Linha 11: | Linha 14: | ||
#Prepare the file to use as swap | #Prepare the file to use as swap | ||
$ mkswap /swapfile | $ mkswap /swapfile | ||
Setting up swapspace version 1, size = | Setting up swapspace version 1, size = 16777216 KiB | ||
no label, UUID=f75cc8f9-78d2-4ea3-945a-eefbd59568ac | no label, UUID=f75cc8f9-78d2-4ea3-945a-eefbd59568ac | ||
#Activate new swap | |||
$ swapon /swapfile | |||
</syntaxhighlight> | </syntaxhighlight> | ||
=FSTAB= | =FSTAB= | ||
< | <syntaxhighlight lang=bash> | ||
/swapfile none swap sw 0 0 | $ echo \/swapfile none swap sw 0 0 >> /etc/fstab | ||
</ | </syntaxhighlight > |
Edição atual tal como às 23h18min de 15 de julho de 2023
Commands
#Create a static file with 16GB
$ dd if=/dev/zero of=/swapfile bs=1M count=$(expr 16 \* 1024)
16384+0 records in
16384+0 records out
#Extend swapfile
$ dd if=/dev/zero of=/swapfile bs=1M count=$(expr 4 \* 1024) oflag=append conv=notrunc
#Fix file mask
chmod 600 /swapfile
#Prepare the file to use as swap
$ mkswap /swapfile
Setting up swapspace version 1, size = 16777216 KiB
no label, UUID=f75cc8f9-78d2-4ea3-945a-eefbd59568ac
#Activate new swap
$ swapon /swapfile
FSTAB
$ echo \/swapfile none swap sw 0 0 >> /etc/fstab