Saturday, 26 October 2013

Install Fedora EPEL repository on CentOS Linux

In my this blog i will describe how to configure a CentOS based system to use Fedora EPEL repository and third party remi package repository and As advantage they provide much more current versions of popular applications.

Install the third party or extra repositories:
Now download some RPM files that contain the additional Yum repository definitions. In the below example we are using 64 bit version that work with our server.

Download  Requires RPM files for Centos 5.X:

# wget http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5.4.noarch.rpm

# wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm

# sudo rpm -Uvh remi-release-5*.rpm epel-release-5*.rpm

Download  Requires RPM files for Centos 6.X:

# wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm


# wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

# sudo rpm -Uvh remi-release-6*.rpm eplel-release-6*.rpm

Once Installed we can see some additional repository definitions under the /etc/yum.repos.d directory.

# ls -l  /etc/yum.repos.d/epel* /etc/yum.repos.d/remi.repo

/etc/yum.repos.d/epel.repo

/etc/yum.repos.d/epel-testing.repo

/etc/yum.repos.d/remi.repo

Enable the remi repository:
remi repository provides a variety of up-to-date packages that are useful for web based services. That means it's good to enable the remi repositories by default.
Now open the /etc/yum.repos.d/remi.repo repository file using your favourite text editor:

# vim /etc/yum.repos.d/remi.repo

Now edit the [remi] portion of the file so that the enabled option is set to 1. This will enable the remi repository.

name=Les RPM de remi pour Enterprise Linux $releasever - $basearch
# baseurl=http://rpms.famillecollet.com/enterprise/$releasever/remi/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/$releasever/remi/mirror
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
failovermethod=priority

Now we will have a larger array of yum repositories.

For any query please feel free to contact me my email ID is sashwatkatore@gmail.com.

Friday, 25 October 2013

Difference between ext2, ext3 and ext4 File System on Linux.

Linux is a very flexible operating system, Linux can read and write several different file systems that originated with other operating systems much different from linux. 
One main reason is that Linux support so many file systems because Linux works on VFS (Virtual File System) Layer. The VFS layer avoids duplication of common code between all file systems also it provides a fairly universal backward compatible method for programs to access data from almost all type of file systems.

ext2 Filesystem:
  • ext2 stands for second extended file system.
  • Introduced with kernel 1.0 in 1993.
  • Super block feature increase file system performance
  • Flexible can handle upto 4 TB
  • ext2 filesystem is popular on USB and other solid-state devices.
  • ext2 filesystem reserve 5% of disk space for root
ext3 Filesystem:
  • ext3 filesystem was introduced in 2001 & Developed by Stephen Tweedie.
  • ext3 filesystem stands for third extended file system.
  • ext3 filesystem was released with Linux Kernel 2.4.15.
  • The main advantage of ext3 filesystem is that it allows journaling.
  • By journaling the possibility of file system corruption is less, So its a main advantage.
  • In ext3 filesystem Maximum file size can be from 16 GB to 2 TB.
  • Overall ext3 filesystem size can be from 2 TB to 32 TB.
  • We can convert a ext2 filesystem to ext3 filesystem directly.
Journaling: it has a dedicated area in the file system, Where all changes are tracked and when the system crashes the possibility of data loss is less because of Journaling.

ext4 Filesystem:
  • ext4 filesystem was introduced in 2008.
  • ext4 filesystem stands for fourth extended file system.
  • ext4 filesystem was released with Linux Kernel 2.6.19.
  • ext4 filesystem supports huge individual file size.
  • In ext4 filesystem Maximum file size can be from 16 GB to 16 TB.
  • Overall ext4 filesystem size is 1 EB (exabyte). 1 EB = 1024 PB (petabyte). 1 PB = 1024 TB (terabyte).
  • In ext4 filesystem we can mount an existing ext3 filesystem as ext4 filesystem.
Converting ext2 Filesystem to ext3 Filesystem:
For example, if we are converting /dev/sda3 that is mounted as /home, from ext2 to ext3, do the following:

#umount /dev/sda3

#tune2fs -j /dev/sda3

#mount /dev/sda3 /home

Converting ext3 Filesystem to ext4 Filesystem:
For example, if we are converting /dev/sda3 that is mounted as /home, from ext3 to ext4, do the following:

#umount /dev/sda3

#tune2fs -0 extents,uninit_bg,dir_index /dev/sda3

#e2fsck -pf /dev/sda3

#mount /dev/sda3 /home

For any query please feel free to contact me my email ID is sashwatkatore@gmail.com.

Wednesday, 23 October 2013

Backup of Linux Using dd command on Linux.

In some cases critical data loss will have a financial impact on companies. In my this blog i am updating 4 examples for using dd command to backup the Linux system. dd is a powerful Unix utility, Which is used by the Linux kernel to make boot images. dd command can only run by the root user or superuser. 

Warning: Please be careful while using dd command, If you don't know what you are doing, You will loss your data.

Example 1. - Hard Disk Backup (disk to disk)
We can use dd command to backup entire copy of a hard disk to another hard disk connected to the same system. run the dd command as shown below. In below example, the name of the source hard disk is /dev/sda and the name of the target hard disk is /dev/sdb.

# dd if =/dev/sda of =/dev/sdb

* Here "if" represents input file and "of " represents to output file, So the backup copy of /dev/sda will be available in /dev/sdb.
* If there are any errors, the above command will fail. Add the parameter "conv=noerror"
* Input file and Output file should be mentioned very carefully.

In the copy of hard disk to hard disk using dd command given below, sync option allows you to copy everything.

# dd if=/dev/sda of=/dev/sdb conv=noerror,sync

Example 2. - Create an Image of a Hard Disk
Instead of taking a backup of the hard disk, We can create an image file of the hard disk and save it. There are many advantages to backing up data to a disk image, This method is faster than other types of backups, and enabling you to quickly restore data.

# dd if=/dev/sda of=~/sdadisk.img

Example 3. - Restore Using Image Backup
To restore Image backup file on another hard disk, use the following dd command:

# dd if=sdadisk.img of=/dev/sdb

The image file sdadisk.img file, is the image of a /dev/sda, So the above command will restore the backup of /dev/sda to /dev/sdb.

Example 4. - Backup a Partition
We can use the device name of a partition in the input file, and in the output file we can specify target path or image file as shown in the below example:

# dd if=/dev/sda1 of=~/partition1.img

For any query please feel free to contact me my email ID is sashwatkatore@gmail.com.

Monday, 21 October 2013

How to Mount NTFS Partition on Linux Step by Step.

For access to other drive or external hard drive in linux system you need to do the following:

Note: If you face any problem in any of the steps, Please add a comment and i'll get back with solution.

#yum install fuse fuse-ntfs-3g

If not able to install or getting something like,
Loaded plugins: fastestmirror, refresh-packagekit
Loading mirror speeds from cached hostfile
* base: centos.syn.co.il
* extras: centos.syn.co.il
* updates: centos.syn.co.il
Setting up Install Process
No package ntfs-3g available
No package ntfsprogs available

Don't Worry, you can download them using the following link, Just copy-paste it your browser and download will start:

#wget ftp://ftp.muug.mb.ca/mirror/fedora/epel/6/x86_64/ntfs-3g-2011.4.12-5.el6.x86_64.rpm

Once downloaded, Install the package:

#rpm -ivh ntfs-3g-2011.4.12-5.el6.x86_64.rpm

Now you should be able to open the ntfs partition by double clicking it.

For any query please feel free to contact me my email ID is sashwatkatore@gmail.com.