Author: Sahil Suri

Understanding swapiness parameter in Linux

Introduction In an earlier article, we demonstrated how we could calculate and report the amount of swap memory used by an individual process. In this article, we will explain a kernel parameter related to the use to swap memory. This kernel parameter is called swapiness. Before we talk about swapiness, we’ll briefly explain the concepts of swapping and paging. An overview of memory management in Linux A process normally runs on physical memory where the memory is divided into sets of pages.  A page is a 4kb area of memory and is the basic unit of memory with which both kernel and CPU deal. This page size is tunable. Operating systems use virtual memory which is a memory management technique wherein RAM and swap memory are combined gives an application program the impression that it has contiguous working memory. This memory management implementation allows processes requiring a large amount of memory of fork even if the required amount of RAM is not available at that point in time. Swap space: This is storage space allocated on a portion of or the entire hard disk which is used by the operating system to store data pages that are currently not needed.  This swap space can be a partition as well as swap file. Although allocating swap space using swap files is not recommended. Swapping and Paging To swap a process...

Read More

Resolving YUM: Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast

Introduction We’ve explored the yum package manager for RHEL based systems extensively in previous yum. In this article, we will present the cause and fix for the message “Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast” which you might occassionally come across while running yum commands.   Cause of the message YUM maintains a cache of repository related information in the /var/cache/yum/$basearch/$releasever/ directory, where $basearch and $releasever are Yum variables referring to base architecture of the system and the release version of Red Hat Enterprise Linux.  Along with some metadata yum also stores downloaded packages temporarily in this location while the packages are being installed. Once the packages are installed successfully they are removed from the cache directories. If you are working on a server that has not been able to connect to an active yum repository server for several weeks then you will see this message when you run a yum command indicating the presence of outdated repository entries in the yum cache.This basically means that the yum cache directory is not up to date. [root@linuxnix ~]# yum install zip Loaded plugins: fastestmirror, langpacks Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast The old repodata warning also gets triggered if you restore from an old server snapshots for those using VPS servers or cloud servers.  It is merely...

Read More

How to prevent file/folder modification/deletion in Linux?

Introduction A Linux based operating system does not have the concept of a ‘recycle bin’ in contrast to Windows operating systems. Therefore in Linux if we delete a file or directory it is generally considered to be lost forever unless we have a backup. Although there are a couple of methods available to recover deleted data from a Linux file system but these methods require the use of third party software and are tedious, not very straightforward and full proof. Perhaps the best possible way to prevent a file or directory from being accidentally removed or modified is to prohibit it completely. In Linux this functionality can be achieved by making use of the immutable flag. In this article, we will explain what the immutable flag is and then demonstrate practically how it works.   What is the immutable flag? The immutable flag is an extended file system attribute, and can be set on both files and directories. Once the immutable flag is set the the file or directory cannot be modified, renamed or deleted without removing the immutable flag first. The immutable flag can be set or unset using the chattr command. Setting the immutable flag requires root privileges. The chattr command explained: The chattr (Change Attribute) is a command line Linux utility that is used to set/unset certain attributes to a file in Linux system to secure...

Read More

Over 16,000 readers, Get fresh content from “The Linux juggernaut”

Email Subscribe

ABOUT ME..!

My photo
My name is Surendra Kumar Anne. I hail from Vijayawada which is cultural capital of south Indian state of Andhra Pradesh. I am a Linux evangelist who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. At present I work at Bank of America as Sr. Analyst Systems and Administration. You can contact me at surendra (@) linuxnix dot com.