Author: Ruwantha Nissanka

How to take Backups in linux using dd command

In one of our previous article, we have discussed how to take snapshot backups in a linux system. In this article we will see how to take backups in our linux file system using the dd command. The dd command is useful to back up entire devices, whether entire hard disks, individual partitions, or logical volumes. For example, to back up an entire hard disk to a second hard disk, execute a command like the following: #dd if=/dev/sda1 of=/dev/sda2 The if option is used to specify the input device. The of option is used to specify the output device. Make sure when you execute this command that the hard disk that you are storing the backup is at least as large as the hard disk that you are backing up. What if you do not have a spare hard disk, but you have enough room on a device (such as an external USB hard disk)? In this case, place the output into an image file: #dd if=/dev/sda1 of=/mnt/hda.img You can also use the dd command to back up the contents of a CD-ROM or DVD into an ISO image: #dd if=devcdrom of=cdrom.iso The ISO image file can be used to create more CD-ROMs, or it can be shared via the network to make the contents of the CD-ROM easily available (rather than passing the disc around the office). It is...

Read More

4 commands you should know to compress files in linux

A common task on most modern operating systems is to combine and compress multiple files into a single file. This could be in order to store files on a smaller device, to make it easy to download files from a website, or to merge and compress files for email transport. This guide focuses on some of the more common Linux utilities that merge and compress files. Tar The purpose of the tar command, which stands for tape archive, is to merge multiple files into a single file. To create a tar file named sample.tar, execute the following #tar -cf sample.tar <files_to_merge> To list the contents of a .tar file: #tar -tf sample.tar To extract the contents of a .tar file: #tar -xf sample.tar d gzip Use the gzip command to compress files: #gzip  <filename> To display percentage of compression, #gzip -v <filename> To decompress the file, #gzip -d <filename> Note that the gzip command replaces the original file with the smaller compressed file. gunzip Use the gunzip command to decompress gzipped files #gunzip <filename> bzip2 Use the bzip2 command to compress files: #bzip2 <filename> To Display percentage of compression. #bzip2 -v <filename> To Decompress the file #bzip2 -d <filename> Note that the bzip2 command replaces the original file with the compressed file. Xz Use the xz command to compress files: #xz  <filename> You can  use the unxz command to decompress...

Read More

A beginner’s guide to using hard links in linux

Every file on the Linux filesystem starts with a single hard link. The link is between the filename and the actual data stored on the filesystem. Even if you delete the original file, the hard link will still has the data of the original file because the hard link acts as a mirror copy of the original file. In this guide, we will see how to create and manage hard links creating hard links When we create a hard link to a file with ln, an extra entry is added in the directory. A new file name is mapped to an existing inode. Both files have the same inode, so they will always have the same permissions and the same owner. Both files will have the same content. Actually, both files are equal now, meaning you can safely remove the original file, the hardlinked file will remain. The inode contains a counter, counting the number of hard links to itself. When the counter drops to zero, then the inode is emptied. finding hard links You can use the find command to look for files with a certain inode. The screenshot below shows how to search for all filenames that point to inode 674162. Remember that an inode number is unique to its partition. symbolic links Symbolic links (sometimes called soft links) do not link to inodes, but create a name to name...

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.