Skip to main content

CentOS: Create Swap Partition

One of my CentOS 7 Core hosts on CloudCone has only 256MB of memory. Here's my note while enable swap partition for it.

[tuyendq@1 ~]$ free 
              total        used        free      shared  buff/cache   available
Mem:         237244       76768       44640       12780      115836      127416
Swap:             0           0           0
[tuyendq@1 ~]$ 
[tuyendq@1 ~]$ sudo dd if=/dev/zero of=/swap count=2049 bs=1MiB
[sudo] password for tuyendq: 
2049+0 records in
2049+0 records out
2148532224 bytes (2.1 GB) copied, 14.3186 s, 150 MB/s
[tuyendq@1 ~]$ 
[tuyendq@1 ~]$ sudo chmod 600 /swap 
[tuyendq@1 ~]$ which mkswap
/usr/sbin/mkswap
[tuyendq@1 ~]$ sudo mkswap /swap 
Setting up swapspace version 1, size = 2098172 KiB
no label, UUID=0cea54e6-42d4-49c9-8f9b-f30e62582acf
[tuyendq@1 ~]$ 
[tuyendq@1 ~]$ sudo swapon /swap
[tuyendq@1 ~]$ free
              total        used        free      shared  buff/cache   available
Mem:         237244       78120        7140       12780      151984      126116
Swap:       2098172           0     2098172
[tuyendq@1 ~]$ 
[tuyendq@1 ~]$ cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Mon Jul 14 18:58:05 2014
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/vda1 /                       ext4    defaults        1 1
#/dev/vda2 swap                    swap    defaults        0 0
[tuyendq@1 ~]$ 
[tuyendq@1 ~]$ echo "/swap swap swap defaults 0 0" | sudo tee -a /etc/fstab
/swap swap swap defaults 0 0
[tuyendq@1 ~]$ cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Mon Jul 14 18:58:05 2014
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/vda1 /                       ext4    defaults        1 1
#/dev/vda2 swap                    swap    defaults        0 0
/swap swap swap defaults 0 0
[tuyendq@1 ~]$ 

Popular posts from this blog

MSSQL: Fix error 'Consistency validation for SQL Server registry keys'

While installing Microsof SQL Server 2012, I ran into the following error. "The SQL Server registry keys from a prior installation cannot be modified. To continue, see SQL Server Setup documentation about how to fix registry keys." How to fix Replace the D:\x64\FixSqlRegistryKey_x86.exe file with the original file from the ENU\SQLFULL_ENU.iso file downloading from Microsoft Download Center. This ISO file is 4.2GB. So you can click FixSqlRegistryKey_x86.exe to download this file only. After replacing that file, press Re-run to check. All rules are passed.

Docker for Windows: Access Denied

Today, I get this error when running Docker for Windows on Windows 10 Build 1803. So, I check my current username (run whoami ) and add that user to docker-users local group, which has only NT AUTHORITY\SYSTEM account in members list. I must log out and log in again to run Docker for Windows.