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