SWAP create: различия между версиями
Перейти к навигации
Перейти к поиску
Sol (обсуждение | вклад) |
Sol (обсуждение | вклад) |
||
(не показано 6 промежуточных версий этого же участника) | |||
Строка 1: | Строка 1: | ||
[[Категория:Linux]] | [[Категория:Linux]] | ||
− | + | == ext4 == | |
− | chmod 600 /swapfile | + | 4G swafile |
− | + | <syntaxhighlight lang="bash"> | |
− | + | fallocate -l 4G /swapfile | |
− | + | chmod 600 /swapfile | |
+ | mkswap /swapfile | ||
+ | swapon /swapfile | ||
+ | echo '/swapfile swap swap defaults 0 0' >> /etc/fstab | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | <syntaxhighlight lang="bash"> | ||
+ | fallocate -l 2G /swapfile; chmod 600 /swapfile; mkswap /swapfile; swapon /swapfile; echo '/swapfile swap swap defaults 0 0' >> /etc/fstab | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | == xfs == | ||
+ | 1G swapfile | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | dd if=/dev/zero of=/swapfile bs=1024 count=1048576 | ||
+ | chown root:root /swapfile | ||
+ | chmod 0600 /swapfile | ||
+ | mkswap /swapfile | ||
+ | swapon /swapfile | ||
+ | echo '/swapfile none swap sw 0 0' >> /etc/fstab | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | <syntaxhighlight lang="bash"> | ||
+ | dd if=/dev/zero of=/swapfile bs=2048 count=1048576; chown root:root /swapfile; chmod 0600 /swapfile; mkswap /swapfile; swapon /swapfile; echo '/swapfile none swap sw 0 0' >> /etc/fstab | ||
+ | </syntaxhighlight> |
Текущая версия на 12:10, 26 февраля 2019
ext4
4G swafile
fallocate -l 4G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo '/swapfile swap swap defaults 0 0' >> /etc/fstab
fallocate -l 2G /swapfile; chmod 600 /swapfile; mkswap /swapfile; swapon /swapfile; echo '/swapfile swap swap defaults 0 0' >> /etc/fstab
xfs
1G swapfile
dd if=/dev/zero of=/swapfile bs=1024 count=1048576
chown root:root /swapfile
chmod 0600 /swapfile
mkswap /swapfile
swapon /swapfile
echo '/swapfile none swap sw 0 0' >> /etc/fstab
dd if=/dev/zero of=/swapfile bs=2048 count=1048576; chown root:root /swapfile; chmod 0600 /swapfile; mkswap /swapfile; swapon /swapfile; echo '/swapfile none swap sw 0 0' >> /etc/fstab