PLEX86  x86- Virtual Machine (VM) Program
 Plex86  |  CVS  |  Mailing List  |  Download  |  Linux  |  Newsgroups

Transfer Windows to larger hard drive success using Linux


Your Ad Here

Your Ad Here

Yes, Virginia, you CAN clone your Windows hard drive, and expand its parbreastion size to give it more breathing room by using a Linux live cd and Linux commands dd for the image transfer, fdisk for parbreastioning, and qtparted for parbreastion resizing.

First, thanks to Rajeev for his helpful page at Rajeev goes into many helpful details that I omit here.

Over the past year or so I've seen lots of posts on this "how do I transfer my Windows installation to a larger disk?" subject, and many various answers that often involve commercial software as a prerequisite. I finally performed the feat last night using free Linux tools and wanted to toss a cookie in the net.knowledge cookie jar.

THE TASK: My 120Gig Windows 2000 single parbreastion NTFS formatted drive was getting full, to be replaced with a new 250gig drive. Both are IDE parallel ATA drives. I had a cheapie $20 Bytecc external usb enclosure from newegg.com to help with the transfer.

Boot your favorite Linux live CD (Kanotix.com, UbuntuLinux.org, the new hard drive into an external usb enclosure. In many cases, at least on my gentoo distribution, the usb drive will bedev-sda. You can verify with the dmesg command right after plugging in your external drive to see what your device name is. For instance:

# dmesg .... usb 1-2: new high speed USB device using ehcihcd and address 3 scsi0 : SCSI emulation for USB Mbutt Storage devices usb-storage: device found at 3 usb-storage: waiting for device to settle before scanning Vendor: USB 2.0 Model: Storage Device Rev: 0100 Type: Direct-Access ANSI SCSI revision: 00 SCSI device sda: 241254720 512-byte hdwr sectors (123522 MB) sda: buttuming drive cache: write through SCSI device sda: 241254720 512-byte hdwr sectors (123522 MB) sda: buttuming drive cache: write through sda: sda1 Attached scsi disk sda at scsi0, channel 0, id 0, lun 0 usb-storage: device scan complete

Transfer Windows to larger hard drive success using Linux! 321
That's a good question, but I don't think so because when I copied the parbreastion table, I used...

This tells me my external drive was recognized as sda, which in my system, then the raw device isdev-sda If you don't see messages like this, maybe your Linux distro isn't set up to deal with usb mbutt storage devices.

My primary slave drive is my Windows drive (I have a multiboot system, with gentoo Linux living on the primary master hard drive hda). So the Windows drive i'm going to clonedev-hdb If you only have one drive, your existing drive will bedev-hda But then again on some live cd's they mount everything as scsi devices. A useful command that can help you navigate this:

$ dmesg egrep 'hdsd'

So now that we know our drive device names, onto the duplicating.

First you need to duplicate your parbreastioning. The Linux fdisk program is the tool for the job

# fdisk -l Diskdev-hda: 300.0 GB, 300068 plus 1052416 bytes this is my Linux drive -- not important Diskdev-hdb: 123.5 GB, 123522416640 bytes 255 heads, 63 sectors-track, 15017 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System dev-hdb1 * 1 15016 120615988+ 7 HPFS-NTFS Diskdev-sda: 251.0 GB, 251000193024 bytes 255 heads, 63 sectors-track, 30515 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System dev-sda1 * 1 30515 245111706 7 HPFS-NTFS

Now, make a parbreastion on the external new hard drive to match this exactly. Again, buttuming your external hard drive isdev-sda (the dmesg command can be helpful to show you--look at it right after you connect your external hard drive. IN my case it said it said it found a usb drive and added it as sda. Your mileage may vary).

# fdiskdev-sda You use n to create a new primary parbreastion 1 from 1 to the end number listed above t to change the type to type 7 a to toggle the boot flag w to write and quit

Now, verify and compare to make sure dev-hdb1 anddev-sda1 are idetntial parbreastions.

# fdisk -l ... Diskdev-hdb: 123.5 GB, 123522416640 bytes 255 heads, 63 sectors-track, 15017 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System dev-hdb1 * 1 15016 120615988+ 7 HPFS-NTFS Diskdev-sda: 251.0 GB, 251000193024 bytes 255 heads, 63 sectors-track, 30515 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System dev-sda1 * 1 15016 120615988+ 7 HPFS-NTFS

Next, copy the boot sector over, minus the parbreastion info. The boot sector is 512 blocks, but if we only copy the first 446 blocks of the primary slave drive to the external usb drive, this will leaves the parbreastion table that we just created alone and happy:

# dd if=-dev-hdb of=-dev-sda bs=446 count=1

Next I verified the block size, and how many blocks were in use on the source drive. I did this by mounting it read only and using the df command. Since it's an ntfs drive, the mount command looks like so:

# mkdirmnt-intdrive # mount -t ntfs -o rodev-hdb1mnt-intdrive # df Filesystem 1K-blocks Used Available Use% Mounted on ... dev-hda1 120615988 117746852 2868 plus 1136 98%mnt-extdrive

High memory pressure makes system nearly unresponsive. 324
On Mon, 6 Feb 2006 19:41:25 +0000 (UTC), Jeremiah DeWitt Weiner They've both been running in this box for over a year...

# umountmnt-intdrive

So in my case, I've got 120615988 blocks to copy off of my Windows parbreastion.

Now the big fun--here's where we clone

# dd if=-dev-hdb1 of=-dev-sda1 bs=1k count=120615988

And I left the joint for a few hours while this monster copied. After dd completed (and dd gives you no indications of progress--so long as the external hard drive is spinning and you don't see a count of records copied, it's still workin), to verify that things actually worked I did a couple quick tests: # mount -t ntfs -o rodev-hdb1mnt-intdrive # cdmnt-intdrive # du -s .

this will give you a large number for the amount of disk space in use by the old filesystem. We can compare that to the new drive:

# mkdirmnt-extdrive # mount -t ntfs -o rodev-sda1mnt-extdrive # cdmnt-extdrive # du -s .

Compare this disk usage number from your external drive to the disk usage reported for your original windows drive above. It should match. You could probably also do a find command and compare the output with diff on both mount points for a more exhaustive comparison of files and sizes. Instead, I just tried the new drive after shutting down the machine:

# shutdown -h now

So with the system powered down, I took the new drive out of the enclosure, rejumpered it to slave, and replaced my Windows drive with it inside the computer (on the primary controller).

I then booted the machine into Windows, and delightfully, it worked. It did say it detected new hardware and had me reboot once, but all was happy. All my apps, settings, and everything were there. I had successfully cloned the system to the new drive.

And there was much rejoicing. yay

So now, I had a 120G parbreastion on my new 250G drive, but the whole point of this exercise was that I'd filled up the Windows drive and wanted more space, so it ws time to resize this parbreastion to use the whole drive.

Rather than spend money on parbreastion magic or the like, I booted into Linux again, and ran:

# qtparted

I ignored the ntfs warning (since I've resized ntfs drives 3 other times now and they've all worked), and selecteddev-hdb1 chose the resize operation, slid the slider all the way to the right to resize it to consume the entire disk, and did "commit" I was able to do this with confidence since I did have a complete original clone of this drive at the ready in case of problems.

After qtparted, things should like like so:

# fdisk -l Diskdev-hda: 300.0 GB, 300068 plus 1052416 bytes my Linux parbreastion - move along Diskdev-hdb: 251.0 GB, 251000193024 bytes 255 heads, 63 sectors-track, 30515 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System dev-hdb1 * 1 30515 245111706 7 HPFS-NTFS

Notice the new ending cylinder of 30515 (The old value was 15016). The hdb1 parbreastion is now expanded from its original size of ~120Gig blocks to the 240Gig full capacity.

Pleased that I had successfully resized the parbreastion, I shut down the system, rebooted into Windows. Windows detected some problems, (rightly so), and took a while to run a chkdsk.

After chkdsk completed, Windows booted, said it had detected new hardware, and told me to reboot again. It did, and all was well.

High memory pressure makes system nearly unresponsive
I've recently been working with some rather large images, and noticed that when I do "pngtopnm largeimage.png pamdice" on a 125MB or so PNG, I lose pretty much all hope of having...

VMWare users only: ---------------------------------------------------------------------- As an additional note, on this mutliboot system, I do also run VMWare for Linux in my Linux parbreastion, and can boot my Windows machine inside of that using physical disk access mode todev-hdb I needed to create a new virtual machine after resizing the Windows parbreastion-- VMWare did not detect the change of disk size, and still had the old 120Gig size listed fordev-hdb. As such, when booting the Windows virtual machine, I'd get a BSOD indicating STOP 0x0000007b ... INACCESSIBLEBOOTDEVICE

As this did not happen when multibooting into Windows via grub, I reasoned that it was a VMWare bios issue. I was pleased to find that creating a new Windows virtual machine pointing todev-hdb in physical disk mode corrected this issue ----------------------------------------------------------------------

I hope someone else finds this helpful.

Best Regards, -- Todd H.



Your Ad Here

List | Previous | Next

Transfer Windows to larger hard drive success using Linux! 321

Linux groups from Newsgroups

The #1 Usenet Provider on the Internet

Mailwasher like app for Linux