Ques 1 : – How to increase disk read performance from single command in Linux ?
Ans : – In Linux like Operating System the Read performance of a Disk can be improved by increasing a parameter called “Read+Ahead” using ‘blockdev’ command. By default the Linux OS will read 128 KB of data in advance so that it is already in Memory cache before the program needs it. This value can be increased so as to get better Read Performance.
# blockdev –setra 16384 /dev/sda
Ques 2 : – What is the use of tmfs File System ?
Ans : – Tmpfs is a file system which keeps all files in virtual memory. Everything in tmpfs is temporary in the sense that no files will be created on your hard drive. If you unmount a tmpfs instance, everything stored therein is lost.
tmpfs puts everything into the kernel internal caches and grows and shrinks to accommodate the files it contains and is able to swap unneeded pages out to swap space. It has maximum size limits which can be adjusted on the fly via ‘mount -o remount …’
Ques 3 : – What is anacron and its usage ?
Ans : – Anacron is a service that runs after every system reboot, checking for any cron and at scheduled jobs that were to run while the system was down and hence, have not yet run. It scans the /etc/cron.hourly/0anacron file for three factors to determine whether to run these missed jobs. The three factors are the presence of the /var/spool/anacron/cron.daily file, the elapsed time of 24 hours since anacron last ran, and the presence of the AC power to the system. If all of the three factors are affirmative, anacron goes ahead and automatically executes the scripts located in the /etc/cron.daily, /etc/cron.weekly, and /etc/cron.monthly directories, based on the settings and conditions defined in anacron’s main configuration file /etc/anacrontab
Ques 4 : – What is difference between Soft Link & Hard Link ?
Ans : – A soft link (symbolic link or a symlink) makes it possible to associate one file with another. It is similar to a shortcut in MS Windows where the actual file is resident somewhere in the directory structure but you may have multiple shortcuts or pointers with different names pointing to it. Each soft link has a unique inode number.A soft link can cross file system boundaries and can be used to link directories.
A hard link associates two or more files with a single inode number. This allows the files to have identical permissions, ownership, time stamp, and file contents. Changes made to any of the files are reflected on the other linked files. All files actually contain identical data.A hard link cannot cross file system boundaries and cannot be used to link directories.
Ques 5 : – What is the difference between hardware RAID and Software RAID?
Ans : – The hardware-based RAID is independent from the host. A Hardware RAID device connects to the SCSI controller and presents the RAID arrays as a single SCSI drive. An external RAID system moves all RAID handling “intelligence” into a controller located in the external disk subsystem. The whole subsystem is connected to the host via a normal SCSI controller and appears to the host as a single disk.
Software RAID is implemented under OS Kernel level. The Linux kernel contains an MD driver that allows the RAID solution to be completely hardware independent. The performance of a software-based array depends on the server CPU performance and load.
Ques 6 : – Explain the command “rpm -qf “?
Ans : – it queries the RPM database for which package owns
Ques 7. What is initrd image and what is its function in the linux booting process ?
Ans : The initial RAM disk (initrd) is an initial root file system that is mounted prior to when the real root file system is available.The initrd is bound to the kernel and loaded as part of the kernel boot procedure. The kernel then mounts this initrd as part of the two-stage boot process to load the modules to make the real file systems available and get at the real root file system. Thus initrd image plays a vital role in linux booting process.
Ques 8. Explain the terms suid, sgid and sticky bit ?
Ans : In addition to the basic file permissions in Linux, there are few special permissions that are available for executable files and directories.
SUID : If setuid bit is set, when the file is executed by a user, the process will have the same rights as the owner of the file being executed.
SGID : Same as above, but inherits group previleges of the file on execution, not user previleges. Similar way when you create a file within directory,it will inherit the group ownership of the directories.
Sticky bit : Sticky bit was used on executables in linux so that they would remain in the memory more time after the initial execution, hoping they would be needed in the near future. But mainly it is on folders, to imply that a file or folder created inside a stickybit enabled folder could only be deleted by the owner. A very good implementation of sticky bit is /tmp ,where every user has write permission but only users who own a file can delete them.
Ques 9. List out few of the differences between Softlink and Hardlink ?
Ans : a) Hardlink cannot be created for directories. Hard link can only be created for a file.
b) Symbolic links or symlinks can link to a directory.
c) Removing the original file that your hard link points to does not remove the hardlink itself; the hardlink still provides the content of the underlying file.
d) If you remove the hard link or the symlink itself, the original file will stay intact.
e) Removing the original file does not remove the attached symbolic link or symlink, but without the original file, the symlink is useless
Ques 10. How do you sent a mail attachment via bash console ?
“mutt” is an opensource tool for sending emails with attachments from the linux bash command line. We can install “mutt” from the binary rpm or via packagemanager.
For Ubuntu / Debian based destros.
# apt-get install mutt
For Redhat / Fedor based destros,
# yum install mutt
# mutt -s "Subject of Mail" -a "path of attachment file" "email address of recipient" < "message text containing body of the message"
mutt -s "Backup Data" -a /home/backup.tar.gz firstname.lastname@example.org < /tmp/message.txt