Firstly, I should say that I am newbie at server management and virtualization area. After checking several tutorials about it, I tried to extend storage of virtual machine which is created in XenServer with taken snapshot from another VM. First, I shutdowned VM and extended storage from 40 GB to 80 GB via XenCenter. Then I started VM and enter fdisk with:
sudo fdisk /dev/xvda
Then I printed partition table:
Device Boot Start End Sectors Size Id Type /dev/xvda1 2048 999423 997376 487M 83 Linux /dev/xvda2 1001470 83884031 82882562 39.5G 5 Extended /dev/xvda5 1001472 83884031 82882560 39.5G 8e Linux LVM
I didn't see similar partition table on any tutorial. That's why I tried to create new partition table similar to this table. First I delete 5 and 2, then I created a new extended partition (2) and I created a Linux type partition (5). Lastly, I changed type of 5 to Linux LVM. Final partition table is like below:
Device Boot Start End Sectors Size Id Type /dev/xvda1 2048 999423 997376 487M 83 Linux /dev/xvda2 999424 167772159 166772736 79.5G 5 Extended /dev/xvda5 1001472 167772159 166770688 79.5G 8e Linux LVM
After checking table, I wrote table to disk and rebooted the VM. VM is started without any problem. I checked disk space with
sudo df -h, here is the output:
Filesystem Size Used Avail Use% Mounted on udev 12G 0 12G 0% /dev tmpfs 2.4G 8.7M 2.4G 1% /run /dev/mapper/dbvmviduio--vg-root 35G 1.7G 32G 6% / tmpfs 12G 0 12G 0% /dev/shm tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs 12G 0 12G 0% /sys/fs/cgroup /dev/xvda1 472M 101M 347M 23% /boot tmpfs 100K 0 100K 0% /run/lxcfs/controllers tmpfs 2.4G 0 2.4G 0% /run/user/1000
After all, I tried to run
resize2fs like written in tutorials. First I didn't know run resize2fs on xvda2 or xvda5, I tried both of them and I got these errors.
sudo resize2fs /dev/xvda2 resize2fs 1.42.13 (17-May-2015) resize2fs: Attempt to read block from filesystem resulted in short read while trying to open /dev/xvda2 Couldn't find valid filesystem superblock. sudo resize2fs /dev/xvda5 resize2fs 1.42.13 (17-May-2015) resize2fs: Device or resource busy while trying to open /dev/xvda5 Couldn't find valid filesystem superblock.
Is there any problem with partition table? How can I get over these issues?
Note: When I couldn't get over these issues, I tried to create just a Linux type partition (without extended), VM isn't started after reboot. (I reverted to snapshot after this).