Wednesday 1 August 2012

Extended File System by adding a New Disk.




[root@myhost01 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                       17G   13G  3.4G  79% /
/dev/sda1              99M   43M   52M  45% /boot
tmpfs                 943M     0  943M   0% /dev/shm

[root@myhost01 ~]#
[root@myhost01 ~]#
[root@myhost01 ~]# fdisk /dev/sdd
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

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)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): p

Disk /dev/sdd: 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

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1

First cylinder (1-1305, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1305, default 1305):
Using default value 1305

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@myhost01 ~]# pvscan
  PV /dev/sda2   VG VolGroup00   lvm2 [19.88 GB / 0    free]
  Total: 1 [19.88 GB] / in use: 1 [19.88 GB] / in no VG: 0 [0   ]

[root@myhost01 ~]# pvcreate /dev/sdd1
  Physical volume "/dev/sdd1" successfully created

[root@myhost01 ~]# pvscan
  PV /dev/sda2   VG VolGroup00      lvm2 [19.88 GB / 0    free]
  PV /dev/sdd1                      lvm2 [10.00 GB]
  Total: 2 [29.87 GB] / in use: 1 [19.88 GB] / in no VG: 1 [10.00 GB]

[root@myhost01 ~]# vgextend VolGroup00 /dev/sdd1
  Volume group "VolGroup00" successfully extended

[root@myhost01 ~]# lvresize -L 25G /dev/VolGroup00/LogVol00
  Extending logical volume LogVol00 to 25.00 GB
  Logical volume LogVol00 successfully resized

[root@myhost01 ~]# pvscan
  PV /dev/sda2   VG VolGroup00   lvm2 [19.88 GB / 0    free]
  PV /dev/sdd1   VG VolGroup00   lvm2 [9.97 GB / 1.94 GB free]
  Total: 2 [29.84 GB] / in use: 2 [29.84 GB] / in no VG: 0 [0   ]

[root@myhost01 ~]# resize2fs -p  /dev/VolGroup00/LogVol00 25G
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/VolGroup00/LogVol00 is mounted on /; on-line resizing required
Performing an on-line resize of /dev/VolGroup00/LogVol00 to 6553600 (4k) blocks.
The filesystem on /dev/VolGroup00/LogVol00 is now 6553600 blocks long.

[root@myhost01 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                       25G   13G   11G  54% /
/dev/sda1              99M   43M   52M  45% /boot
tmpfs                 943M     0  943M   0% /dev/shm




CentOS 5: Converting Ext3 to Ext4


OS: CentOS 5.6 64bit
Kernel version: 2.6.18-238.19.1.el5
Backup partition: /backup (mount from /dev/sdb)


1. First of all, its recommended to backup everything first. We will us ‘dd‘ command to backup the whole partition to another hard disk. That hard disk is attached via SATA cable. We will format the backup hard disk with ext3 filesystem and and mount as /backup partition:


$ fdisk /dev/sdb
.....

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-3916, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-3916, default 3916):
Using default value 3916

Command (m for help): w
The partition table has been altered!

......


The sequence I press in the keyboard is: n > p > 1 > enter > enter > w

2. Then, format the partition table /dev/sdb1 with ext3 filesystem:

$ mkfs.ext3 /dev/sdb1
3. Mount the backup partition to  /backup:

$ mkdir /backup
$ mount /dev/sdb1 /backup
4. Lets check our partition summary:

$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                       47G  3.3G   41G   8% /
/dev/sda1              99M   20M   75M  21% /boot
tmpfs                 501M     0  501M   0% /dev/shm
/dev/sdb1              76G  173M   75G   1% /backup
5. Lets backup “/” partition and put the image into backup directory:

$ dd if=/dev/VolGroup00/LogVol00 of=/backup/VolGroup00-LogVol00.bak
100466688+0 records in
100466688+0 records out
51438944256 bytes (51 GB) copied, 807.368 seconds, 63.7 MB/s
6. Now we need to install one package called e4fsprogs. The e4fsprogs packages contain a number of utilities for creating, checking, modifying, and correcting inconsistencies in fourth extended (ext4 and ext4dev) file systems:

$ yum -y install e4fsprogs
7. We start to do the ext4 filesystem conversion:

$ tune4fs -O extents,uninit_bg,dir_index /dev/VolGroup00/LogVol00
tune4fs 1.41.12 (17-May-2010)

Please run e4fsck on the filesystem.
8. As what has been advised, we need to run filesystem check after tune. I rather do this in single-mode (init 1) to reduce risks. DON’T PROCEED TO REBOOT ONCE THIS STEP COMPLETE!

$ init 1
$ e4fsck -fDC0 /dev/VolGroup00/LogVol00
.........
Group descriptor checksum is invalid. FIXED.
Adding dirhash hint to filesystem.

Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 3A: Optimizing directories
Pass 4: Checking reference counts
Pass 5: Checking group summary information

/dev/VolGroup00/LogVol00: ***** FILE SYSTEM WAS MODIFIED *****
/dev/VolGroup00/LogVol00: ***** REBOOT LINUX *****
/dev/VolGroup00/LogVol00: 112086/12558336 files (0.7% non-contiguous), 1252590/12558336 blocks
9. Change the /etc/fstab to make sure the system will mount the new ext4 filesystem afterwards:

$ vi /etc/fstab


Change following line:

/dev/VolGroup00/LogVol00 /                       ext4    defaults        1 1
10. Rebuild the initrd to make sure our system will mount /sysroot as ext4 and reboot the server once complete:

$ mkinitrd -v -f initrd-2.6.18-238.19.1.el5.img 2.6.18-238.19.1.el5
$ init 6
11. If we directly reboot after fsck on step 8, then we will have kernel panic, unless the kernel is 2.6.28 and later. Once up, lets check whether is it run on ext4 or not:

$ mount | grep ext4
/dev/mapper/VolGroup00-LogVol00 on / type ext4 (rw)




Tuesday 31 July 2012

Changing FS type from ext3 to ext4 in Linux


Now changing the ext3 FS to the ext4 FS type depends on the Requirement.
=========================================================================

=====>> check the fs type by the below information

[root@servername ~]# mount | grep -i media

/dev/mapper/vg3-media1 on /media type ext3 (rw)


=====>> also check in the fstab file

[root@servername ~]# cat /etc/fstab
/dev/vg0/root           /                       ext3    defaults        1 1
/dev/vg0/var            /var                    ext3    defaults        1 2
/dev/vg0/tmp            /tmp                    ext3    defaults        1 2
/dev/vg0/usr            /usr                    ext3    defaults        1 2
/dev/vg0/opt            /opt                    ext3    defaults        1 2
/dev/vg0/home           /home                   ext3    defaults        1 2
LABEL=/boot             /boot                   ext3    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/vg0/swap           swap                    swap    defaults        0 0
/dev/mapper/vg1-lv0     /data                   ext3    defaults,user_xattr     1 2
#/dev/mapper/vg2-media  /media                  ext4    defaults        1 2
/dev/mapper/vg3-media1  /media                  ext3    defaults        1 2


======>> umount the FS and give the below 2 commands and mount it with ext4 type.

[root@servername ~]# tune4fs -O extents,uninit_bg,dir_index /dev/vg3/media1
tune4fs 1.41.9 (22-Aug-2009)

Please run e4fsck on the filesystem.


[root@servername ~]# fsck.ext4 -fDC0 /dev/vg3/media1
e4fsck 1.41.9 (22-Aug-2009)

Do you really want to continue (y/n)? yes

/dev/vg3/media1: recovering journal

/dev/vg3/media1: ***** FILE SYSTEM WAS MODIFIED *****


=======>> now check the FS type has been changed to the ext4 type from ext3 as shown below.

[root@servername ~]# mount | grep -i media

/dev/mapper/vg3-media1 on /media type ext4 (rw)


=======>> Now change the FS type in the /etc/fstab to ext4 type.

[root@servername ~]# cat /etc/fstab
/dev/vg0/root           /                       ext3    defaults        1 1
/dev/vg0/var            /var                    ext3    defaults        1 2
/dev/vg0/tmp            /tmp                    ext3    defaults        1 2
/dev/vg0/usr            /usr                    ext3    defaults        1 2
/dev/vg0/opt            /opt                    ext3    defaults        1 2
/dev/vg0/home           /home                   ext3    defaults        1 2
LABEL=/boot             /boot                   ext3    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/vg0/swap           swap                    swap    defaults        0 0
/dev/mapper/vg1-lv0     /data                   ext3    defaults,user_xattr     1 2
#/dev/mapper/vg2-media  /media                  ext4    defaults        1 2
/dev/mapper/vg3-media1  /media                  ext4    defaults        1 2

Addition of New disk to the LINUX Server



Before the Addition of new disk to the Linux Server :
=============================================================================
======>> The total number of disks on the system can be seen through fdisk -l


[root@servername ~]# fdisk -l | more

Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          29      232911   83  Linux
/dev/sda2              30        2610    20731882+  8e  Linux LVM

Disk /dev/sdb: 536.8 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       65270   524281243+  8e  Linux LVM

Disk /dev/sdc: 536.8 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1       65270   524281243+  8e  Linux LVM

Disk /dev/sdd: 536.8 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1       65270   524281243+  8e  Linux LVM

Disk /dev/sde: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sde1               1       13054   104856223+  8e  Linux LVM

Disk /dev/sdf: 536.8 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdf1               1       65270   524281243+  8e  Linux LVM

Disk /dev/sdg: 536.8 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdg1               1       65270   524281243+  83  Linux

Disk /dev/sdh: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdh1               1        3916    31455238+  8e  Linux LVM

Disk /dev/sdi: 644.2 GB, 644245094400 bytes
255 heads, 63 sectors/track, 78325 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdi1               1       78325   629145562   8e  Linux LVM



Filesystem sizes on the server before the addition :
=====================================================

[root@servername ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg0-root  992M  483M  458M  52% /
/dev/mapper/vg0-var   2.0G  744M  1.2G  40% /var
/dev/mapper/vg0-tmp   992M  130M  812M  14% /tmp
/dev/mapper/vg0-usr   7.8G  1.3G  6.2G  17% /usr
/dev/mapper/vg0-opt   2.3G  982M  1.2G  46% /opt
/dev/mapper/vg0-home  992M   88M  853M  10% /home
/dev/sda1             221M   26M  183M  13% /boot
tmpfs                1006M     0 1006M   0% /dev/shm
/dev/mapper/vg1-lv0   2.0T  1.7T  277G  86% /data
/dev/mapper/vg3-media1
                      589G  553G  6.5G  99% /media


We are going to increase the size of the /media FS by adding disk to the vg3 volume group.



After adding the disk from the storage , you can check the new disk availability through the fdisk -l :
========================================================================================================
=====>> New disk added will be shown as /dev/sdj in the below output


[root@servername ~]# fdisk -l

Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          29      232911   83  Linux
/dev/sda2              30        2610    20731882+  8e  Linux LVM

Disk /dev/sdb: 536.8 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       65270   524281243+  8e  Linux LVM

Disk /dev/sdc: 536.8 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1       65270   524281243+  8e  Linux LVM

Disk /dev/sdd: 536.8 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1       65270   524281243+  8e  Linux LVM

Disk /dev/sde: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sde1               1       13054   104856223+  8e  Linux LVM

Disk /dev/sdf: 536.8 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdf1               1       65270   524281243+  8e  Linux LVM

Disk /dev/sdg: 536.8 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdg1               1       65270   524281243+  83  Linux

Disk /dev/sdh: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdh1               1        3916    31455238+  8e  Linux LVM

Disk /dev/sdi: 644.2 GB, 644245094400 bytes
255 heads, 63 sectors/track, 78325 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdi1               1       78325   629145562   8e  Linux LVM

Disk /dev/sdj: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdj doesn't contain a valid partition table



Now You are going to create a new partition to the allocated disk /dev/sdj as shown below with the commands :
=============================================================================================================


[root@servername ~]# fdisk /dev/sdj
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklab
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.


The number of cylinders for this disk is set to 13054.
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)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): p

Disk /dev/sdj: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-13054, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-13054, default 13054):
Using default value 13054

Command (m for help): p

Disk /dev/sdj: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdj1               1       13054   104856223+  83  Linux

Command (m for help): t
Selected partition 1
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
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.


=======>> Change the partition type from linux state to the linux LVM state by the command code 8e as shown above.

After the Patition done by the above process now you can able to see the partition as shown below with the Output :


Disk /dev/sdj: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdj1               1       13054   104856223+  8e  Linux LVM


=======>> Now create the pv on the server by the above partition.

[root@servername ~]# pvcreate /dev/sdj1
 Physical volume "/dev/sdj1" successfully created


=======>> vg free space before the addition of pv to the volumegroup.

[root@servername ~]# vgdisplay vg3
  /dev/vg2/media: read failed after 0 of 4096 at 0: Input/output error
  --- Volume group ---
  VG Name               vg3
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  5
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               600.00 GB
  PE Size               4.00 MB
  Total PE              153599
  Alloc PE / Size       153088 / 598.00 GB
  Free  PE / Size       511 / 2.00 GB
  VG UUID               aVQV67-68Ge-b6EK-FnbI-81S2-9wsr-EobIkt


=======>> Now extend the volume group by adding the pv as shown below

[root@servername ~]# vgextend vg3 /dev/sdj1
  Volume group "vg3" successfully extended


=======>> Now check the volume group free space on the server as shown below

[root@servername ~]# vgdisplay vg3
  /dev/vg2/media: read failed after 0 of 4096 at 0: Input/output error
  --- Volume group ---
  VG Name               vg3
  System ID
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  6
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               699.99 GB
  PE Size               4.00 MB
  Total PE              179198
  Alloc PE / Size       153088 / 598.00 GB
  Free  PE / Size       26110 / 101.99 GB
  VG UUID               aVQV67-68Ge-b6EK-FnbI-81S2-9wsr-EobIkt


=======>> Now increase ( 100GB )  the LV size as you needed the free space on the FS as shown below

[root@servername ~]# lvextend -L +100G /dev/vg3/media1
  Extending logical volume media1 to 698.00 GB
  Logical volume media1 successfully resized


=======>> Now resize the FS as shown below

[root@servername ~]# resize2fs -p /dev/vg3/media1

resize2fs 1.39 (29-May-2006)

Filesystem at /dev/vg3/media1 is mounted on /media; on-line resizing required

Performing an on-line resize of /dev/vg3/media1 to 182976512 (4k) blocks.

The filesystem on /dev/vg3/media1 is now 182976512 blocks long.


=======>> Now check the FS size with the below output.

[root@servername ~]# df -h /media
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg3-media1
                      688G  553G  100G  85% /media

Linux File Systems: Ext2 vs Ext3 vs Ext4


EXT2, EXT3 and EXT4 are all filesystems created for Linux. This article explains the following:

High level difference between these filesystems.
How to create these filesystems.
How to convert from one filesystem type to another.

===>> Ext2

Ext2 stands for second extended file system.
It was introduced in 1993. Developed by Rémy Card.
This was developed to overcome the limitation of the original ext file system.
Ext2 does not have journaling feature.
On flash drives, usb drives, ext2 is recommended, as it doesn’t need to do the over head of journaling.
Maximum individual file size can be from 16 GB to 2 TB
Overall ext2 file system size can be from 2 TB to 32 TB


===>> Ext3

Ext3 stands for third extended file system.
It was introduced in 2001. Developed by Stephen Tweedie.
Starting from Linux Kernel 2.4.15 ext3 was available.
The main benefit of ext3 is that it allows journaling.
Journaling has a dedicated area in the file system, where all the changes are tracked. When the system crashes, the possibility of file system corruption is less because of journaling.
Maximum individual file size can be from 16 GB to 2 TB
Overall ext3 file system size can be from 2 TB to 32 TB
There are three types of journaling available in ext3 file system.
Journal – Metadata and content are saved in the journal.
Ordered – Only metadata is saved in the journal. Metadata are journaled only after writing the content to disk. This is the default.
Writeback – Only metadata is saved in the journal. Metadata might be journaled either before or after the content is written to the disk.
You can convert a ext2 file system to ext3 file system directly (without backup/restore).
===>> Ext4

Ext4 stands for fourth extended file system.
It was introduced in 2008.
Starting from Linux Kernel 2.6.19 ext4 was available.
Supports huge individual file size and overall file system size.
Maximum individual file size can be from 16 GB to 16 TB
Overall maximum ext4 file system size is 1 EB (exabyte). 1 EB = 1024 PB (petabyte). 1 PB = 1024 TB (terabyte).
Directory can contain a maximum of 64,000 subdirectories (as opposed to 32,000 in ext3)
You can also mount an existing ext3 fs as ext4 fs (without having to upgrade it).
Several other new features are introduced in ext4: multiblock allocation, delayed allocation, journal checksum. fast fsck, etc. All you need to know is that these new features have improved the performance and reliability of the filesystem when compared to ext3.
In ext4, you also have the option of turning the journaling feature “off”.
Use the method we discussed earlier to identify whether you have ext2 or ext3 or ext4 file system.

Warning: Don’t execute any of the commands given below, if you don’t know what you are doing. You will lose your data!

Creating an ext2, or ext3, or ext4 file system

Once you’ve partitioned your hard disk using fdisk command, use mke2fs to create either ext2, ext3, or ext4 file system.

Create an ext2 file system:

=====>> #mke2fs /dev/sda1
Create an ext3 file system:

=====>> #mkfs.ext3 /dev/sda1

(or)

=====>> #mke2fs –j /dev/sda1
Create an ext4 file system:

=====>> #mkfs.ext4 /dev/sda1

(or)

=====>> #mke2fs -t ext4 /dev/sda1
Converting ext2 to ext3

For example, if you are upgrading /dev/sda2 that is mounted as /home, from ext2 to ext3, do the following.

=====>> #umount /dev/sda2

=====>> #tune2fs -j /dev/sda2

=====>> #mount /dev/sda2 /home
Note: You really don’t need to umount and mount it, as ext2 to ext3 conversion can happen on a live file system. But, I feel better doing the conversion offline.

Converting ext3 to ext4

If you are upgrading /dev/sda2 that is mounted as /home, from ext3 to ext4, do the following.

=====>> #umount /dev/sda2

=====>> #tune2fs -O extents,uninit_bg,dir_index /dev/sda2

=====>> #e2fsck -pf /dev/sda2

=====>> #mount /dev/sda2 /home
Again, try all of the above commands only on a test system, where you can afford to lose all your data.

Converting a root filesystem to ext4


Converting a root filesystem is a bit more tricky because you cannot unmount it, as your system is running on it. Nevertheless it is still possible to do it without using an external bootable media. You should do this in a single-user mode.

First step is to modify your /etc/fstab file to say "ext4" instead of "ext3" for root partition. This is important because you will be operating on a read-only filesystem later, and will not be able to make the change, and this would result in your system unable to mount a root filesystem on next boot.

Let us assume that root partition is /dev/sda1, so your /etc/fstab should look something like this.

=====>> #/dev/sda1 / ext4 defaults 0 1
Now remount the root filesystem read-only.

=====>> #mount -o remount,ro /
Then run a filesystem check on the root filesystem.

=====>> #fsck.ext3 -pf /dev/sda1
It will tell you to reboot the system. That may be a good idea, so simply boot into single-user mode and remount it read-only again. It is fine even though we have already modified /etc/fstab, because ext3 can be mounted as ext4 without conversion.

Next, enable all the ext4 features on the root filesystem.

=====>> #tune2fs -O extents,uninit_bg,dir_index /dev/sda1
And run run a filesystem check on the root filesystem again. It will find and fix errors. This is normal.

=====>> #fsck.ext4 -yfD /dev/sda1
You can now reboot to your new ext4 system, and enjoy faster filesystem check times, better performance, and all the improvements of ext4. Well, almost; read the next section.

Converting a non-root filesystem to ext4


As long as you are converting a filesystem that can be unmounted, it is fairly simple procedure. In this example we will be converting a /dev/sdc1 partition mounted as /home directory.

First, unmount the partition.

=====>> umount /dev/sdc1
Next, run a filesystem check on it to make sure it is in sane condition. We are still on ext3.

=====>> fsck.ext3 -pf /dev/sdc1
Enable new features of ext4 on the filesystem.

=====>> tune2fs -O extents,uninit_bg,dir_index /dev/sdc1
Option "extents" enables the filesystem to use extents instead of bitmap mapping for files, "uninit_bg" reduces file system check times by only checking used portions of the disk, and "dir_index" allows storing the contents of large directories in a htree for faster access. Option "dir_index" is also supported by ext3, so you may already be using it, but it makes no harm to specify it here.

Run a filesystem check. It will find errors. It is normal. Let it fix them. You may want to run the check twice to make sure that the filesystem is now clean.

=====>> fsck.ext4 -yfD /dev/sdc1
The "-D" parameter will actually enable the "dir_index" option by rebuilding directory index. It can be rebuilt (optimized) at any later time by running the check with the parameter.

Now edit your /etc/fstab file to say "ext4" instead of "ext3" for /home. Other options may differ for your system.

/dev/sdc1 /home ext4 defaults 0 2
Try to mount your new ext4 filesystem.

=====>> mount /home
If it succeeds, congratulations. If not, do not panic. You have not lost your data. And you have a backup after all, right? Make sure you have all the latest tools listed in prerequisites. Get them form Debian unstable or experimental if needed. Upgrade and try again.