LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud
User Name
Password
Linux - Virtualization and Cloud This forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.

Notices


Reply
  Search this Thread
Old 06-09-2017, 03:34 AM   #1
TheOneFinn
LQ Newbie
 
Registered: Jun 2017
Posts: 3

Rep: Reputation: Disabled
Red face How to reinstall boot sector/partition in a hyperV vhdx in centos7?


I know, I know should have backed up. I even have daily backups but discovered that the VM's weren't selected (doh!)

Its Centos 7 (64bit) in a VM on a low powered (8 core atom) home windows box, the linux VM is my router/firewall/LAMP box (and to play with)

So I cant boot from the vhdx disk image directly, it just immediately fails and switches to trying to boot from the network. I found a year old vhdx backup which boots fine but was just really old. Thinking I might be able to recover some data from the new one I mounted both vhdx at once in Hyper V and to my surprise discovered that the version that came up is the new one, not the old one. All the data inside the vhdx seems fine.

Currently copying off what I can think of that I might have prodded but it seems like all that is wrong is it wont boot, otherwise it seems completely fine as near as I can tell.

The "old" drive is /dev/sda, the current one /dev/sdc with /dev/sdb being a swap drive

I've tried grub2-install /dev/sdc however it complains about

grub2-install: error: /usr/lib/grub/x86_64-efi/modinfo.sh doesn't exist. Please specify --target or --directory.

I'm not finding much help on google and was worried about breaking things further.

The only alternative i can think of is mounting both at once and copying the entire contents of the new over the old but thats complicated by them being logical volumes with the same uid

The root cause was I think hardware failure. Windows bluescreens with IRQ_NOT_LESS_EQUAL when trying to view the drive the vhdx lived on, however viewing/copying the contents via the command prompt worked fine.
 
Old 06-10-2017, 04:09 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,128

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
You can't rely on which of the two "same-UUID" images you will get access to. At least under Linux - I would guess Windoze is similar.
So make sure you get all your data backed up while you can.

I thought Hyper-V was only available on Pro versions - but it's Windoze, so I happy to be ignorant. I've fired it up only once.
Presuming the guest is an emulated BIOS/MBR setup, try "grub-install --target=i386-pc /dev/sdc" - but if you think the (real) disk is dead/dying, why are you bothering ?.
 
Old 06-10-2017, 05:40 AM   #3
TheOneFinn
LQ Newbie
 
Registered: Jun 2017
Posts: 3

Original Poster
Rep: Reputation: Disabled
Sorry, I guess I wasn't clear enough.

The vhdx is just a disk image file, like an ISO. The hard drive that that image file was on is dying but I've copied it off that drive to another. The guest is emulated with uefi rather than mbr.

Basically I seem to have lost the "bootable" nature of the Linux disk image, although reading up on uefi it seems it doesn't have a boot sector like the old mbr way so I need some way of reapplying that bootable status.

A suggestion I've got from another forum is to mount the centos install disk with the newer disk image and do a repair. I'm just waiting for the other data on that dodgy drive to finish copying off (new drive only just arrived) before I try that just in case.
 
Old 06-10-2017, 12:58 PM   #4
TheOneFinn
LQ Newbie
 
Registered: Jun 2017
Posts: 3

Original Poster
Rep: Reputation: Disabled
So I discovered the reason windows was blue screening, it had corrupted the swap files in some way and was bluescreening whenever the folders they were in were viewed, i.e. the root of the drives. Gotta love windows. Removing the swap files and I can view the drives fine. Presumably one of the bluescreens corrupted the vm while it was running.

However I tried booting off the installer and couldn't find an option to recover. I just seem to have a graphical language selection screen followed by a screen which requires me to choose an installation location, if I choose that it says that the partition only has 2 megs spare and seems to want to format, I've not gone further than that screen.

Edit: Actually now just found it, not sure why that initial menu wasnt coming up before

Last edited by TheOneFinn; 06-10-2017 at 01:07 PM. Reason: update
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Want to use Windows Boot Loader - Install to Boot Sector of Linux Partition? Xenarios Linux - Newbie 7 07-30-2010 03:41 AM
GRUB stage 1.5 on partition boot sector ? Vilius Linux - Software 1 03-02-2009 04:54 PM
Messed up partition table and Windows' partition boot sector pyromithrandir Linux - General 32 04-08-2006 12:26 PM
boot sector of extended partition canaan General 6 12-20-2005 12:03 AM
MBR and First Sector of Boot Partition. mrpc_cambodia Red Hat 1 08-25-2004 01:58 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud

All times are GMT -5. The time now is 09:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration