Please note that this blog has been moved.
Now it has its own domain: mynixworld.info 🙂
If you want to read the latest version of this article (recommended) please click here and I open the page for you.
I have a Win2K3 VM hosted by a KVM hypervisor. In the Linux host I have 2 Linux partitions type ID=83 (eg: /dev/sda5 and /dev/sdb5) that I’ve allocated to the Win2K3 VM as virtual disks. The Windows guest took care of the inner content of these virtual disks (which in fact are Linux partitions), so if you will ask your Linux host about “what kind of filesystem do they have?” then your Linux will answer “???”.
For instance, I ran the following command at the console:
parted /dev/sda print
it will answer like this:
Model: ATA WDC WD5000AAKS-6 (scsi) Disk /dev/sda: 500GB Sector size (logical/physical): 512B/512B Partition Table: msdos Number Start End Size Type File system Flags 1 1049kB 34.6MB 33.6MB primary ext2 boot 2 34.6MB 4330MB 4295MB primary linux-swap(v1) 3 4330MB 15.1GB 10.7GB primary ext4 4 85.2GB 500GB 415GB extended 5 85.2GB 112GB 26.8GB logical 6 112GB 187GB 75.2GB logical ext4
If you take a look at the partition number 5 then you will see that Linux has no idea about its filesystem. This is because partition #5 does not contain a filesystem on it (as Linux think of it), it contains a full structure of a physical disk (the metadata of the disk, the MBR, the partitions/volumes, the filesystem for each partition/volume, etc). It contains a identical copy of the Win2K3 virtual hard disk as seen by the Win2K3 VM.
That’s why it’s difficult to shrink a Linux partition that contains a full copy of a Windows hard drive. I’ve explained here one method (maybe there are more) how to do that.
But what’s happening when your Win2K3 virtual disk is in fact a Windows dynamic-disk?
The gparted will not help you right away because it cannot handle the Windows dynamic-disk, only the Windows basic-disk (by disk I mean Windows volume, if you like it). There are some commercial software which might make your life easier but I found also a working solution.
Let’s suppose your Windows dynamic-disk has 50G and was stored into your /dev/sdb5 Linux partition. You are using only 15G of it and you’ve decided that you can go with 20G, so you wish to release the rest of the 30G back to the Linux.
Create another Linux partition (don’t bother creating a filesystem) that should be at least 15G as size (because we want to copy all those 15G of the data on it). It could be stored on a external disk, on a USB disk or even in your RAM (if you can :o).
- In Win2K3 VM create another virtual disk an specify its full path as being the newly created partition (let’s suppose it is /dev/sdc9).
- Start your Win2K3 guest. Your disk will be detected and activated inside Windows.
- Quick-format it so it’ll become ready for use. Let’s name this volume as ‘F’
- Stop all services and/or programs that are using your dynamic-disk
- Copy all the data (~15G in our example) from the dynamic disk to the newly created volume (volume ‘F’)
- Delete your old dynamic-disk. Create a new partition on it with size 20G. Quick-format it and make sure you set the same drive letter as it was in the first place! This is now your new Windows basic-disk.
- Copy back all the data from the volume ‘F’ to the newly Windows basic-disk (see previous step)
- Shutdown your Windows
- Make sure you remove from your Win2K3 VM hardware list the last virtual disk you attached (/dev/sdc9)
- Your Windows partition have now only 20G as size. To shrink the 50G Windows disk to 20G Windows disk follow the steps described here.
So it is possible to convert back a Windows dynamic-disk to basic-disk, in my example it was little bit easier because I have to do all the steps in a pseudo-virtual world, but if you have your Windows installed on a bare metal PC then the steps will still remain the same, except that you should use/have/handle physical disks and not virtual disks (a virtual disks could be stored anywhere, from a partition on a physical disk to a file stored to USB/HDD/RAM/etc).