Increase the size of a Redhat 6.5 LVM disk in virtual machine Hyper-V
1. Introduction:
This post will show you how to increase the disk space for a Hyper-v virtual machine running Linux that is using logical volume manager (LVM). First we need to increase the size of the actual disk on the Hyper-v virtual machine. Once this is complete we will get into the virtual machine and make the changes through the operating system in order to take advantage of the additional space that has been provided by the hard drive being extended. This will involve creating a new partition with the new space, expanding the volume group and logical group, then resizing the file system.
Important Note: follow the commands and the screenshot.
2. Identifying the partition type:
we will first confirm that our partition type is actually Linux LVM by running the below command.
fdisk -l
Below is the disk information showing that our initial setup only has the one 60GB disk currently, which is under the logical volume named /dev/mapper/vg_redhatserver-lv_root this is what we will be expanding with the new disk.
3. Increasing the virtual hard disk:
First we increase the allocated disk space on the virtual machine itself. This is done by getting to 'Hyper-v Manager', in the right side click on 'Edit Disk
Choose the virtual machine disk
Select 'Expand'
Specify the size you want to expand. In this example the current size is 60GB so will increase it to 100GB
Click 'Finish'
4. Detect the new disk space:
A screenshot after performing this and confirming that the new space is displaying.
5. Partition the new disk space:
As outlined in the previous step the disk in my example that I am working with is /dev/sda. use 'fdisk' to create a new primary partition to make use of the new expanded disk space.
fdisk /dev/sda
Using fdisk to create a new partition, 'n' was selected for adding a new partition.
'p' is selected as we are making a primary partition.
As we already have /dev/sda1 and /dev/sda2 as shown in previous step, I will use '3' for this new partition which will be created as /dev/sda3
Press enter twice above as by default the first and last cylinders of the unallocated space should be correct. After this the partition is then ready.
't' is selected to change to a partition’s system ID, in this case we change to '3' which is the one we just created.
The hex code '8e' was entered as this is the code for a Linux LVM which is what we want this partition to be
'w' is used to write the table to disk and exit, basically all the changes that have been done will be saved and then you will be exited from fdisk.
A screenshot for all commands
Checking the partition /dev/sda3
That’s all for partitioning, we now have a new partition which is making use of the previously unallocated disk space from the increase in Hyper-v.
6. Increasing the logical volume:
Launch pvcreate command which creates a physical volume for later use by the logical volume manager (LVM). In this case the physical volume will be our new /dev/sda3 partition.
root@redhat-server:~# pvcreate /dev/sda3
Device /dev/sda3 not found (or ignored by filtering).
In order to get around this you can either reboot, as in this instance the disk does not appear to be there correctly despite showing in “fdisk -l”. After a reboot use the same command which will succeed.
After a reboot
Next we need to confirm the name of the current volume group using the vgdisplay command. vgdisplay provides lots of information on the volume group.
root@redhat-server:~# vgdisplay
--- Volume group ---
VG Name Mega
...
VG Size 59.51GiB
Now we extend the 'vg_redhatserver' volume group by adding in the physical volume of /dev/sda3 which we created using the pvcreate command earlier.
root@redhat-server:~# vgextend Mega /dev/sda3
Using the 'pvscan' command we scan all disks for physical volumes, this should confirm the original /dev/sda2 partition and the newly created physical volume /dev/sda3
root@redhat-server:~# pvscan
Increase the logical volume which basically means we will be taking our original logical volume and extending it over our new partition/physical volume of /dev/sda3.
Confirm the path of the logical volume using 'lvdisplay'.
root@redhat-server:~# lvdisplay
The logical volume is then extended using the 'lvextend' command.
root@redhat-server:~# lvextend /dev/vg_redhatserver/lv_root /dev/sda3
The final step which is to resize the file system so that it can take advantage of this additional space, this is done using the 'resize2fs' command for ext based file systems. It took about 30 seconds or less depending to the disk's speed.
root@redhat-server:~# resize2fs /dev/vg_redhatserver/lv_root
Now with the 'df' command we can see that the total available disk space has been increased.
Kocaeli
ReplyDeleteDenizli
Bursa
istanbul
Van
B5İSFJ
88E42
ReplyDeleteAksaray Lojistik
Rize Evden Eve Nakliyat
Çorum Lojistik
Antep Parça Eşya Taşıma
Kayseri Evden Eve Nakliyat
0D9C0
ReplyDeleteIğdır Lojistik
Denizli Evden Eve Nakliyat
Bursa Evden Eve Nakliyat
Kütahya Evden Eve Nakliyat
Urfa Evden Eve Nakliyat
B0FC7
ReplyDeleteSakarya Parça Eşya Taşıma
Çerkezköy Kurtarıcı
Diyarbakır Parça Eşya Taşıma
Ankara Fayans Ustası
Muş Şehir İçi Nakliyat
Eskişehir Şehir İçi Nakliyat
Çerkezköy Oto Boya
Bitci Güvenilir mi
Sivas Şehir İçi Nakliyat
B2DE1
ReplyDeleteÇorum Evden Eve Nakliyat
buy testosterone propionat
Bitlis Evden Eve Nakliyat
Niğde Evden Eve Nakliyat
Tekirdağ Cam Balkon
Çerkezköy Boya Ustası
Eskişehir Evden Eve Nakliyat
Ardahan Evden Eve Nakliyat
deca durabolin
E2EFE
ReplyDeleteorder steroid cycles
Trabzon Evden Eve Nakliyat
buy clenbuterol
Muğla Evden Eve Nakliyat
Edirne Evden Eve Nakliyat
testosterone propionat
Bayburt Evden Eve Nakliyat
Çerkezköy Fayans Ustası
testosterone propionat for sale
75034
ReplyDeleterastgele sohbet uygulaması
çorum mobil sesli sohbet
igdir telefonda canlı sohbet
rastgele sohbet siteleri
görüntülü sohbet
canli sohbet bedava
karaman sohbet uygulamaları
sinop en iyi rastgele görüntülü sohbet
yozgat sohbet chat
AA978
ReplyDeleteardahan sohbet siteleri
kütahya mobil sohbet siteleri
tekirdağ rastgele sohbet
antalya canlı sohbet odası
van canlı sohbet bedava
bedava sohbet siteleri
ardahan parasız sohbet
erzincan rastgele görüntülü sohbet
görüntülü sohbet siteleri ücretsiz