Prakash Sawarkar: Kernel 3.8 Released, how to Compile in Redhat, CenOS and Fedora..

Kernel 3.8 Released, how to Compile in Redhat, CentOS and Fedora.

Thursday, 5 August 2010

Mount Windows/USB NTFS Partition in RHEL/CentOS/Fedora

First you need to enable EPEL (Extra Packages for Enterprise Linux) Repository. You may refer the article on how to enable EPEL  Repository under RHEL, CentOS and Fedora systems.
To mount any NTFS based filesystem, you need to install a tool called NTFS3G. Before heading up for installation let’s understand NTGS3G.
What is NTFS3G
NTFS3G is an open source cross-platform, stable, GPL licensed, POSIX, NTFS R/W driver used in Linux. It provides safe handling of Windows NTFS file systems viz create, remove, rename, move files, directories, hard links, etc.
Once EPEL is installed and enabled, let’s install ntfs-3g package using the below command with root user.
# yum -y install ntfs-3g
Fuse Install
Next, install and load FUSE driver to mount detected devices with below command. FUSE module is included in the kernel itself in version 2.6.18-164 or newer.
# yum install fuse
# modprobe fuse
Identify NTFS Partition
Once fuse module is loaded, type below command to find out NTFS Partitions in Linux.
# fdisk -l
  Device   Boot      Start    End      Blocks   Id  System
 /dev/sda1   *         1      121602   976760032+   7  HPFS/NTFS
Mount NTFS partition
First create a mount point to mount the NTFS partition.
# mkdir /mnt/usb
Simply run the following command to mount the partition. Replace sda1 with your actual partition found.
# mount -t ntfs-3g /dev/sda1 /mnt/usb
Once it’s mounted on /mnt/ntfs, you may use regular Linux ls -l command to list the content of mounted filesystem.
# ls -l
If you want to make mount point permanent at the boot time, then simple add the following line at the end of /etc/fstab file. This will remain as permanent.
/dev/sda1    /mnt/usb    ntfs-3g        defaults    0    0
Umount NTFS Partition
Simply, use the following command to unmount the mounted partition.
# umount /mnt/usb

Tuesday, 29 June 2010

How to Enable SRIOV of IBM Servers and Blade Servers BIOS

What is SR-IOV? The short answer is that SR-IOV is a specification that allows a PCIe device to appear to be multiple separate physical PCIe devices. The SR-IOV specification was created and is maintained by the PCI SIG, with the idea that a standard specification will help promote interoperability.

Step 1: Power on the system, and press F1 to enter the Setup utility.
Step 2: Select System Settings and then Network.
Step 3: Under the Network Device List, select the device to be configured and press Enter to see all the Network Device options (Figure 1).




















Step 4: Select the device’s description and press Enter to configure the device 
Step 5: From the selection menu, select Advanced Mode and press Enter to change the value.
Step 6: Choose Enable and press Enter.
Step 7: On the same selection menu, select Controller Configuration and press Enter to enter the configuration menu.
Step 8: Select Configure SRIOV and hit Enter.
Step 9: On the Configure SRIOV page, press Enter to toggle the values
Step 10: Select Enable and press Enter
Step 11: Select Save Current Configurations and press Enter.
Step 12: Press Esc to exit the menu. Then, click Save to save the configuration.
Step 13: Reboot the system.

Sunday, 27 June 2010

Setting up an SSL secured Webserver with CentOS

1. Getting the required software
For an SSL encrypted web server you will need a few things. Depending on your install you may or may not have OpenSSL and mod_ssl, Apache's interface to OpenSSL. Use yum to get them if you need them.
# yum install mod_ssl openssl
Yum will either tell you they are installed or will install them for you.
2. Generate a self-signed certificate
Using OpenSSL we will generate a self-signed certificate. If you are using this on a production server you are probably likely to want a key from Trusted Certificate Authority, but if you are just using this on a personal site or for testing purposes a self-signed certificate is fine. To create the key you will need to be root so you can either su to root or use sudo in front of the commands
# Generate private key 
openssl genrsa -out ca.key 1024 
# Generate CSR 
openssl req -new -key ca.key -out ca.csr
# Generate Self Signed Key
openssl x509 -req -days 365 -in ca.csr -signkey ca.key -out ca.crt
# Move the files to the correct locations
# mv ca.crt /etc/pki/tls/certs
# mv ca.key /etc/pki/tls/private/ca.key
# mv ca.csr /etc/pki/tls/private/ca.csr
Then we need to update the Apache SSL configuration file
# vi +/SSLCertificateFile /etc/httpd/conf.d/ssl.conf
Change the paths to match where the Key file is stored. If you've used the method above it will be
SSLCertificateFile /etc/pki/tls/certs/ca.crt
Then set the correct path for the Certificate Key File a few lines below. If you've followed the instructions above it is:
SSLCertificateKeyFile /etc/pki/tls/private/ca.key
Quit and save the file and then restart Apache
# /etc/init.d/httpd restart
All being well you should now be able to connect over https to your server and see a default Centos page. As the certificate is self signed browsers will generally ask you whether you want to accept the certificate. Firefox 3 won't let you connect at all but you can override this.
Restart Apache again using 
# /etc/init.d/httpd restart 

Tuesday, 26 January 2010

Recover deleted files using Foremost

Foremost is a console program to recover files based on their headers, footers, and internal data structures. This process is commonly referred to as data carving. Foremost can work on image files, such as those generated by dd, Safeback, Encase, etc, or directly on a drive. The headers and footers can be specified by a configuration file or you can use command line switches to specify built-in file types. These built-in types look at the data structures of a given file format allowing for a more reliable and faster recovery.
Originally developed by the United States Air Force Office of Special Investigations and The Center for Information Systems Security Studies and Research and now foremost has been opened to the general public.
Files types supported by foremost:
jpg, gif, png, bmp
avi, mpg, wav, wmv, mov
pdf, doc, zip, exe, rff, rar, html, cpp
You can tweak /etc/foremost.conf to add support for more file types.
Please note that there's no guarantee that foremost will succeed in recovering your files, but at least there's a chance.
Foremost Installation:
Open the terminal and type following command to install foremost:
               # yum  install  foremost
Foremost isn’t the greatest solution; it recovers every file it sees and doesn’t support very many file types. It is possible to add types to the /etc/foremost.conf file, but it doesn’t look an easy task. However, if you’ve lost a bunch of photos or documents, Foremost could be just what you need.
Using Foremost:
Suppose you want to recover png file, from command line type following commad:
foremost -t png -i /dev/sda1
After completion, you will find a folder called output in the directory from where you executed the foremost, where within you can see the folder 'png' and inside png you can find your lost png file.
There are many more tools that you can use to recover your files:
Recover deleted files from NTFS filesystem from Centos Linux - Ntfsundelete
Recover your deleted jpeg pictures from filesystem or camera memory card - recoverjpeg
Utility to recover deleted files from an ext3 or  ext4 Linux partition - Extundelete

Friday, 20 November 2009

LVM (Logical Volume Manager) Concept on Linux RHEL / CentOS

 LVM is a method of allocating harddrive space into logical  volumes that can be easily resized instead of partitions.
 With LVM the harddrive (or) set of harddrives are allocated to  one or more physical volumes.
 The physical volumes are combined into volume  groups
 Each volume group is divided into logical volumes which are  assigned mountpoints such as /home and filesystem types such  as   ext3.
To configure LVM

1)Create three LVM partitions
2)Convert them as physical volumes
3)Create volume groups from physical volumes
4)Create logical volumes from volume groups and assign mountpoints

IMPLEMENTATION:
# fdisk /dev/sda
n
+500M
t
<partition number>
8e
w
partprobe
To convert LVM partitions as physical volumes
# pvcreate /dev/sda<partition numbers>
ex: pvcreate /dev/sda{9,10,11}

To view physical volumes
# pvdisplay

To create volume group
# vgcreate <vg name> <partitions>
ex: vgcreate maaza /dev/sda{9,10,11}

To view volume groups
# vgdisplay

To create a logical volume
# lvcreate -L <+size> <vg name> -n <LV name>
ex: lvcreate -L +500M /dev/maaza -n fanta

To view logical volumes
# lvdisplay

To format logical volumes
# mke2fs -j /dev/maaza/fanta

Create a mountpoint and mount logical volume on it
# mkdir /cyber
# mount /dev/maaza/fanta /cyber
# cd /cyber

To extend size of logical volume
# umount <mountpoint>
# lvcreate -L <size> <lv name>
ex:lvcreate -L +500M /dev/maaza/fanta

To make filesystem for extended size
# resize2fs <logical volume>
ex: resize2fs /dev/maaza/fanta
# mount /dev/maaza/fanta /cyber

To resize a logical volume
note:whenever we are reducing an LVM we have to take backup
# mkdir /a
# cp -rf /cyber/* /a

# lvreduce -L <-size> <LVM>
ex: lvreduce -L -100M /dev/maaza/fanta

To format LVM
# mkfs.ext3 <logical volume>
ex:mkfs.ext3 /dev/maaza/fanta

# mount /dev/maaza/fanta /cyber
# cp -rf /a/* /cyber

To remove an LVM
# umount <mountpoint>
# lvremove <logical volume>
ex:lvremove /dev/maaza/fanta

To extend volume group
1)create another LVM partition
2)convert into physical volume

# vgextend <vg name> <partition name>
ex:vgextend /dev/maaza /dev/sda12

To reduce volume group
# vgreduce <vgname> <partition name>
ex:vgreduce /dev/maaza /dev/sda12

To remove volume group
# vgremove <vg name>
ex:vgremove /dev/maaza

To delete physical volumes
# pvremove <partitions>

ex:pvremove /dev/sda{9,10,11,12}