Subscribe For Free Updates!

We'll not spam mate! We promise.

Sunday, 5 October 2014

Everything about LVM (LOGICAL VOLUME MANAGEMENT)




Hello Friend's, In this session i am going to tell all about LVM (LOGICAL VOLUME MANAGEMENT) ,

========================================================================
I) How to create a Volume Group (VG).
II) How to create a Logical Volume (LV) and mount the file system.

III) How to add a disk to a Volume Group
IV) How to increase the size of a logical volume without OnlineJFS
V) How to remove a Logical Volume
VI) How to reduce the size of a logical volume without OnlineJFS (advanced JFS)
VII) How to remove a disk from a volume group
VIII) How to remove a volume group
IX) How to increase the primary swap
X) How to create a secondary boot disk LVM Mirroring
XI) How to mirror a logical volume
XII) How to unmirror a logical volume
XIII) How to create a mirrored boot disk
XIV) How to mirror a logical volume on a specific physical volume Physical Volume Group
XV) How to create a Physical Volume Group (PVG)
XVI) How to use PVG to mirror logical volumes on specific physical volumes
========================================================================



How to create LVM


Step:1 To check the device (hda , sda) by using fdisk.check the new partition

[root@trash3can /]# fdisk -l
[root@trash3can ~]# fdisk -l
Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1020     8193118+  83  Linux
/dev/sda2            1021        1275     2048287+  83  Linux

Step:2 Create the partation

[root@trash3can ~]# fdisk /dev/sda
The number of cylinders for this disk is set to 1305.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
>> m command for help
Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)
>> n command for add a new partition
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p  >>press p for primary partition
Partition number (1-4): 3
First cylinder (1276-1305, default 1276):
Using default value 1276
Last cylinder or +size or +sizeM or +sizeK (1276-1305, default 1305): +100M
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Selected partition 4
First cylinder (1289-1305, default 1289):
Using default value 1289
Last cylinder or +size or +sizeM or +sizeK (1289-1305, default 1305): +100M
>> p for print the partition table
Command (m for help): p
Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1020     8193118+  83  Linux
/dev/sda2            1021        1275     2048287+  83  Linux
/dev/sda3            1276        1288      104422+  83  Linux
/dev/sda4            1289        1301      104422+  83  Linux
>>w   write table to disk and exit
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
>> to change the partation id by pressing the t command
Command (m for help): t
Partition number (1-4): 3
Hex code (type L to list codes): L
 0  Empty           1e  Hidden W95 FAT1 80  Old Minix       bf  Solaris
 1  FAT12           24  NEC DOS         81  Minix / old Lin c1  DRDOS/sec (FAT-
 2  XENIX root      39  Plan 9          82  Linux swap / So c4  DRDOS/sec (FAT-
 3  XENIX usr       3c  PartitionMagic  83  Linux           c6  DRDOS/sec (FAT-
 4  FAT16 <32M      40  Venix 80286     84  OS/2 hidden C:  c7  Syrinx
 5  Extended        41  PPC PReP Boot   85  Linux extended  da  Non-FS data
 6  FAT16           42  SFS             86  NTFS volume set db  CP/M / CTOS / .
 7  HPFS/NTFS       4d  QNX4.x          87  NTFS volume set de  Dell Utility
 8  AIX             4e  QNX4.x 2nd part 88  Linux plaintext df  BootIt
 9  AIX bootable    4f  QNX4.x 3rd part 8e  Linux LVM       e1  DOS access
 a  OS/2 Boot Manag 50  OnTrack DM      93  Amoeba          e3  DOS R/O
 b  W95 FAT32       51  OnTrack DM6 Aux 94  Amoeba BBT      e4  SpeedStor
 c  W95 FAT32 (LBA) 52  CP/M            9f  BSD/OS          eb  BeOS fs
 e  W95 FAT16 (LBA) 53  OnTrack DM6 Aux a0  IBM Thinkpad hi ee  EFI GPT
 f  W95 Ext'd (LBA) 54  OnTrackDM6      a5  FreeBSD         ef  EFI (FAT-12/16/
10  OPUS            55  EZ-Drive        a6  OpenBSD         f0  Linux/PA-RISC b
11  Hidden FAT12    56  Golden Bow      a7  NeXTSTEP        f1  SpeedStor
12  Compaq diagnost 5c  Priam Edisk     a8  Darwin UFS      f4  SpeedStor
14  Hidden FAT16 <3 61  SpeedStor       a9  NetBSD          f2  DOS secondary
16  Hidden FAT16    63  GNU HURD or Sys ab  Darwin boot     fb  VMware VMFS
17  Hidden HPFS/NTF 64  Novell Netware  b7  BSDI fs         fc  VMware VMKCORE
18  AST SmartSleep  65  Novell Netware  b8  BSDI swap       fd  Linux raid auto
1b  Hidden W95 FAT3 70  DiskSecure Mult bb  Boot Wizard hid fe  LANstep
1c  Hidden W95 FAT3 75  PC/IX           be  Solaris boot    ff  BBT
>> 8e  Linux LVM
Hex code (type L to list codes): 8e
Changed system type of partition 3 to 8e (Linux LVM)
Command (m for help): t
Partition number (1-4): 4
Hex code (type L to list codes): 8e
Changed system type of partition 4 to 8e (Linux LVM)
Command (m for help): p
Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1020     8193118+  83  Linux
/dev/sda2            1021        1275     2048287+  83  Linux
/dev/sda3            1276        1288      104422+  8e  Linux LVM
/dev/sda4            1289        1301      104422+  8e  Linux LVM
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.



Step:3 Check the partation y using fdisk -l command

[root@trash3can ~]# fdisk -l
Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1020     8193118+  83  Linux
/dev/sda2            1021        1275     2048287+  83  Linux
/dev/sda3            1276        1288      104422+  8e  Linux LVM
/dev/sda4            1289        1301      104422+  8e  Linux LVM


[root@node1 ~]# cat /proc/partitions
major minor  #blocks  name
   8     0   10485760 sda
   8     1    8193118 sda1
   8     2    2048287 sda2
   8    16    1048576 sdb
   8    17     409626 sdb1
   8    18     409657 sdb2
   8    19     224910 sdb3



********************************phycial volumes************************************

Step:4  Now we are creating the phycial volume (/dev/sda3,/dev/sda4).one or more phycial volume creates the volume group.

[root@trash3can ~]# pvcreate /dev/sda3 /dev/sda4
  Physical volume "/dev/sda3" successfully created
  Physical volume "/dev/sda4" successfully created
[root@trash3can ~]#

Step:5 To check and verify the phycial volume by using the pvdisplay.

[root@trash3can ~]# pvscan
[root@trash3can ~]# pvdisplay
  "/dev/sda3" is a new physical volume of "101.98 MB"
  --- NEW Physical volume ---
  PV Name               /dev/sda3
  VG Name
  PV Size               101.98 MB
  Allocatable           NO
  PE Size (KByte)       0
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               nvle6H-L3cv-EFl3-2F70-EXRM-05bs-8iPQ7h
  "/dev/sda4" is a new physical volume of "101.98 MB"
  --- NEW Physical volume ---
  PV Name               /dev/sda4
  VG Name
  PV Size               101.98 MB
  Allocatable           NO
  PE Size (KByte)       0
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               Vbt35c-iOr3-5lIA-0U7q-O0Qb-uC2n-zdKTcz

Note : Now you can see , We created the two PV ("/dev/sda3" , "/dev/sda4") Successfully

"/dev/sda3" is a new physical volume of "101.98 MB"
 PV Name               /dev/sda3
PV Size               101.98 MB

 "/dev/sda4" is a new physical volume of "101.98 MB"
PV Name               /dev/sda4
PV Size               101.98 MB


[root@trash3can ~]# pvs
  PV         VG   Fmt  Attr PSize  PFree
  /dev/sda2       lvm2 --    1.95G  1.95G
  /dev/sda3       lvm2 --   54.91M 54.91M
[root@trash3can ~]#
[root@trash3can ~]#
[root@trash3can ~]# pvscan
  PV /dev/sda2                      lvm2 [1.95 GB]
  PV /dev/sda3                      lvm2 [54.91 MB]
  Total: 2 [2.01 GB] / in use: 0 [0   ] / in no VG: 2 [2.01 GB]


********************************Volume group *************************************

Step:6  Now we are creating the volume group by using two phycial volume ("/dev/sda3" , "/dev/sda4")and we need to give the volume group name(vg).

[root@trash3can ~]# vgcreate vg /dev/sda3 /dev/sda4
  Volume group "vg" successfully created

Here volume name is vg


Step:7 To check and verify the volume group by using the vgdisplay.

[root@trash3can ~]# vgs
  VG              #PV #LV #SN Attr   VSize VFree
  my_volume_group   2   0   0 wz--n- 2.00G 2.00G
[root@trash3can ~]# vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "my_volume_group" using metadata type lvm2
[root@trash3can ~]# vgdisplay
  --- Volume group ---
  VG Name               vg
  System ID
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  1
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                0
  Open LV               0
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               200.00 MB
  PE Size               4.00 MB
  Total PE              50
  Alloc PE / Size       0 / 0
  Free  PE / Size       50 / 200.00 MB
  VG UUID               nMofQi-kjDL-B8uS-zG0s-90Gk-s2Fe-mqjCv2
Note :
VG Name               vg
VG Access             read/write
VG Status             resizable
VG Size               200.00 MB(+100 M + 100M)
PE Size               4.00 MB



*******************************Logical volume *************************************

Step:8 Now we will create the logical volume.Here logical volume name is lv and size is +50M

[root@trash3can ~]# lvcreate -L +50M -n lv /dev/vg
  Rounding up size to full physical extent 52.00 MB
  Logical volume "lv" created

L- length of the LV
n- used to define the name of the lv

Step:9 to check and verify wheather lv created or not.

[root@trash3can ~]# lvs
  LV                VG              Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  my_logical_volume my_volume_group -wi-a- 500.00M                            
[root@trash3can ~]# lvscan
  ACTIVE            '/dev/my_volume_group/my_logical_volume' [500.00 MB] inherit
[root@trash3can ~]#

[root@trash3can ~]# lvdisplay
  --- Logical volume ---
  LV Name                /dev/vg/lv
  VG Name                vg
  LV UUID                I33kZN-j74r-yu6w-xx0R-23Sc-pTRg-n5uG4I
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                52.00 MB
  Current LE             13
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

Note :
LV Name                /dev/vg/lv
LV Size                52.00 MB
Block device           253:0(100+100+50)



******************************Create the file system *********************************
Step:10 Create the file system by using the mkfs command.

[root@trash3can ~]# mkfs.ext3 /dev/vg/lv
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
13328 inodes, 53248 blocks
2662 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=54525952
7 block groups
8192 blocks per group, 8192 fragments per group
1904 inodes per group
Superblock backups stored on blocks:
        8193, 24577, 40961
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.


Step:11  Create the directory to mount the File system .


[root@trash3can ~]# mkdir LVM

Step:12

[root@trash3can ~]# mount /dev/vg/lv LVM/

Step:13 Check and verify

[root@trash3can ~]# df -HTP
Filesystem    Type     Size   Used  Avail Use% Mounted on
/dev/sda1     ext3     8.2G   5.8G   2.0G  75% /
/dev/sda2     ext3     2.1G    37M   1.9G   2% /swap
tmpfs        tmpfs     531M      0   531M   0% /dev/shm
/dev/mapper/vg-lv ext3    53M   5.1M    45M  11% /root/LVM



*****************************LVM mounting****************************************

Step:14 We need to add  the entries in /etc/fstab to make the parmanent entries


[root@trash3can ~]# vim /etc/fstab
/dev/mapper/vg-lv       /root/LVM              ext3    defaults         0 0

[root@trash3can ~]# mount -a
[root@node1 ~]# mount |grep lv
/dev/mapper/vg-lv on /root/LVM type ext3 (rw)
[root@trash3can ~]# cp /etc/passwd LVM/
[root@trash3can ~]# ll LVM/
total 14
drwx------ 2 root root 12288 Dec 28 08:22 lost+found
-rw-r--r-- 1 root root  1791 Dec 28 09:20 passwd

Step:15  Reboot the system to verify that the file system is automatically mounted after boot with df-HTP command


 [root@trash3can ~]# df -HTP
Filesystem    Type     Size   Used  Avail Use% Mounted on
/dev/sda1     ext3     8.2G   5.8G   2.0G  75% /
/dev/sda2     ext3     2.1G    37M   1.9G   2% /swap
tmpfs        tmpfs     531M      0   531M   0% /dev/shm
/dev/mapper/vg-lv ext3    53M   5.1M    45M  11% /root/LVM

***********************************LV extend**************************************

LVM Management (LV extend)
grom volumes
Growing volumes
a) lvextend can grow the logical volumes.
b)resize2fs can grow ext3 File system online and offline


>>>Extend <<<
Step:16  Extend the lv with 100 M size

[root@trash3can ~]# lvextend -L +100M /dev/vg/lv
Extending logical volume lv to 152.00 MB
Logical volume lv successfully resized
[root@trash3can ~]# lvdisplay
--- Logical volume ---
LV Name /dev/vg/lv
VG Name vg
LV UUID I33kZN-j74r-yu6w-xx0R-23Sc-pTRg-n5uG4I
LV Write Access read/write
LV Status available
# open 0
LV Size 152.00 MB >>>
Current LE 38
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
Step:17 Still size is 53M

[root@trash3can ~]# df -HTP
Filesystem    Type     Size   Used  Avail Use% Mounted on
/dev/mapper/vg-lv ext3    53M   5.1M    45M  11% /root/LVM

Step:18 We need to run the commad to make the changes onine

[root@trash3can ~]# resize2fs -p /dev/vg/lv
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/vg/lv is mounted on /root/LVM; on-line resizing required
Performing an on-line resize of /dev/vg/lv to 155648 (1k) blocks.
The filesystem on /dev/vg/lv is now 155648 blocks long.
[root@trash3can ~]# df -h LVM/
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg-lv     148M  5.3M  135M   4% /root/LVM
Now size has been changed (148M)

*********************************************************************************
EXTRA Info

Step:19  Shrinking volume must be done offline umount
[root@trash3can ~]# umount LVM/
Requires a file ssytem check e2fsck
[root@trash3can ~]# e2fsck -F /dev/vg/lv
e2fsck 1.39 (29-May-2006)
/dev/vg/lv: clean, 12/36176 files, 9945/155648 blocks



*********************************************************************************
Now I am adding one more disk in FS(/dev/sd5)


[root@trash3can ~]# pvcreate /dev/sda5
  Physical volume "/dev/sda5" successfully created
[root@trash3can ~]# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               vg
  PV Size               1.95 GB / not usable 287.50 KB
  Allocatable           yes
  PE Size (KByte)       4096
  Total PE              500
  Free PE               462
  Allocated PE          38
  PV UUID               vDEBXN-PSdT-Xqfv-T0fL-856Z-jB4d-aM7xks
  --- Physical volume ---
  PV Name               /dev/sda3
  VG Name               vg
  PV Size               101.98 MB / not usable 1.98 MB
  Allocatable           yes
  PE Size (KByte)       4096
  Total PE              25
  Free PE               25
  Allocated PE          0
  PV UUID               8EogKA-i6H6-VrbB-YwLb-N0D1-ARlN-Wry1gI
  "/dev/sda5" is a new physical volume of "54.88 MB"
  --- NEW Physical volume ---
  PV Name               /dev/sda5
  VG Name
  PV Size               54.88 MB
  Allocatable           NO
  PE Size (KByte)       0
  Total PE              0
  Free PE               0
  Allocated PE          0







Monday, 29 September 2014

How to create new file system in Linux



Hello Friend's, In this session i am going to tall you how to create New File System in Linux.



***************Creatation of File system *****************
These are the basic step's before creating the FS.
1- Identity device
2- Partition device
3- Make file system
4- Label file system
5- Create a entry in /etc/fstab
6- Mount new file system
***************************************************


Linux File System






Step:1 Check the file system type and size
[root@trash3can/]# df -HTP
Filesystem    Type     Size   Used  Avail Use% Mounted on
/dev/sda1     ext3     8.2G   5.8G   2.0G  75% /
/dev/sda2     ext3     2.1G    37M   1.9G   2% /swap
tmpfs        tmpfs     531M      0   531M   0% /dev/shm

Step:2 To check the device (hda , sda) by using fdisk.check the new partition

[root@trash3can/]# fdisk -l
Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1020     8193118+  83  Linux
/dev/sda2            1021        1275     2048287+  83  Linux


Note : here deive is sda

Step:3
[root@trash3can/]# fdisk /dev/sda
The number of cylinders for this disk is set to 1305.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)
press n to add a new partition
Command (m for help): n
   e   extended
   p   primary partition (1-4)
press p for primary partition p
Partition number (1-4): 3
First cylinder (1276-1305, default 1276):
Using default value 1276
Last cylinder or +size or +sizeM or +sizeK (1276-1305, default 1305):
Using default value 1305
p   print the partition table
Command (m for help): p
Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1020     8193118+  83  Linux
/dev/sda2            1021        1275     2048287+  83  Linux
/dev/sda3            1276        1305      240975   83  Linux
w-write table to disk and exit
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.

[root@trash3can/]# fdisk -l
Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1020     8193118+  83  Linux
/dev/sda2            1021        1275     2048287+  83  Linux
/dev/sda3            1276        1305      240975   83  Linux


Step:4 while writing the partition table , the kernel encountered an error , and requested a reboot.This is normal , but unneccessary.View the contents of /proc/partitions
re
[root@trash3can/]# cat /proc/partitions
major minor  #blocks  name
   8     0   10485760 sda
   8     1    8193118 sda1
   8     2    2048287 sda2
The table will only reflect the original partitions.Execute partprobe and then again review /proc/partitions
[root@trash3can/]# partprobe
[root@trash3can/]# cat /proc/partitions
major minor  #blocks  name
   8     0   10485760 sda
   8     1    8193118 sda1
   8     2    2048287 sda2
   8     3     240975 sda3

Now you can see that kernel table is updated after running the partprobe command.Now you can see the sda3 partition.

Partprobe- reinitializes the kernel's in memory version of partitions table.

Step:5  Create an ext3 file system on the new partition and assign the label opt.

L - for file system labeling

File system labeling creates a layer of abstraction that allows you to identify filesystem by a unique label rather than the device name.

[root@trash3can/]# mkfs.ext3 -L opt /dev/sda3
mke2fs 1.39 (29-May-2006)
Filesystem label=opt
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
60480 inodes, 240972 blocks
12048 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
30 block groups
8192 blocks per group, 8192 fragments per group
2016 inodes per group
Superblock backups stored on blocks:
        8193, 24577, 40961, 57345, 73729, 204801, 221185
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 27 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.


Step:6 To see the file system lebel use blkid
[root@trash3can/]# blkid |grep opt
/dev/sda3: LABEL="opt" UUID="a2d2889b-6864-499a-a09c-2c2d55eb8f7d" SEC_TYPE="ext2" TYPE="ext3"
[root@trash3can/]# blkid
[root@trash3can~]# blkid
/dev/sda2: LABEL="/swap" UUID="301e794b-c712-4f29-8303-9411d470f97e" TYPE="ext3"
/dev/sda1: LABEL="/" UUID="d3bfad6c-da66-4db4-9217-023cd4119e24" TYPE="ext3"
/dev/cdrom: LABEL="RHEL/5.3 i386 DVD" TYPE="iso9660"
/dev/sda3: LABEL="/opt/" UUID="a2d2889b-6864-499a-a09c-2c2d55eb8f7d" TYPE="ext3"


Step:7 by using  e2label we can see the label
[root@trash3can~]# e2label /dev/sda3
/opt/

Step:8 Mount /opt/ directory by using mount command
[root@trash3can/]# mount LABEL=opt /opt/

Step:9 Make a permanent  in /etc/fstab
[root@trash3can/]# vim /etc/fstab
device name           mount point      file system type      options        dump-frequency     fsck_order
LABEL=opt               /opt               ext3                     defaults        0                        0

or
/dev/sda3

Step:9 mount -a command to mount the new file system under /opt
[root@trash3can/]# mount -a
Note : mount -a command to check the /etc/fstab and mount the new file system.This also checks for errors that might prevent your system from booting properly.



Step:11 Reboot the system to verify that the file system is automatically mounted after boot with df-HTP command

[root@trash3can/]# df -HTP
Filesystem    Type     Size   Used  Avail Use% Mounted on
/dev/sda1     ext3     8.2G   5.8G   2.0G  75% /
/dev/sda2     ext3     2.1G    37M   1.9G   2% /swap
tmpfs        tmpfs     531M      0   531M   0% /dev/shm
/dev/sda3     ext3     239M   6.4M   221M   3% /opt





Wednesday, 14 May 2014

wordpress installation in Linux server


Hello friend's In this session i am going to tell you how to install Worldpress in Linux server, Wordpress is open source blogging tool and CMS based on PHP and mysql which runs on a web hosting service. Wordpress is use by more than 18.9% of the top 10 million website.
In order to install wp we have to configure the web server & mysql server.


So now i am going to configure mysql database,

wordpress installation

As you can see sql database has been configured successfully and time to download Wordpress and configure the same, I already downloaded wordpress zip file,

wordpress installation in linux


Ok guys we successfully configured the wordpress config file and added the our mysql database, user and password, all configuration done now time to move and install wordpress

Go to you browser and type http://localhost (i did not configure dns server so i put localhost if you already install dns server then type you website name ) and fill required information
After filling the same click to install

wp installation

Bingo :) wordpress installed successfully :P. Now time to login...

wp installation


Here we go :D 

wp installation

I hope you like my tutorial if yes please share with others, if you have any doubt or quire feel free to ask me

Sunday, 11 May 2014

Scheduling a Cron Job


Hello Guys in this session i am going to tell you about Cron Job.
Cron job is similar like schedule task in windows,this program give you ability to execute a command or a script with a sequence of commands, at a specified date , time or at set intervals.

Although the package is installed by default, check to make sure it is installed on your system

#rpm -qa | grep cron

if. for some reason the package not installed, you can install the same via this command

# yum install -y cronie cronie-anacron crontabs

you also need to look at the config file that

/etc/cron.deny
if this file empty, all users are allow to create cron job.

 Before you start using the crontab command, however, you should look at the cron field description so you better understand how to create and edit cron job.

 ***** command_to _execute

 each star denotes Minute Hour Day_of_Month Month Day_of Week

 Minute = Minute of the hour, 00 to 59. * Will indicate   every minute

 Hour = Hour of the day in 24-hour format, 00 to 23. * Will indicate every hour

 Day = Day of the month, 1 to 31. * Will indicate every day

 Month = Month of the year, 1 to 12. * Will indicate every month

 Day = Day of the week, 3 chars - sun, mon, tue, or numeric (0=sun, 1=mon etc).... * Will indicate every day

 Task = The command you want to execute






Friday, 9 May 2014

ssh loging without password


Hello guys, i am back with my new tutorial, Today i am going to tell you how to configure ssh longing with key authentication,
ssh is basically secure way to transfer data remote Linux UNIX system and you can upload download and manage your server, it is installed by default
you can perform variety of task via this like Automate the longing, making backup, uploading file, downloading file, run commands, 

Scenario :- I have window 8 installed machine and my remote system having cantos (you can use any other flavor like Ubuntu, Kali, SUSE ) so i am going to use putty-gen to create authentication key and putty to connect our remote server,



so first i am creating our authentication key through putty-gen, while generating key keep moving your mouse its speed up the process.



so now you can see our authentication key has been generated, now i am going to save both key Public and private, 
Private key :- Private key contain information about your system (like MAC Address and other) and encryption, the user keep the private key secret and user it to encrypt outgoing data and decrypt incoming data, for the security point permissions for the private key should be set so that only owner can access the key
Public key :- The user share the copy of public key to allow anyone to use encrypting data to be sent to the user and for decrypting data received from the user




this is how key look,



Now time to setup your server, create the file in .ssh folder with the name of authorized_key and copy the key and stop password loging 




Now open the putty and put your server ip and port 


Now we have to locate the private key which we saved 




And here we go :) we are success fully connected with Linux server with ssh key..



Feel free to contact me regarding any queries, ideas and suggestions, I need your valuable ideas,
Thanks :)

Wednesday, 19 March 2014

zip & gzip compression


Zip & gzip compression command...