OP:
You haven't provided us with details as to which Mac you have, what year it was made, and what version of the OS you're using.
All of this info is important.
Also -- the drive you wish to change -- what FORMAT is it in?
Is it HFS+?
Or is it something else?
There used to be two very useful utility apps for OS X:
- iDefrag
- iPartition
Both were published by a company called Coriolis Systems that has now discontinued them, because changes in the Mac OS and the move from platter-based drives to SSDs has diminished the need for the above apps.
However, some folks may still have a need for them.
Coriolis has graciously made available all previous versions of their software.
You can freely download them from here:
What I would do in your situation.
This assumes the drive to be "UN-partitioned" is HFS+.
First, I would get ANOTHER drive, also HFS+.
Then, I would copy all files from "partition 5" to that drive, to preserve them.
Next, I would find a version of "iPartition" from the Coriolis archive that runs on the Mac I have.
Then, I would use it to delete "partition 5".
Then, I would see if I could "expand" the size of "partition 4" so that it "fills the space" that was previously occupied by "partition 5".
If that worked, I would use iDefrag to "compact" the data existing on partition 4.
Finally, I would copy over the preserved data from the SECOND drive back to partition 4.
Good luck.