I've resized partitions in GParted before. Now I'd like to move a large but mostly empty partition to a smaller drive. Instead of resizing it in place, I'd prefer to make a copy on a 3rd drive (drive image using dd), resize the copy, and then dd the copy to the new drive. But I don't think Gparted operates on drive images? How would I do this? Can I use the tools GParted uses directly?
Ooh! Or can I use a loopback thing to make the image file look like a physical drive that gparted can operate on?
Best Answer
You can't do this with GParted, but you can use the
ntfsresize
command directly on a disk image.First, clone the disk image. You can find the disk device name using
blkid
or gParted, and then run:For example:
Then, verify if you can resize it to the size you need by running:
For instance:
In this example, I can resize all the way down to 4MB because I just made a blank disk image for illustration purposes!
Now you can do the test run if you'd like, although it's not strictly necessary since you're operating on an image. You can specify the size in kilobytes, megabytes, or gigabytes by appending a
k
,M
, orG
, respectively:For instance:
No output is good output! Now do it for real:
Last example:
That's it! Now you can copy that disk image to the new device.