Author Topic: Repartition Hard Drive with Dual OS and Not Losing Data  (Read 11545 times)

0 Members and 1 Guest are viewing this topic.

Offline bostonmanTopic starter

  • Super Contributor
  • ***
  • Posts: 1788
  • Country: us
Re: Repartition Hard Drive with Dual OS and Not Losing Data
« Reply #25 on: January 20, 2023, 05:11:07 am »
I found a WD 500GB for $34 each on Amazon.

Interestingly enough, the other day these were priced much higher. When I viewed them Tuesday (?) they were listed as $34 which I thought was odd. I thought maybe it was selecting 250GB, so I clicked on that, clicked back, etc... and suddenly the price was higher (maybe 60 something dollars).

I closed the browser, searched again, and sure enough it was again $34 for 500GB, so I purchased two of them.

Anyway, hopefully I get the 500GB. They should arrive tomorrow, so I'll backup the 120GB onto the 500GB, and then re-partition; maybe 250GB each (XP and Ubuntu).

Hopefully the partition is a smooth process.

BTW, I have a duplicator, so duplicating hard drives is simple (providing the destination is larger than the source).
 

Offline bostonmanTopic starter

  • Super Contributor
  • ***
  • Posts: 1788
  • Country: us
Re: Repartition Hard Drive with Dual OS and Not Losing Data
« Reply #26 on: February 06, 2023, 04:09:58 am »
I began swapping the drive in my Win7 laptop by using a stand alone hard drive copier.

The new hard drive is 500GB, and, after copying the old 120GB (?) hard drive to the 500GB, it had all the new additional space as un-alloted. I went into disk manager (in Win7) and expanded the C: drive to approximately 250GB by adding 100GB to the used 150GB (I'm rounding off for purposes of discussion).

Now I have 250GB of unassigned space.

I went to install Ubuntu and selected 'something else' and attempted to figure out which section was the unassigned. Apparently I did it wrong because I lost Win7 and had to recopy the old drive.

From reading, I need to select 'copy along side of Windows boot manager'.

I'm uncertain what this means. To me it implies I'm installing Ubuntu on the assigned 250GB partition that Win7 is on, and they'll work together to load whichever one I select; but I'll have unused 250GB on the unassigned partition.

Obviously my goal is to put Win7 on partition A and Ubuntu on partition B.

Is selecting 'along side Windows' the correct method and then later it will format the new partition?

 

Online IanB

  • Super Contributor
  • ***
  • Posts: 11859
  • Country: us
Re: Repartition Hard Drive with Dual OS and Not Losing Data
« Reply #27 on: February 06, 2023, 04:30:18 am »
From what I understand, booting is a two stage process. There is part of the disk with something called a boot manager, which is outside any of the data partitions. If you only have one OS installed, the boot manager jumps straight to the installed OS, which then then does its own stuff and starts up.

However, if you have two OS's installed, each in their own partition, then the boot manager will prompt on startup and ask which OS you want to boot into. This is what "alongside" means. If you try to install a second OS alongside an existing OS, the installer for the second OS will modify the boot manager so it knows about both OS's and can display the prompt on startup. The installer for the second OS should show you a map of the disk and offer you the chance to create a new partition in some empty space, or ask if you want to overwrite something already there, or even completely reformat the disk from scratch.

Since I am completely inexperienced in doing this, I think the best approach is to read the manual/documentation very carefully and follow whatever instructions are given. If you experiment without doing this, things may not go the way you would like.
« Last Edit: February 06, 2023, 04:32:06 am by IanB »
 

Offline bostonmanTopic starter

  • Super Contributor
  • ***
  • Posts: 1788
  • Country: us
Re: Repartition Hard Drive with Dual OS and Not Losing Data
« Reply #28 on: February 06, 2023, 04:38:05 am »
I've had success doing this in the past, but I forget what I did and proceeded somewhat blindly (i.e. I got lucky).

What you said makes sense. I didn't think it did some magic install like Win and Ubuntu all together, but the descriptions aren't really clear on what each option means (I'm sure it's quite easy for the more experienced).
 

Offline BradC

  • Super Contributor
  • ***
  • Posts: 2106
  • Country: au
Re: Repartition Hard Drive with Dual OS and Not Losing Data
« Reply #29 on: February 06, 2023, 05:46:24 am »
Ordinarily on legacy hardware I'd get windows working by itself first. On legacy hardware, windows installs a boot sector which then chains to its boot manager and it just loves to trample over anything else on the drive. Windows boot manager *can* be made to boot additional operating systems, but I never got it to work reliably or easily.

Once Windows is booting reliably, then I'd add a partition for Ubuntu and install Grub as the boot manager. That'll overwrite the windows boot sector and install Grub as the boot loader. When you've completed the Ubuntu install the grub configuration scripts will scan the disk, find the windows partition and add that to the boot menu automatically. Then when you reboot, grub will ask you whether you want Linux or Windows and it'll all behave.

The best part of this for you is if you blow it up, you can re-clone and go around again.
 

Online themadhippy

  • Super Contributor
  • ***
  • Posts: 2569
  • Country: gb
Re: Repartition Hard Drive with Dual OS and Not Losing Data
« Reply #30 on: February 06, 2023, 12:58:31 pm »
Quote
Is selecting 'along side Windows' the correct method and then later it will format the new partition?
no.it will try and install on the same partition as windows. Id run a live disc, fire up qparted and adjust the space windows has to the full disc,the alongside option should work fine then.
 

Offline bostonmanTopic starter

  • Super Contributor
  • ***
  • Posts: 1788
  • Country: us
Re: Repartition Hard Drive with Dual OS and Not Losing Data
« Reply #31 on: March 01, 2023, 01:41:57 am »
Quote
Grab a copy of systemrescuecd and fire up gparted. It can resize and move as required, although moving a partition is a *slow* process.

I'm digging up an older thread I started.

Just a reminder, I have an old laptop with XP and Ubuntu (32-bit) and ran out of space for Ubuntu. They share a 120GB drive with (I think) 20GB or so dedicated to Ubuntu. Anyway, I copied the 120GB to a 500GB using a duplicator.

The problem is now I have (rounding off) 400GB of unallocated space. Using Gparted, it shows the XP partition, Ubuntu, and two small partitions (I'm assuming they are Dell recovery). It won't let me expand any partitions into the "unallocated" space.

I tried making the 400GB a new partition, but Gparted is stating I can't make more than four primary partitions. I tried deleting the two small partitions which allowed me to make the 400GB a new partition (but not sure what I lost in the process by deleting the two small partitions), however, it still wouldn't allow me to expand the two main partitions (XP and Ubuntu).

Does anyone know what I can try?
 

Offline BradC

  • Super Contributor
  • ***
  • Posts: 2106
  • Country: au
Re: Repartition Hard Drive with Dual OS and Not Losing Data
« Reply #32 on: March 01, 2023, 05:28:47 am »
Post the results of fdisk -l /dev/whatever your disk is.

There are some peculiarities with dos partition tables, one is up you get 4 primary partitions. As you’ve discovered you can remove one and replace it with a secondary partition table, but it gets a bit complex there. We need to see what you have to be able to help further.
 

Offline bostonmanTopic starter

  • Super Contributor
  • ***
  • Posts: 1788
  • Country: us
Re: Repartition Hard Drive with Dual OS and Not Losing Data
« Reply #33 on: March 02, 2023, 12:57:08 am »
Quote
Post the results of fdisk -l /dev/whatever your disk is.

Do you want each partition (I think they are labeled SDx)?

Unfortunately I should re-copy the original drive again since I messed with the partitions. I know you want the screen shot of the disks, but just thinking out loud. The problem seems to be that once I created the new partition (after deleting the small Dell factory installation partitions (?), gparted wouldn't let me expand either the XP or the Ubuntu partition into the new one.

The partitions could be shrunk, but not expanded.
 

Offline BradC

  • Super Contributor
  • ***
  • Posts: 2106
  • Country: au
Re: Repartition Hard Drive with Dual OS and Not Losing Data
« Reply #34 on: March 02, 2023, 05:50:36 am »
This (noting mine is GPT not MBR, but same same) :

Code: [Select]
root@bklaptop:/home/brad# fdisk -l /dev/nvme0n1
Disk /dev/nvme0n1: 1.82 TiB, 2000398934016 bytes, 3907029168 sectors
Disk model: SHGP31-2000GM                           
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 737ADFEF-F496-8A47-ACD1-66F8194FD58D

Device              Start        End    Sectors   Size Type
/dev/nvme0n1p1       2048     411647     409600   200M EFI System
/dev/nvme0n1p2     411648  210126847  209715200   100G Apple APFS
/dev/nvme0n1p3  210126848  419842047  209715200   100G Microsoft basic data
/dev/nvme0n1p4  419842048  461785087   41943040    20G Linux filesystem
/dev/nvme0n1p5  461785088  503728127   41943040    20G Linux swap
/dev/nvme0n1p6  503728128 3485020159 2981292032   1.4T Linux filesystem
/dev/nvme0n1p7 3485020160 3907029134  422008975 201.2G Linux reserved
 

Offline bostonmanTopic starter

  • Super Contributor
  • ***
  • Posts: 1788
  • Country: us
Re: Repartition Hard Drive with Dual OS and Not Losing Data
« Reply #35 on: March 03, 2023, 10:30:33 pm »
Is this what you want?
 

Offline BradC

  • Super Contributor
  • ***
  • Posts: 2106
  • Country: au
Re: Repartition Hard Drive with Dual OS and Not Losing Data
« Reply #36 on: March 04, 2023, 01:49:31 am »
Not really. You're trying to list the partition table on a partition.
Don't use sda3, use sda.
 

Offline bostonmanTopic starter

  • Super Contributor
  • ***
  • Posts: 1788
  • Country: us
Re: Repartition Hard Drive with Dual OS and Not Losing Data
« Reply #37 on: March 04, 2023, 10:25:25 pm »
Is this better?
 

Offline BradC

  • Super Contributor
  • ***
  • Posts: 2106
  • Country: au
Re: Repartition Hard Drive with Dual OS and Not Losing Data
« Reply #38 on: March 05, 2023, 02:46:02 am »
Yep.

sda4 is the extended partition table and sda5 is the content of that partition.
If you can find out what sda5 is it'd be useful.
My strategy would be to delete sda5 & 4 (you need to delete 5 before you can dump the extended partition table).
You can then extend sda3 out to use all the available space on the disk (or whatever size you like). If you need more partitions you can then add a new extended table at 4 and up to 4 partitions in that.

You won't be able to do anything until you lose the extended partition table (sda4) as that'll be blocking gparted from moving/resizing anything.
If the contents of sda5 are valuable, I'd dd them into a file, do the move and shuffle while creating the extended table and additional partition at the end then dd the contents of the file back. The only thing you need to do is make sure the sda5 partition is exactly the same size when you re-create it.

To see if you can figure out what's on sda5 try :
blkid /dev/sda5

The other thing you can try is to mount it :
mount /dev/sda5 /mnt
if it mounts : ls -la /mnt
 

Online magic

  • Super Contributor
  • ***
  • Posts: 6761
  • Country: pl
Re: Repartition Hard Drive with Dual OS and Not Losing Data
« Reply #39 on: March 05, 2023, 07:40:27 am »
You should be able to expand sda4 into the new unallocated space and create a new logical partition sda6 (or even multiple partitions) inside it.
This may or may not be all that you need.

I believe gparted should also be able to move sda4 to the end of the disk to create space for sda3 expansion.
Such move ought to be safe because source and destination locations don't overlap at all, so all original data will still be in place until everything is copied over.
Subsequent expansion of sda3 is generally a safe operation.

The process described by BradC is basically doing sda4/sda5 move manually, but I think gparted may be able to do it fully automatically.

If unsure, make backups of at least sda3 and sda5. They aren't big partitions so not a big problem to backup.


edit
I think this is likely to work if gparted refuses to simply move sda4 with all contents to the right:
- expand sda4 to the right to fill the unallocated space
- move sda5 inside sda4 to the right as far as it will go
- shrink sda4 from the left as far as the new position of sda5 allows
- expand sda3 to the right until it hits sda4
« Last Edit: March 05, 2023, 08:01:54 am by magic »
 

Offline bostonmanTopic starter

  • Super Contributor
  • ***
  • Posts: 1788
  • Country: us
Re: Repartition Hard Drive with Dual OS and Not Losing Data
« Reply #40 on: March 11, 2023, 01:03:45 am »
I’m uncertain if this advice will work.

Long story short, I have a much simpler XP hard drive in an oscilloscope that I’m working on simultaneously.

It is a 32GB (technically about 29.7) and two partitions: the main and a factory reinstallation partition. Currently it’s only using about 9GB between both and the rest is unallocated.

I made a new partition with the remaining (approx) 20GB, and couldn’t expand either one of the other two into the 20GB; it seems to be treating it as a whole separate drive.
 

Offline bostonmanTopic starter

  • Super Contributor
  • ***
  • Posts: 1788
  • Country: us
Re: Repartition Hard Drive with Dual OS and Not Losing Data
« Reply #41 on: May 16, 2023, 02:39:21 am »
I haven't addressed this issue for sometime as I got distracted with other stuff.

I still have my laptop with wasted partition space. Obviously I read the section about using dd, but I'm uncertain about the steps.

Keep in mind, this has a XP partition, Ubuntu partition, and then two (?) Dell partitions. Gparted doesn't allow me to add a fifth (?) partition, however, even when I delete an assumed useless Dell partition, it still treats the unallocated partition as a completely separate drive.

The new hard drive is 500GB, and the current one is 120GB (I think it's approximately: 80GB for XP and 40GB for Ubuntu, along with smaller ones for Dell). I'd like to make it 250GB for XP and 250GB for Unbuntu.
 

Online magic

  • Super Contributor
  • ***
  • Posts: 6761
  • Country: pl
Re: Repartition Hard Drive with Dual OS and Not Losing Data
« Reply #42 on: May 16, 2023, 08:00:57 am »
I think this is likely to work if gparted refuses to simply move sda4 with all contents to the right:
- expand sda4 to the right to fill the unallocated space
- move sda5 inside sda4 to the right as far as it will go
- shrink sda4 from the left as far as the new position of sda5 allows
- expand sda3 to the right until it hits sda4

Note that except for creation of partition tables, gparted doesn't make modifications to disk until you click "apply changes" or something like that, so it's safe to experiment and see what it can or cannot do.
« Last Edit: May 16, 2023, 08:07:08 am by magic »
 

Offline bostonmanTopic starter

  • Super Contributor
  • ***
  • Posts: 1788
  • Country: us
Re: Repartition Hard Drive with Dual OS and Not Losing Data
« Reply #43 on: May 17, 2023, 02:59:22 am »
I know clicking 'apply' is needed to execute.

All the used partitions are expanded. The unallocated remains untouchable.
 

Offline BradC

  • Super Contributor
  • ***
  • Posts: 2106
  • Country: au
Re: Repartition Hard Drive with Dual OS and Not Losing Data
« Reply #44 on: May 17, 2023, 06:31:55 am »
You need to expand sda4 (the extended partition) before  you can resize sda5.

Any chance you can do an :

sfdisk -d /dev/sda

and paste it (not screenshot) into a post?
I can use that to replicate your partition table locally and have a play with gparted to see what the limitations might be.
Mine looks like this :

Code: [Select]
root@bkd:/home/brad# sfdisk -d /dev/nvme0n1
label: gpt
label-id: 88CD8B24-FF53-9A42-8996-8DC764F97AA8
device: /dev/nvme0n1
unit: sectors
first-lba: 2048
last-lba: 3907029134
sector-size: 512

/dev/nvme0n1p1 : start=        2048, size=   125829120, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=C0BBEE74-5078-6340-97B7-6A702D58080B
/dev/nvme0n1p2 : start=   125831168, size=  2147483648, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=0C53AD48-1CFC-B14E-A8C7-95FA75B2250B
/dev/nvme0n1p3 : start=  2273314816, size=   206317933, type=EBD0A0A2-B9E5-4433-87C0-68B6B72699C7, uuid=055C1BC7-7494-11ED-9D1B-D85ED386CCC8, name="Basic data partition"

 

Offline bostonmanTopic starter

  • Super Contributor
  • ***
  • Posts: 1788
  • Country: us
Re: Repartition Hard Drive with Dual OS and Not Losing Data
« Reply #45 on: May 17, 2023, 04:50:57 pm »
See attached
 

Online magic

  • Super Contributor
  • ***
  • Posts: 6761
  • Country: pl
Re: Repartition Hard Drive with Dual OS and Not Losing Data
« Reply #46 on: May 17, 2023, 04:55:40 pm »
You need to expand sda4 (the extended partition) before  you can resize sda5.
This is exactly what's blocking you. Can't move sda5 outside of sda4.
 

Offline bostonmanTopic starter

  • Super Contributor
  • ***
  • Posts: 1788
  • Country: us
Re: Repartition Hard Drive with Dual OS and Not Losing Data
« Reply #47 on: May 17, 2023, 05:11:33 pm »
Think I tried deleting one of the smaller partitions (it's an old Dell and assume this is some factory reinstallation even though I have all the CDs), and don't believe I could expand into the unallocated partition.
 

Online RAPo

  • Frequent Contributor
  • **
  • Posts: 618
  • Country: nl
Re: Repartition Hard Drive with Dual OS and Not Losing Data
« Reply #48 on: May 17, 2023, 06:22:06 pm »
yep thats the way to go.
 

Offline bostonmanTopic starter

  • Super Contributor
  • ***
  • Posts: 1788
  • Country: us
Re: Repartition Hard Drive with Dual OS and Not Losing Data
« Reply #49 on: May 17, 2023, 06:25:49 pm »
Which is the way to go?

Deleting a partition (if I remember correctly) didn't help.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf