LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   resize partitions and keep the data (https://www.linuxquestions.org/questions/linux-software-2/resize-partitions-and-keep-the-data-829409/)

wastingtime 08-30-2010 07:19 PM

resize partitions and keep the data
 
I have a dual boot (pclinuxos, winxp) machine with multiple partitions.

The first two physical partitions are NTFS-3G and used by WinXP.

I'd like to resize them such that the first partition (C: ) will have more space and the second partition (D: ) will have less space. This must be done without damaging the WinXP installation.

The size, location and order of the Linux partitions should remain them same.

Is there a Linux tool I can use to perform this surgery?

Here's the layout of the hard drive.
The partitions are listed in their physical order on the disk.

Quote:

/dev/sda1 NTFS-3G (C: ) 6.9GB
/dev/sda5 NTFS-3G (D: ) 19.0GB
/dev/sda6 Linux swap 1.9GB
/dev/sda7 Linux (/ ) 27.0GB

pljvaldez 08-30-2010 07:29 PM

The second partition is the biggest problem because most operating systems tend to put information at the beginning of the partition. However, you should be able to do this with a GParted Live CD, but you'll have to be careful. Using XP, defragment the 2nd partition so that everything is at the beginning of the partition. Then boot into GParted Live and shrink the 2nd partition. When that is done, you'll want to move the 2nd partition to the end of the free space. Then you'll extend the first partition to fill up the rest of the free space. Then reboot into XP. It might do a chkdisk since you changed the drive size, but it should be fine.

I have done this in the past and it worked. But there's always a risk of data loss. Make sure you've backed everything up to another (preferably external) drive.

kbp 08-30-2010 07:30 PM

You should be able use the gparted live cd http://gparted.sourceforge.net/livecd.php to do this. Please ensure you back up your data first, my personal preference is clonezilla but there are more choices than you can poke a stick at. There are also plenty of tutorials on gparted usage like this example.

<edit>Damn! .. too slow!</edit>

cheers

rokytnji 08-30-2010 07:30 PM

Gparted in PartedMagic Iso (google it) can resize windows without damaging windows parrtition. Saying that. I would of course back up any critical data before resizing any partitions.

After resizing. Be sure to boot back into windows first because it does a check disk first before booting because Of resizing. I have shrunk XP on my EEEPC 701SD so I could DD it to a 8gig external SD Flash drive.

kbp 08-30-2010 07:32 PM

:) ... looks like we have a consensus

thorkelljarl 08-30-2010 07:38 PM

I don't think so...

A Windows partition has data at the front boundary of the partition. I don't think you can shrink "D" at its beginning to create room for more of "C" without loosing information vital to the files on the partition.

Can you not copy the contents of "D" to another medium, shrink "D" from the front, then copy the contents back?

I seem to be in the minority here, and await more replies.

Wrong...

I seem to be in the minority here because I seem to be wrong, alas. Shrink "D" and then move it to the "right" leaving space for "C" to the "left" as posted by pljvaldez is the correct answer. Backup is very good to have when doing this.

syg00 08-30-2010 08:48 PM

Be aware that those (other than the C: drive) are logical partitions. The left boundary of the extended will need to be moved to accommodate as well.

linux_hy 08-31-2010 12:11 AM

an unskillfull resolve
you could backup the disk with command dd then repart the disk and last restore with dd again


All times are GMT -5. The time now is 04:15 PM.