Here my partition is on lvm (Logical volume manager)
1 2 3 4 5 6 7 |
[root@racnode2 ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup00-LogVol00 16G 13G 1.6G 90% / /dev/sda1 487M 41M 421M 9% /boot tmpfs 1004M 176M 828M 18% /dev/shm .host:/ 1.9T 1.1T 821G 56% /mnt/hgfs |
Check physical volume
1 2 3 |
[root@racnode2 ~]# pvs PV VG Fmt Attr PSize PFree /dev/sda2 VolGroup00 lvm2 a-- 19.50G 0 |
Check Volume group
1 2 3 |
[root@racnode2 ~]# vgs VG #PV #LV #SN Attr VSize VFree VolGroup00 1 2 0 wz--n- 19.50G 0 |
here you can see i have only one disk sda
1 2 3 4 5 6 7 8 9 10 11 12 |
[root@racnode2 by-path]# ll /dev/disk/by-path total 0 lrwxrwxrwx 1 root root 9 Jul 13 16:52 ip-sunil-pc:3260-iscsi-iqn.2008-08.com.starwindsoftware:sunil-pc-racnode1-lun-0 -> ../../sdb lrwxrwxrwx 1 root root 10 Jul 13 16:52 ip-sunil-pc:3260-iscsi-iqn.2008-08.com.starwindsoftware:sunil-pc-racnode1-lun-0-part1 -> ../../sdb1 lrwxrwxrwx 1 root root 9 Jul 13 16:52 ip-sunil-pc:3260-iscsi-iqn.2008-08.com.starwindsoftware:sunil-pc-racnode1-lun-1 -> ../../sdc lrwxrwxrwx 1 root root 10 Jul 13 17:02 ip-sunil-pc:3260-iscsi-iqn.2008-08.com.starwindsoftware:sunil-pc-racnode1-lun-1-part1 -> ../../sdc1 lrwxrwxrwx 1 root root 9 Jul 13 16:52 ip-sunil-pc:3260-iscsi-iqn.2008-08.com.starwindsoftware:sunil-pc-racnode1-lun-2 -> ../../sdd lrwxrwxrwx 1 root root 10 Jul 13 17:02 ip-sunil-pc:3260-iscsi-iqn.2008-08.com.starwindsoftware:sunil-pc-racnode1-lun-2-part1 -> ../../sdd1 lrwxrwxrwx 1 root root 9 Jul 13 16:51 pci-0000:00:07.1-ide-0:0 -> ../../hdc lrwxrwxrwx 1 root root 9 Jul 13 16:51 pci-0000:00:10.0-scsi-0:0:0:0 -> ../../sda lrwxrwxrwx 1 root root 10 Jul 13 16:51 pci-0000:00:10.0-scsi-0:0:0:0-part1 -> ../../sda1 lrwxrwxrwx 1 root root 10 Jul 13 16:51 pci-0000:00:10.0-scsi-0:0:0:0-part2 -> ../../sda2 |
Now i will add new disk to my virtual machine
right click on the virtual machine and select settings
then click on add select hard disk from the above list
click on next
select scsi and click next
create new disk and click next
specify disk capacity in my case i am adding 15g and click on split virtual disk into multiple files and click next
provide the diskname.vmdk and specify the location where it should be saved and click on finish
click on ok to exit the virtual machine settings
no need to restart the running virtual machine just type the below command so that system scans the new disk
1 |
[root@racnode2 /]# echo "- - -" > /sys/class/scsi_host/host0/scan |
new disk is added /dev/sde
1 2 3 4 5 6 7 8 9 10 11 12 13 |
[root@racnode2 /]# ll /dev/disk/by-path/ total 0 lrwxrwxrwx 1 root root 9 Jul 13 16:52 ip-sunil-pc:3260-iscsi-iqn.2008-08.com.starwindsoftware:sunil-pc-racnode1-lun-0 -> ../../sdb lrwxrwxrwx 1 root root 10 Jul 13 16:52 ip-sunil-pc:3260-iscsi-iqn.2008-08.com.starwindsoftware:sunil-pc-racnode1-lun-0-part1 -> ../../sdb1 lrwxrwxrwx 1 root root 9 Jul 13 16:52 ip-sunil-pc:3260-iscsi-iqn.2008-08.com.starwindsoftware:sunil-pc-racnode1-lun-1 -> ../../sdc lrwxrwxrwx 1 root root 10 Jul 13 17:02 ip-sunil-pc:3260-iscsi-iqn.2008-08.com.starwindsoftware:sunil-pc-racnode1-lun-1-part1 -> ../../sdc1 lrwxrwxrwx 1 root root 9 Jul 13 16:52 ip-sunil-pc:3260-iscsi-iqn.2008-08.com.starwindsoftware:sunil-pc-racnode1-lun-2 -> ../../sdd lrwxrwxrwx 1 root root 10 Jul 13 17:02 ip-sunil-pc:3260-iscsi-iqn.2008-08.com.starwindsoftware:sunil-pc-racnode1-lun-2-part1 -> ../../sdd1 lrwxrwxrwx 1 root root 9 Jul 13 16:51 pci-0000:00:07.1-ide-0:0 -> ../../hdc lrwxrwxrwx 1 root root 9 Jul 13 16:51 pci-0000:00:10.0-scsi-0:0:0:0 -> ../../sda lrwxrwxrwx 1 root root 10 Jul 13 16:51 pci-0000:00:10.0-scsi-0:0:0:0-part1 -> ../../sda1 lrwxrwxrwx 1 root root 10 Jul 13 16:51 pci-0000:00:10.0-scsi-0:0:0:0-part2 -> ../../sda2 lrwxrwxrwx 1 root root 9 Jul 13 20:28 pci-0000:00:10.0-scsi-0:0:1:0 -> ../../sde |
now follow the step to extend the root partition
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
[root@racnode2 /]# fdisk /dev/sde 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 2610. 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): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-2610, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-2610, default 2610): Using default value 2610 Command (m for help): t Selected partition 1 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. |
create physical volume & check /dev/sde1 has 19.99G free space.
1 2 3 4 5 6 |
[root@racnode2 /]# pvcreate /dev/sde1 [root@racnode2 /]# pvs PV VG Fmt Attr PSize PFree /dev/sda2 VolGroup00 lvm2 a-- 19.50G 0 /dev/sde1 lvm2 a-- 19.99G 19.99G |
we have only one volume group VolGroup00 so we will extend our volume group first
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
[root@racnode2 /]# vgextend VolGroup00 /dev/sde1 Volume group "VolGroup00" successfully extended [root@racnode2 /]# pvs PV VG Fmt Attr PSize PFree /dev/sda2 VolGroup00 lvm2 a-- 19.50G 0 /dev/sde1 VolGroup00 lvm2 a-- 19.97G 19.97G [root@racnode2 /]# vgs VG #PV #LV #SN Attr VSize VFree VolGroup00 2 2 0 wz--n- 39.47G 19.97G [root@racnode2 /]# vgdisplay --- Volume group --- VG Name VolGroup00 System ID Format lvm2 Metadata Areas 2 Metadata Sequence No 4 VG Access read/write VG Status resizable MAX LV 0 Cur LV 2 Open LV 2 Max PV 0 Cur PV 2 Act PV 2 VG Size 39.47 GB PE Size 32.00 MB Total PE 1263 Alloc PE / Size 624 / 19.50 GB Free PE / Size 639 / 19.97 GB VG UUID piJL9X-KUzZ-8dsJ-hb25-3077-p9y7-oXS2nq |
you can see Free PE is 639 / 19.97GB available
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
[root@racnode2 /]# lvdisplay --- Logical volume --- LV Name /dev/VolGroup00/LogVol00 VG Name VolGroup00 LV UUID 5RxWOP-7Vpu-eBlo-jJk9-6OuG-l1Cj-1RWHvl LV Write Access read/write LV Status available # open 1 LV Size 15.59 GB Current LE 499 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:0 --- Logical volume --- LV Name /dev/VolGroup00/LogVol01 VG Name VolGroup00 LV UUID twv0b6-BU84-9l0t-VV33-rZHX-doqI-d6gquY LV Write Access read/write LV Status available # open 1 LV Size 3.91 GB Current LE 125 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:1 [root@racnode2 /]# lvdisplay --- Logical volume --- LV Name /dev/VolGroup00/LogVol00 VG Name VolGroup00 LV UUID 5RxWOP-7Vpu-eBlo-jJk9-6OuG-l1Cj-1RWHvl LV Write Access read/write LV Status available # open 1 LV Size 15.59 GB Current LE 499 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:0 --- Logical volume --- LV Name /dev/VolGroup00/LogVol01 VG Name VolGroup00 LV UUID twv0b6-BU84-9l0t-VV33-rZHX-doqI-d6gquY LV Write Access read/write LV Status available # open 1 LV Size 3.91 GB Current LE 125 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:1 |
we have to extend our root partition which is /dev/VolGroup00/LogVol00
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
[root@racnode2 /]# lvextend -l +639 /dev/VolGroup00/LogVol00 Extending logical volume LogVol00 to 35.56 GB Logical volume LogVol00 successfully resized [root@racnode2 /]# resize2fs /dev/VolGroup00//LogVol00 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 9322496 (4k) blocks. The filesystem on /dev/VolGroup00//LogVol00 is now 9322496 blocks long. after extending the partition [root@racnode2 /]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup00-LogVol00 35G 13G 20G 40% / /dev/sda1 487M 41M 421M 9% /boot tmpfs 1004M 176M 828M 18% /dev/shm .host:/ 1.9T 1.1T 821G 56% /mnt/hgfs |
if you have any doubts or need help please feel free to email me at sunil@sunilthetechfreak.com