safely repartition?

I have openSuse 11.1 installed on a desktop computer that is partitioned as followed (I’m not at the machine, so this is from memory):

Partition 1: ext3 openSUSE 11.1
Partition 2: swap
Partition 3: ntfs (currently unused after a failed attempt to install Windows)
Partition 4: extended
etc…

The limitation is that you can only have 3 primary partitions plus an extended (or 4 primary). The last time that I repartitioned my hard drive, I had linux taking the entire hard drive (partitioned as described above) with partition 3 being an open partition of about 8gig for a secondary OS should I ever decide that I want to dual boot.

Well, I recently found a reason to have Windows in a dual boot. Wine or Virtualbox works great for most things, but I’ve found situations where I came close to bricking devices when trying to perform a flash update through a virtual machine. Therefore, I want Windows in a dual boot for those situations. My dilema is that I have a perfectly running openSUSE installation, and my free partition is not large enough to hold Windows Vista. The machine cannot take XP because I can’t find any XP drivers for it. It originally came preinstalled with Vista. Anyway, I can’t simply resize that partition because it is a primary partition and the partitions that I want to “borrow” from are in the extended partition. Therefore I need to completely repartition.

Does anyone have any advice how I can best preserve my installation or is it a completely from scratch effort? I know that I can backup my home partition, etc, but I have things configured nicely in the main installation too that I was hoping to preserve. Clonezilla won’t work because the image it takes depends on the partition to remain intact (same size & location) in order to restore the image. Are there any other options?

I don’t mind doing a completely new install from scratch, but it would be great if I could avoid the extra work.

Thanks

Use Gparted on a bootable CD to resize the extended partition and it’s interior logical partitions and then resize primary #3 into the spare space.

If you want more detailed advice, supply more detailed info se I can see what u need to do.

Fdisk -l would be good and also df -Th plus some descriptive words. :slight_smile:

Thanks!

I’ll try it when I get a chance to work on it, and I’ll let you know!

here is the output to the commands you suggested:

fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0000a2a6

Device Boot Start End Blocks Id System
/dev/sda1 1 1306 10490413+ 7 HPFS/NTFS
/dev/sda2 * 1307 1331 200812+ 83 Linux
/dev/sda3 1332 2733 11261565 83 Linux
/dev/sda4 2734 60801 466431210 5 Extended
/dev/sda5 2734 2864 1052194+ 82 Linux swap / Solaris
/dev/sda6 42028 60801 150802123+ 83 Linux
/dev/sda7 2865 42027 314576797 83 Linux

Partition table entries are not in disk order

df -Th

Filesystem Type Size Used Avail Use% Mounted on
/dev/sda3 ext3 11G 4.7G 5.4G 47% /
udev tmpfs 1.5G 820K 1.5G 1% /dev
/dev/sda6 ext3 142G 21G 115G 15% /home
/dev/sda2 ext3 190M 20M 162M 11% /boot
/dev/sda1 fuseblk 11G 76M 10G 1% /windows/C
/dev/sda7 xfs 300G 102G 198G 34% /data

Basically, it looks like the partition that I’m interested in is sda1 (not 3 as I had originally thought). I have approx 10gig assigned to each sda1 (Windows) and sda3 (Linux root). I may want to keep /data the same because that’s where my MythTv recordings go. However, /home is way too big for my needs, which is sda6. If I’m going to increase the Windows allocation, I might as well go ahead and increase Linux too. Therefore, what it looks like I’ll have to do is this:

  1. Shrink /home (sda6) down by at least 10 gig, maybe more
  2. Move swap (sda5) to the right so that the freed space is at the beginning of the extended partition
  3. Shrink extended partition (sda4) by the amount of freed space (???). I didn’t know this is possible. Can I actually shrink an entire extended partition using gparted?
  4. Add half of the freed space to Linux (sda3)
  5. Move sda3 to the right
  6. Move sda2 to the right
  7. Add the remaining freed space to Windows (sda1)

Does that sound like the proper procedure?

Thanks

What Swerdna said. You might want to use the Parted Magic bootable CD. That thing absolutely rocks. :slight_smile:

News

What you want to do is quite easy with that CD. If you have DHCP on your network, you can even activate a network connection inside the Parted Magic GUI and use Mozilla to post questions here, complete with screenshots, if need be. :slight_smile:

(I just wrote a review for Parted Magic for our company newsletter. I’m a little pumped about it.)

You could try that. Here’s a few comments

  • Back up your data first.
  • You’ve got a lot of data on NTFS. Defrag it before you move its boundaries.
  • If the NTFS partition sda1 was made in vista it is best to expand it using vista if possible. I don’t know if that’s feasible for you (e.g. put the drive attached in or to another PC running vista).

Thanks smpoole7 and swerdna!

I’ll back up my data and give it a go. I’m not too concerned with the NTFS partition, though. I think it currently has XP on it, which is unusable anyway because I cannot find any drivers for it. Therefore, what I may do is completely delete sda1 so that when I’m done, I’ll have approx 15gig of unallocated space that I will then let Vista create and format.

I’ll let you know how it works out.

Just a passing thought: why don’t you just install vista on sda1, formatting it during the install, and not bother about all the shuffling of space?

Vista complains that 10gig is not enough space for the install. shrugs go figure…

Oh well – what about xp, what driver is missing, does it matter?

There are no XP drivers at all for my particular machine (HP Pavilion a6337c), but there are Vista drivers. The drivers missing are chipset, sound, and ethernet to name a few. I can live without sound (maybe), and sometimes chipset is not big deal, but I can’t do much without internet.

I fired up partedmagic, and I did a shrink of my /home partition (sda6) by 10 gig. It appears as if sda6 is at the very back (at the far right) and sda7 is before it (left of it). The problem is that sda7 is an XFS partition. Right now after the shrink I have sda7 (300gig XFS), free space (10 gig), and sda6 (133.75 gig Ext3). I want to move sda7 to the right so that the free space is before it. Basically I’m trying to ultimately push the free space all the way to the front next to sda1. The problem is that I cannot move sda7. I’m getting an error at the step of moving and shrinking 300gig to 300 gig. All I’m trying to do is move it, not resize it. Is there a way to move an XFS partition without having to destroy it and recreate it?

Thanks,

For xfs tips have a look at the notes in this table:
GParted – Features
Those are for Gaprted. It’s probably the same for Parted Magic

Looks like you have to install xfsprogs and mount the xfs partition. Google might be the helper here.

I completed the task, not exactly the way I had originally planned, but it got the job done.

I used PartedMagic 4.2 (July 09). Here are my lessons learned:

  1. You cannot move an extended partition. You can only resize it. (At least that was my experience)

  2. Even though gparted/parted magic officially supports moving an XFS partition, I was unable to do it. For whatever reason, when I tried moving the partition, the tasks listed to complete is to shrink the partition (300gig to 300 gig, which really was not a shrink at all) and move the partition. Gparted does not support shrinking an XFS partition, so it failed even though all I was really trying to accomplish was move it.

Therefore, because of those two limitations, I had to accomplish my task slightly differently. Originally my partitions were set up as follows:

/sda1 10gig NTFS (Windows)
/sda2 200mb ext2 (/boot)
/sda3 10gig ext3 (/)
/sda4 Extended
/sda5 Linux swap
/sda7 300gig XFS (/data)
/sda6 ext3 remaining space (/home)

I wanted to shrink the /home partition by 10 gig and add 5gig to sda1 and sda3. I shrunk /home, but I was unable to move sda7 (the XFS) partition to the right. Therefore, I moved sda6 to the left so the free space is at the end of the extended partition. I deleted /sda1 and moved /sda2 and /sda3 to the left. At that point I had 10 gig before the extended partition and 10 gig at the end. When I discovered that I couldn’t move the extended partition to the left, I reallocated the first 10 gig to /sda3 (my linux partition) so it grew to 20 gig. I shrunk the /home partition by another 5 gig so that I had a total of 15 gig of unallocated space at the end of the extended partition. Therefore, the partition table is as follows:

/sda2 200mb ext2 (/boot)
/sda3 20gig ext3 (/)
/sda4 Extended
/sda5 Linux swap
/sda7 300gig XFS (/data)
/sda6 approx 100 gig ext3 (/home)
unallocated space (15 gig)

I will install Windows Vista in the 15 gig unallocated space.

Thanks for all of the advice. If I am incorrect on the 2 limitations listed above, please let me know how I went wrong. Thanks!

I’m getting a bit confiused. But I think that you just might get the free space to format as a primary partition when vista gets hold of it, in which case vista will install. Good luck.