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

[Microsoft Outlook]: Set .pst and .ost files location with ForcePSTPath Registry Key

Set .pst and .ost files location with ForcePSTPath Registry Key The ForcePSTPath registry key is supported by Microsoft Outlook 2003 and later. In Microsoft Outlook 2003 and 2007, it applies to new profiles only. Microsoft Outlook 2013 and Outlook 2016 it applies to new accounts created in a profile. Microsoft Outlook 2013 saves .pst in   %userprofile%\Documents\Outlook Files folder by default. We can change that default setting by adding a new string registry key called ForcePSTPath and set the value to the folder that we want to save those files. Set Microsoft Outlook 2013 always save new .pst and .ost files to D:\Data\Mail folder OST file reached the maximum size The OST File Has Reached The Maximum Size

Powershell: Test-NetConnection

PS C:\Users\tuyen> get-help Test-NetConnection NAME     Test-NetConnection SYNTAX     Test-NetConnection [[-ComputerName] <string>] [-TraceRoute] [-Hops <int>] [-InformationLevel {Quiet |     Detailed}]  [<CommonParameters>]     Test-NetConnection [[-ComputerName] <string>] [-CommonTCPPort] {HTTP | RDP | SMB | WINRM}     [-InformationLevel {Quiet | Detailed}]  [<CommonParameters>]     Test-NetConnection [[-ComputerName] <string>] -Port <int> [-InformationLevel {Quiet | Detailed}]     [<CommonParameters>]     Test-NetConnection [[-ComputerName] <string>] -DiagnoseRouting [-ConstrainSourceAddress <string>]     [-ConstrainInterface <uint32>] [-InformationLevel {Quiet | Detailed}]  [<CommonParameters>] ALIASES     TNC REMARKS     Get-Help cannot find the Help files fo...

Powershell: Install IIS

Run Powershell as Administrator, then run the command below to install IIS. Install-WindowsFeature Web-WebServer Check after installing Get-WindowsFeature *Web*