13

enter image description here

I'm trying to extend the D: partition using unallocated 30.91 GB space at its left side.

Another thread states it can't be done using Disk Management's UI and it suggests using 3rd-party tools.

However, how can we do this natively (e.g. diskpart) without installing/downloading additional software?

  • "third-party tools use the system commands anyway" -- I believe you're thinking of defrag tools rather than partition managers. And yes, most do use MS's Defrag API for moving files but each one has their own layout algorithm (choosing which files go where). The Defrag API merely lets them move parts of files in a uniform, (relatively) safe, and supported manner. – afrazier Oct 13 '11 at 14:15
13

Yes that is possible. Copy all the data from your D drive to a different disk/partition, delete the volume of D and then re-create it. Then move your data back on the new D drive.

That is the only way without 3rd party tools.

  • 1
    Ughh, I totally forgot about this method. – surfasb Oct 14 '11 at 9:09
17

The reason why there's no simple way to do what you want is that the internal data structures in a partition record where files are located relative to the start of the partition.

Extending a partition to the right is relatively simple since it only requires changing the maximum size value.

Extending to the left also requires either relocating every sector of data, or modifying all the data structures in the partition to change their offset values to reflect the changed starting location. Neither of those operations are quick and during the process the partition is not internally consistent which means that any interruption in the process (eg power failure) would leave it corrupt.

The data loss risk in doing this is probably why a way to do this isn't built into the OS. The benefit to a small minority of users isn't worth the (primarily PR) liability they'd be taking on for when something goes wrong.

4

If you don't want to spend money on third party tools, the resize you want to do can be done with GParted and you can download the GParted LiveCD for free. GParted Live CD Website

Have in mind that resizing the partition to use 'previous' space will take a long time since the partition software usually have to copy all data from your partition (259 Gb)

  • 1
    Of course, GParted is a third-party tool, but herpahs the OP meant "commercial". – CarlF Oct 13 '11 at 12:21
  • Could you elaborate on the second paragraph? Why do they have to copy all the data from the partition when it's extending backwards? – Pacerier Oct 13 '11 at 20:22
  • @Pacerier When extending forwards you are allocating a bunch of empty space at the end of the drive. When extending backwards you create empty space at the beginning of the drive and then you have to move the failes backwards so that the used space is on the inner rings of the disk. – alord1689 Apr 19 '15 at 2:27
  • @alord1689, I mean why do we need to move the files backwards? If we don't mind fragmentation, Couldn't we just extend, and then leave the files at their original location? – Pacerier May 24 '15 at 21:47
  • The segments where the files reside need to be next to each other. A "partition" has to be contiguous segments. – alord1689 May 24 '15 at 22:21
2

Here's another possibility...

  1. Get another drive with enough space to store the contents of drive D:
  2. Delete the existing partition D:
  3. Create a new partition in the empty space, which will include the extra 30GB
  4. Copy your files back

Make sure that when performing the copy, both the source and the destination are NTFS, and that you take care to preserve permissions.

1

Raw? No third party? Learn C++ and you can write a simple defragger that consolidates the partition, which then allows you to shrink the partition. You can download Visual Studios Express as a Dev environment.

  • 1
    The c compiler is a 3rd party tool. My first suggestion was a hex editor but then I realized that it is also a 3rd party tool ;) – Robert Oct 13 '11 at 13:56
1

It cannot be done. Yes, third-party tools use the system functions, but this takes millions of carefully constructed such functions and must be done from an environment in which it is safe to pass the disk through inconsistent states. You could not do it manually.

0

Just move the partition backwards using a 3rd-party tool, then extend it forward. Simple!

  • Since when can partitions be moved and extended forward? o_O – Tamara Wijsman Jul 14 '12 at 15:17
  • 1
    You can use diskpart to expand a partition forward into free space. – Bigbio2002 Jul 16 '12 at 7:39
  • That still doesn't make you move the partition backwards, which is much harder. – Tamara Wijsman Jul 16 '12 at 12:19
  • Correct, I mentioned that a 3rd party tool is needed for that part in my answer. – Bigbio2002 Jul 16 '12 at 16:38
  • 1
    It's possible that the OP edited his question to clarify that after I had answered, I don't remember. The date on this post is nearly a year ago. – Bigbio2002 Jul 16 '12 at 19:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.