Birmingham mumbai



Download 15,21 Mb.
Pdf ko'rish
bet261/482
Sana13.01.2022
Hajmi15,21 Mb.
#355107
1   ...   257   258   259   260   261   262   263   264   ...   482
Bog'liq
Mastering Ubuntu Server Gain expertise in the art of deploying, configuring, managing, and troubleshooting Ubuntu Server by Jay LaCroix (z-lib.org)

[
 199 
]
The 
swap
 file for your server is declared in the 
/etc/fstab
 file (we'll discuss the 
/etc/
fstab
 file in more detail in 
Chapter 9

Managing Storage Volumes
). In most cases, you 
would've had a 
swap
 file created for you during installation. You could, of course, 
add a swap partition later if for some reason you don't have one. In the case of some 
cloud instance providers, you may not get a 
swap
 file by default. In that situation, 
you would create a 
swap
 file yourself (we'll discuss the process later in this section) 
and then use the 
swapon
 command to activate it:
sudo swapon -a
When run, the 
swapon -a
 command will find your swap partition in
/etc/fstab
 (if 
it's mentioned there), mount it, and activate it for use. The inverse of this command 
is 
swapoff -a
, which deactivates your 
swap
 file. It's rare that you'd need to disable 
swap, unless, of course, you were planning on deleting your 
swap
 file in order to 
create a larger one. If you find out that your server has an inadequate swap partition 
size, that may be a course of action you would take.
While having swap is generally a good idea, there are actually some applications 
that prefer that the server doesn't have it at all. This is rare, but Kubernetes is a good 
example of this. If you're running Kubernetes, the installation of it will complain if 
you do have a swap partition. This is somewhat of a rare occurrence; not very many 
applications run better if the server has no 
swap
 file. In the case of a Kubernetes 
cluster, the individual servers within such a cluster would be a special case anyway, 
each dedicated to the task of running containers (which is what Kubernetes does; 
more on that in 
Chapter 18

Container Orchestration
).
When you check your free memory (hint: execute 
free -m
), you'll see 
swap
 listed 
whether you have it or not, but when swap is deactivated, you will see all zeros for 
the size totals.
So, how do you actually create a 
swap
 file? To do so, you'll first create the actual 
file to be used as swap. This can be stored anywhere, but 
/swapfile
 is typically 
ideal. You can use the 
fallocate
 command to create the actual file. The 
fallocate
 
command will force a file to be a particular size:
sudo fallocate -l 4G /swapfile
Here, I'm creating a 4 GB 
swap
 file, but feel free to make yours whatever size you 
want in order to fit your needs. Next, we need to prepare this file to be used as swap. 
First, we'll need to fix the permissions as we need this file to be a bit more restrictive 
than most:
sudo chmod 0600 /swapfile


Monitoring System Resources

Download 15,21 Mb.

Do'stlaringiz bilan baham:
1   ...   257   258   259   260   261   262   263   264   ...   482




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish