FAQ SearchLogin
Tuxera Home
View unanswered posts | View active topics It is currently Wed May 12, 2021 00:13



Post new topic Reply to topic  [ 17 posts ] 
Dual-boot target system will not boot restored partition 
Author Message

Joined: Mon Jan 18, 2010 16:38
Posts: 30
Post Dual-boot target system will not boot restored partition
Greetings,

I have quite a bit of experience imaging operating systems and deploying from master images on a variety of platforms.

Working in a VirtualBox VM world, I have built one VM, hand installed Windows (XP), then added Xubuntu 12.04 behind it. I purposely made the Windows partitions small, intending to grow them with NTFSResize on target systems.

I built a second VM leaving gaps for more normal size Windows partitions in front, having Xubuntu 12.04 as a maintenance partition behind Windows.

I transferred the image from one VM to the other, restored it, also ran NTFSResize, and selecting the Grub menu entry for the Windows partition results in a black screen of nothingness.

Now, I have had good success backing up / restoring an image using NTFS-3G tools on bare metal in a dual boot Linux/Windows configuration. This is the first I am trying it within a VM container. Also this is the first I am transferring the image built with NTFS-3G in one VM and attempting to restore it to another VM. The VM settings as far as the virtual computer specifications are identical.

Suggestions where to start poking around to determine the failure spot that is causing this problem? Thank you.

Blessings,

_________________
--
Michael Lueck
Lueck Data Systems


Fri Feb 21, 2014 21:38
Profile

Joined: Mon Jan 18, 2010 16:38
Posts: 30
Post Re: Dual-boot target system will not boot restored partition
Greetings,

I forgot to add that I refreshed Grub after restoring the Windows image. Grub correctly identified the copy of Windows on the C: drive and created a Grub menu entry for it.

However, selecting that Grub menu entry leads to black screen of nothingness, not to Windows booting.

Blessings,

_________________
--
Michael Lueck
Lueck Data Systems


Fri Feb 21, 2014 21:59
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: Dual-boot target system will not boot restored partition
Hi,

Quote:
I transferred the image from one VM to the other, restored it, also ran NTFSResize, and selecting the Grub menu entry for the Windows partition results in a black screen of nothingness.

Booting Windows is fragile upon tinkering. Are the VM's run on the same physical computer ? Are the beginnings of the system partitions at the same location ?
Quote:
This is the first I am trying it within a VM container. Also this is the first I am transferring the image built with NTFS-3G in one VM and attempting to restore it to another VM. The VM settings as far as the virtual computer specifications are identical.

I have no personal experience with Windows in a VM, but I would suspect Windows is checking whether it is running on the same VM it was installed on. If you create a new VM on the same physical computer, and define its system disk as the same as the existing VM (so, simulating plugging the system disk to another identical computer), can it boot the installed Windows ?

Regards

Jean-Pierre


Fri Feb 21, 2014 23:15
Profile

Joined: Mon Jan 18, 2010 16:38
Posts: 30
Post Re: Dual-boot target system will not boot restored partition
For now yes they are both on the same physical host computer... my developer machine.

The one VM I intend to use for building the Windows image. That machine I started by hand installing Windows from an ISO of the official MS install CD, then added Linux behind Windows.

The second one, which I am attempting to restore the Windows image to, I left a blank partition at the front of the drive when I installed Linux. After installation I updated the /etc/fstab to point to that partition as NTFS, then restored the image to that partition.

The ultimate goal is to be able to roll out a standard image, use MS SysPrep to change the SID's of the cloned image, and so on.

It is as if even though Grub detected a copy of Windows on the drive, perhaps it did not correctly point to the correct place within that partition to chain the boot process onto.

Always I work with Windows on /dev/sda1 at the very front of the drive. Grub is on the MBR of the drive. I would think that ntfsclone would backup / restore sectors sequentially, so that should not be the trouble.

Like I said, I have done this successfully on bare metal drives, just not moving the image to a different drive. Windows XP is getting harder to support on the latest hardware, so desired to place it into a VM container. So I have done it that I hand install Windows, add Linux, ntfsclone to backup Windows, and restore it back to the same partition it came from.

Editing the Grub menu entry for Windows, I see that the uuid matches what I see under /dev/disk when I boot to Linux, so that seems in order.

ntldr should respond to the F8 key. I press F8 immediately after Enter on the Windows Grub menu choice, and I do not get the ntldr boot menu. Just a black screen with a cursor in the top/left corner.

_________________
--
Michael Lueck
Lueck Data Systems


Sat Feb 22, 2014 06:22
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: Dual-boot target system will not boot restored partition
Hi,

Quote:
The second one, which I am attempting to restore the Windows image to, I left a blank partition at the front of the drive when I installed Linux.

Did the partition intended for Windows start at the same sector ?
Quote:
It is as if even though Grub detected a copy of Windows on the drive, perhaps it did not correctly point to the correct place within that partition to chain the boot process onto.

AFAIK grub just designates a partition, but the Windows system partition contains a reference to its initial sector, which is used for booting.
Quote:
I would think that ntfsclone would backup / restore sectors sequentially, so that should not be the trouble.

If you want to be sure, you can use "dd" to make a copy....
Quote:
Editing the Grub menu entry for Windows, I see that the uuid matches what I see under /dev/disk when I boot to Linux, so that seems in order.

The uuid of the partition and its serial number are within the partition and saved/restored by ntfsclone, but Windows might check the hardware-defined id of the disk, so again, if you define the initial virtual system disk as the system disk for the new VM, what is the behavior ?

Regards

Jean-Pierre


Sat Feb 22, 2014 11:52
Profile

Joined: Mon Jan 18, 2010 16:38
Posts: 30
Post Re: Dual-boot target system will not boot restored partition
Greetings,

Quote:
Did the partition intended for Windows start at the same sector ?


What exactly are you asking here? In my mind, either VM the /dev/sda1 partition starts at the same place... absolute front of the drive.

Quote:
AFAIK grub just designates a partition, but the Windows system partition contains a reference to its initial sector, which is used for booting.


All right... so is there a tool which must be run in order to update that internal sector reference to be able to successfully restore a booting NTFS partition when cloning a master image?

Quote:
If you want to be sure, you can use "dd" to make a copy....


Actually I imaged NTFS with Linux that way before NTFS-3G / NTFSProgs came along... 8)

Quote:
but Windows might check the hardware-defined id of the disk, so again, if you define the initial virtual system disk as the system disk for the new VM, what is the behavior ?


And I find this where... within the VirtualBox VM configuration file?

_________________
--
Michael Lueck
Lueck Data Systems


Sat Feb 22, 2014 21:44
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: Dual-boot target system will not boot restored partition
Hi,

Quote:
Quote:
Did the partition intended for Windows start at the same sector ?

What exactly are you asking here? In my mind, either VM the /dev/sda1 partition starts at the same place... absolute front of the drive.

The /dev/sda1 starts at a sector which cannot be zero (this is reserved for the mbr). For example, "fdisk -l /dev/sda" on my computer returns :
Code:
[...]
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1              63       96389       48163+  de  Dell Utility
/dev/sda2   *       96390    41056390    20480000+   7  HPFS/NTFS/exFAT
/dev/sda3       478528155   488263544     4867695   db  CP/M / CTOS / ...
[...]

In this example Windows starts at sector 96390. Do you have the same value in your VMs ?
Quote:
All right... so is there a tool which must be run in order to update that internal sector reference to be able to successfully restore a booting NTFS partition when cloning a master image?

A change is needed if the initial sector is not the same... and if I had to do the change, I would probably have to use a hex editor. And I do not know whether some other parameter must match (for instance the total size of disk).
Quote:
And I find this where... within the VirtualBox VM configuration file?

When you create a new VM, on the third screen you are asked whether to create a new hard drive or to use an existing one.

Regards

Jean-Pierre


Sat Feb 22, 2014 22:26
Profile

Joined: Mon Jan 18, 2010 16:38
Posts: 30
Post Re: Dual-boot target system will not boot restored partition
The partition scheme of my Windows image builder VM is as follows:
Code:
mdlueck@vb1xp:~$ sudo fdisk /dev/sda

Command (m for help): p

Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders, total 83886080 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x96f896f8

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *          63     3068414     1534176    7  HPFS/NTFS/exFAT
/dev/sda2         3068476    83884031    40407778    f  W95 Ext'd (LBA)
/dev/sda5         3068478     6136829     1534176    7  HPFS/NTFS/exFAT
/dev/sda6         6137856     6526975      194560   83  Linux
/dev/sda7         6529024    26058751     9764864   83  Linux
/dev/sda8        26060800    83884031    28911616   83  Linux

Command (m for help):


The partition scheme of my Windows application packaging VM is as follows:
Code:
mdlueck@packagingxp:~$ sudo fdisk /dev/sda

Command (m for help): p

Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders, total 83886080 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0008a133

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048    29296639    14647296    7  HPFS/NTFS/exFAT
/dev/sda2        29298686    83884031    27292673    f  W95 Ext'd (LBA)
/dev/sda5        29298688    48828415     9764864    7  HPFS/NTFS/exFAT
/dev/sda6        48830464    49219583      194560   83  Linux
/dev/sda7        49221632    58984447     4881408   83  Linux
/dev/sda8        58986496    83884031    12448768   83  Linux

Command (m for help):


Now, I noticed right off that the partition types were not 7/f, rather Linux partition types. I changed them in fdisk to be 7/f, then restored the image and did ntfsresize to expand the C: drive. The Windows XP image would still not boot.

I also note that /dev/sda1 starts earlier (63) when Windows XP creates the partition than what Linux decides to use as the front of the drive. Next I will experiment with deleting / recreating /dev/sda1 on the packagingxp VM to try to get the start to be the same as the partition Windows created, 63.

Quote:
When you create a new VM, on the third screen you are asked whether to create a new hard drive or to use an existing one.


Oh, that screen. Of course I select a new HDD file. This is to prepare a generic image for mass deployment. I do not want to be hand copying virtual HDD files around, I want to distribute ntfsclone backed up partition images.

Thank you!

_________________
--
Michael Lueck
Lueck Data Systems


Sun Feb 23, 2014 01:25
Profile

Joined: Mon Jan 18, 2010 16:38
Posts: 30
Post Re: Dual-boot target system will not boot restored partition
gggrrrr....
Code:
Command (m for help): d
Partition number (1-8): 1

Command (m for help): n
Partition type:
   p   primary (0 primary, 1 extended, 3 free)
   l   logical (numbered from 5)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-83886079, default 2048):

Linux fdisk seems to refuse to begin a partition any earlier than 2048, whereas Windows XP was able to start the partition at 63.

Sounds like I will need to create the partitions with Linux, then install Windows to the existing partitions, to be able to successfully backup and restore the Windows partition with Linux.

Do you agree? Thank you.

_________________
--
Michael Lueck
Lueck Data Systems


Sun Feb 23, 2014 01:38
Profile

Joined: Mon Jan 18, 2010 16:38
Posts: 30
Post Re: Dual-boot target system will not boot restored partition
Eureka!!! It works!!!

Here is the working solution to the task:

(1) First load Linux leaving partitions for Windows to be installed to later at the front of the drive.
(2) Fix up the Windows partition types in Linux fdisk to 7/f so they are compatible with a dual-boot configuration.
(3) Install Windows XP to the first / C: partition
(4) Format the D: partition with Windows once the installation completes
(5) Boot off the Linux LiveCD again. Reinstall Grub as follows:
Code:
xubuntu@xubuntu:~$ sudo mkdir /mnt/boot
xubuntu@xubuntu:~$ sudo mount /dev/sda7 /mnt
xubuntu@xubuntu:~$ sudo mount /dev/sda6 /mnt/boot
xubuntu@xubuntu:~$ sudo grub-install --boot-directory=/mnt/boot /dev/sda
Installation finished. No error reported.

(6) Now, at this point, Grub will STILL not be able to boot Windows successfully.
(7) Reboot instead to Linux, issue:
Code:
$ sudo update-grub

(8) THEN rebooting to the Windows menu choice on the Grub screen WILL boot Windows successfully.

Ffffeeewwww!!!!

Now on to testing backing up / restoring a Windows image with NTFSClone... stay tuned!

_________________
--
Michael Lueck
Lueck Data Systems


Wed Feb 26, 2014 18:51
Profile

Joined: Mon Jan 18, 2010 16:38
Posts: 30
Post Re: Dual-boot target system will not boot restored partition
Eureka!!! It works "another notch"!!!

Just successfully restored the image to a VM totally built with Linux tools and Windows ala the Grub menu is booting beautifully, running through the proper ChkDsk step, and so on.

Thank you so much for your assistance.

_________________
--
Michael Lueck
Lueck Data Systems


Thu Feb 27, 2014 00:01
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: Dual-boot target system will not boot restored partition
Hi,

Quote:
Just successfully restored the image to a VM totally built with Linux tools and Windows ala the Grub menu is booting beautifully, running through the proper ChkDsk step, and so on.


Great !

Regards

Jean-Pierre


Thu Feb 27, 2014 14:31
Profile

Joined: Mon Jan 18, 2010 16:38
Posts: 30
Post Re: Dual-boot target system will not boot restored partition
Greetings,

All right, that milestone accomplished. Please advise on the order of operations and perceived success at accomplishing my end goal based on this success already achieved on this thread.

My intent is to deploy Windows SysPrep prepared images from a Linux maintenance operating system. The raw image transfer process has been achieved.

I wish to also:
1) execute ntfsresize to expand the deployed ntfsclone image to the size of the target partition.
2) mount the NTFS partition read/write with NTFS-3G to unpack hardware specific device drivers for the SysPrep mini install to deploy in the full PnP step

Do you have any advice on known incompatibilities performing these operations in one order and if done in another order we would have less difficulty?

Basically, should we perform the ntfsresize first, then mount the partition r/w to unpack hardware specific device drivers, or the other way around? Thank you!

Blessings,

_________________
--
Michael Lueck
Lueck Data Systems


Thu Feb 27, 2014 15:08
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: Dual-boot target system will not boot restored partition
Hi,

Quote:
1) execute ntfsresize to expand the deployed ntfsclone image to the size of the target partition.

Expanding a partition upward is straightforward. Expanding downward (by relocating the beginning) is more tricky.
Quote:
2) mount the NTFS partition read/write with NTFS-3G to unpack hardware specific device drivers for the SysPrep mini install to deploy in the full PnP step

The installation discs use the WIM format, which can be interpreted by wimlib (see http://sourceforge.net/projects/wimlib/)
Quote:
Do you have any advice on known incompatibilities performing these operations in one order and if done in another order we would have less difficulty?

Installing drivers is more than inserting files, for instance you may have to update the Windows registry.
Quote:
Basically, should we perform the ntfsresize first, then mount the partition r/w to unpack hardware specific device drivers, or the other way around? Thank you!

I have no experience about it, probably the order does not matter.

Regards

Jean-Pierre


Thu Feb 27, 2014 22:24
Profile

Joined: Mon Jan 18, 2010 16:38
Posts: 30
Post Re: Dual-boot target system will not boot restored partition
Quote:
Expanding a partition upward is straightforward.

I know and do so regularly.

Quote:
Expanding downward (by relocating the beginning) is more tricky.

Agreed. I specifically build images on a smallish partition, then expand to use available space on the target.

Quote:
Quote:
2) mount the NTFS partition read/write with NTFS-3G to unpack hardware specific device drivers for the SysPrep mini install to deploy in the full PnP step

The installation discs use the WIM format, which can be interpreted by wimlib


I think you did not understand me on this point. Once NTFSClone has restored the image to the node being reimaged, I then need to mound the NTFS filesystem "right away" aka no reboot, no allowing Windows to start... as SysPrep prepared images do some magic the next time they are booted. During the SysPrep mini install, I specify that a full PnP discovery is to be done based on the configuration of the target deploy configuration. Thus, PnP hardware is matched up with the correct device drivers located in an OemPnpDriverPath variable. (Similar to the system PATH environment variable.)

Thus, if I can successfully unpack / add device driver files to the generic Windows image, SysPrep mini install PnP step will take care of installing the drivers automatically / silently.

This capability allows me to update device drivers without touching the master image.

It also allows me to produce a very generic Windows image, and then bolt-on the appropriate hardware device drivers when the image is actually deployed to a specific hardware configuration.

Quote:
probably the order does not matter.


All right, then I will perform the NTFSClone / NTFSResize back-to-back, then mount the filesystem to unpack device drivers into directories specified in the OemPnpDriverPath.

I was concerned that perhaps running NTFSResize which tells Windows it needs to run ChkDsk at next boot might not mix well with mounting the partition r/w with NTFS-3G to add additional files.

Thank you so much! I appreciate your assistance!

Blessings,

_________________
--
Michael Lueck
Lueck Data Systems


Fri Feb 28, 2014 17:41
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: Dual-boot target system will not boot restored partition
Hi,

Quote:
Thus, if I can successfully unpack / add device driver files to the generic Windows image, SysPrep mini install PnP step will take care of installing the drivers automatically / silently.

Ok, provided you can boot Windows with minimal drivers on a different hardware.
Quote:
I was concerned that perhaps running NTFSResize which tells Windows it needs to run ChkDsk at next boot might not mix well with mounting the partition r/w with NTFS-3G to add additional files.

Should not be a problem under normal conditions.

Regards

Jean-Pierre


Fri Feb 28, 2014 22:51
Profile

Joined: Mon Jan 18, 2010 16:38
Posts: 30
Post Re: Dual-boot target system will not boot restored partition
Greetings,

Quote:
Ok, provided you can boot Windows with minimal drivers on a different hardware.

In the past, this has not been a problem so long as I prepared the image with all known mass storage drivers / devices which Windows by default supports. The SysPrep Mini Install PnP enumeration seemed to clear out all of the unnecessary drivers for the target hardware. It was necessary to have a Mass Storage (?) section in the SysPrep INF file, and there was a utility to read certain device driver INF files to dump out the hardware PnP identifiers in order to paste into the SysPrep INF file. I am going to attempt the same I have already had success with.

Last time I achieved this with Windows, I only needed one image per HAL. For the hardware configurations I supported then, that meant two images to support over a dozen (perhaps 18) different distinct models of desktops / laptops / tablets.

During the full PnP enumeration, I was able to swap in better device drivers - such as the Intel accelerated IDE/SATA drivers - to replace the generic MS driver it was first using. So, use MS default for boot-strap, then SysPrep PnP installs the vendor specific driver.

Thank you again!

Blessings,

_________________
--
Michael Lueck
Lueck Data Systems


Wed Mar 05, 2014 18:53
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ] 


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Original forum style by Vjacheslav Trushkin.