Posts

Showing posts with the label centos7

netstat command not found

This package contains the deprecated network utilities arp, ifconfig, netstat and route, which have been replaced by tools from the iproute2 package: * arp -> ip [-r] neigh * ifconfig -> ip a * netstat -> ss [-r] * route -> ip r yum install net-tools

Unable to create swap file with error "swapon failed: Invalid argument"

Unable to create swap file with error "swapon failed: Invalid argument" Environment Red Hat Enterprise Linux 6 Red Hat Enterprise Linux 7 XFS Issue swapon fails with error "swapon failed: Invalid argument" if swap file created using fallocate Resolution There are 3 resolutions : Create the swap file with dd instead of fallocate if using XFS on RHEL6 or RHEL7. Create the swap file on ext filesystem if using RHEL6 or RHEL7. Can upgrade to RHEL8 as issue is fixed for XFS. Root Cause The swap file implementation in the kernel expects to be able to write to the file directly, without the assistance of the filesystem. This is a problem on files with holes. Commands like cp(1) or truncate(1) create files with holes. These files will be rejected by  swapon . Preallocated files created by  fallocate(1)  may be interpreted as files with holes too depending of the filesystem. Preallocated swap files are supported on XFS since Linux 4.18. Diagn...

How To Add Swap on CentOS 7

Introduction One of the easiest ways to make your server more responsive, and guard against out-of-memory errors in your application, is to add some swap space.  Swap  is an area on a storage drive where the operating system can temporarily store data that it can no longer hold in memory. This gives you the ability to increase the amount of information that your server can keep in its working memory, with some caveats. Reading from and writing to swap is slower than using memory, but it can provide a good safety net for when your server is low on memory. Without swap, a server that runs out of memory may start killing applications to free up memory, or even crash. This can cause you to lose unsaved data or experience downtime. To ensure reliable data access, some applications require swap to function. In this guide, we will cover how to create and enable a swap file on a CentOS 7 server. Note Although swap is generally recommended for systems utilizing tradition...

How to Set or Change Hostname in CentOS 7

hostnamectl set-hostname your-new-hostname