I currently have a 4GB disk with a single primary FAT32 partition that has Windows 98SE installed. The disk is almost full and I want to move the partition over to a larger 8GB disk.


Using dd, how can I successfully clone the original 4GB disk to a larger 8GB disk and the Windows OS still be bootable?


For the purposes of the wider audience, it should be irrelevant whether I am using CompactFlash cards as hard disks for the purpose of this test. I see no reason why it is not suitable to substitute my use of CompactFlash cards with traditional IDE/SATA hard disks for users who have a similar question.


Instead of standard IDE/SATA hard disks, I use Transcend CompactFlash (CF) cards with an IDE CF adapter as the primary hard disks in my old hardware systems to run MS-DOS or Windows 95/98SE. The test system uses a IDE to CF adapter that treats the CompactFlash card as a conventional local hard disk.

I am using a Linux laptop with a USB CompactFlash reader to read/write the images from/to the CF.

For the purposes of my tests, the disks are identified in Linux as the following:

/dev/sda Transcend 4GB CompactFlash 133x

/dev/sdb Transcend 8GB CompactFlash 133x

In order to save reading time for those who do not wish to see what I have attempted, and know the perfect answer, please ignore the remaining text. For those who wish to see what I have attempted so far, please read further:


  1. dd 4GB disk to 8GB disk
  2. dd 4GB partition to 4G partition on 8GB disk
  3. clonezilla 4GB -> img -> 8GB
  4. Installing Windows to the 8GB disk

    4a. Restoring the 4GB partition to the 8GB disk

    4b. Restoring the 4GB partition to the 8GB disk then the 8GB MBR

NOTE: After each unsuccessful attempt (except 4a), to wipe the target disk clean, I deleted the partition(s) using GParted and created a new partition table to wipe the existing: Device -> Create Partition Table -> msdos -> Apply

1. dd 4GB disk to 8GB disk

My first attempt was to clone the whole disk using dd:

sudo dd if=/dev/sda of=win98se.img bs=4M; sync

then restore the disk image to the 8GB disk:

sudo dd if=win98se.img of=/dev/sdb bs=4M; sync

This didn't work. When starting the system, I see the error: "Invalid system disk. Replace the disk, and then press any key".

2. dd 4GB partition to 4G partition on 8GB disk

I cloned the partition from the 4GB disk instead of the whole disk:

sudo dd if=/dev/sda1 of=win98se_part.img bs=4M; sync

I then restored this 4GB partition to the 8GB disk:

sudo dd if=win98se_part.img of=/dev/sdb1 bs=4M; sync

I noticed this wouldn't start the operating system because there was no bootloader in the 8GB disk's MBR that knows how to boot Windows from the partition that I've just copied across.

In GParted, the partition layout looks correct but it won't boot because the necessary boot code isn't there: :

3. clonezilla 4GB -> img -> 8GB This test was done solely on the target system. I booted clonezilla live from a CD and saved the 4GB disk image to secondary storage (USB flash drive) using the device-image option and savedisk route. I then restored this image to the 8GB disk using the restoredisk route. However, I got the same error as in attempt #1.

4. Installing Windows to the 8GB disk

To confirm the 8GB disk was capable of booting Windows, I installed Windows 98SE from scratch (i.e. an installation CD) onto the 8GB disk. Once the installation was complete, and the OS could boot, I imaged the disk:

sudo dd if=/dev/sdb of=win98se_8gb.img bs=4M; sync

I also took a separate copy of the MBR:

sudo dd if=/dev/sdb of=~/tmp/transcend_8gb.mbr bs=512 count=1

4a. Restoring the 4GB partition to the 8GB disk

The 8GB disk now had a bootable MBR and partition that could boot (a basic and empty) Windows installation. Using dd, I copied the partition from the 4GB disk (as done in attempt #2) over the existing 8GB partition. This allowed me to boot into Windows and contained the data and configuration from the 4GB partition. However, this approach had created an 8GB partition that was only recognised as the original 4GB partition size in Windows. In GParted, it looked like this:

Shrinking and re-growing the partition with GParted did not solve the issue and Windows continued to see it as a 4GB disk.

4b. Restoring the 4GB partition to the 8GB disk then the 8GB MBR

From a clean disk, I used dd to copy the 4GB partition to the 8GB disk:

sudo dd if=win98se_part.img of=/dev/sdb1 bs=4M; sync

then copy the MBR (from the Windows 98 installation image) back to the 8GB card:

sudo dd if=transcend_8gb.mbr of=/dev/sdb

This results in the same as attempt #4a. Windows boots but the 4GB partition is now an 8GB partition but only recognised as 4GB (same screenshot as in attempt #4a).

I also attempted the same by copying across only the bootcode (the first 446 bytes of the MBR):

sudo dd if=transcend_8gb.mbr of=/dev/sdb bs=446 count=1

But that did not work because when trying to dd the partition to the target disk, it wasn't visible.

I've now spent 6 days on this trying different approaches in a different order (dd MBR then partition and vice versa) but I'm not having any success.




How to perform system migration to a smaller drive using the unix/linux tool dd?


  • I've not tried it, but there is a tool called fatresize which may be the missing ingredient? (ie dd 4gig to 8 gig disk then repartition end point with fdisk or similar, then expand the disk with fatresize.
    – davidgo
    May 2, 2020 at 9:42
  • I'm not so sure that Windows 98SE and GParted agree on the exact format of the disk or the partition table, as the distance in time is too large. At a guess, I would try to use the Windows 98SE fdisk utility to create and/or resize the target partition.
    – harrymc
    May 2, 2020 at 9:48
  • @harrymc - unfortunately, the FDISK utility from this era is rather primitive and does not have such partition resizing features. The format of the partition table (for FAT32) was a standard set before Windows 98 and hasn't changed since. This is to maintain compatibility between disks and various utilities.
    – jimjamz
    May 2, 2020 at 10:09

1 Answer 1


I was able to solve this thanks to the comment @davidgo made, fatresize was the answer I was looking for.

  1. sudo fdisk -s /dev/sdb1 to get the size of the partition in kB.
  2. sudo fatresize -v -s <size in kB> /dev/sdb1

Also note: there is a bug in fatresize when working with partitions with longer names like /dev/mmcblk0p1, so you may need to create a temporary soft link as Roberto mentioned at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=810735#20.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .