3

I am trying to expand the root partition on a VM which is not using LVM and I do not have (nor want to try and create then use) a disk to boot from. As such I followed what I felt was the logical series of actions (which multiple guides agree with me on):

  1. Resize the first partition in the partition table (using fdisk delete partition 1 and remake it with the same start point but a latter end point).
  2. Reboot
  3. Use resize2fs to extend the fs (it's ext4)

However, upon deleting and recreating the partition (maintaining id as 83, bootable flag as true and start point as 1) my system will not boot properly, it immediately goes to a grub command line.

So does anyone know what it is I'm doing wrong, and how I can fix it?

My fdisk looks like this:

Disk /dev/sda: 48.3 GB, 48318382080 bytes
255 heads, 63 sectors/track, 5874 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000520da

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1913    15360000   83  Linux
/dev/sda4            4000        5874    15060937+  83  Linux

And my fstab:

/dev/sda1               /                       ext4    defaults        1 1
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/sda4               /home/dbkats/rpmbuild   ext4    defaults        0 0
  • Which guides told you to resize the partition table. You would have had to resize the partition itself. What where the values of fdisk before you did this? What does your default grub command llook like? – Anthon Jun 11 '15 at 3:44
  • It looked like you somehow changed the size of the table, instead of what the table points to. As long as the start has not changed you should be fine. You don't happen to have (had) another Linux in the partitions between block 1913 and 5874 from which you were booting with an grub installed from that Linux? – Anthon Jun 11 '15 at 15:48
  • The resize2fs should not have moved existing block, but in case it did try to boot the system via USB/CD and re-run grub. – Anthon Jun 11 '15 at 15:50
  • Sorry, deleted my last comment due to formatting issues (still new to writing posts/comments): @Anthon Well, I am resizing the partition itself using fdisk (first destroy then recreate the parition then write changes to partition table), but from what I understand that really just rewrites the partition table. One (of the three I found) of the guides/posts I found that told me doing this was a fine idea is Here. – Graham Jun 11 '15 at 15:51
  • no problem. I read what is in there. Do any of my other suggestions apply? – Anthon Jun 11 '15 at 15:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.