Relocating Linux partition

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
Blizzie

Relocating Linux partition

Post by Blizzie »

Hi,

How can I relocate my Linux partition to a different part on the HDD. When I installed my Linux Mint, it was experimental, so I put it at the end of the HDD. I now want to move it between my OS and my data, as I have 40 GB unallocated there.

Is there a software that I can use to image the partition over, or is there an easier way?

Thanks!
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
remoulder
Level 17
Level 17
Posts: 7621
Joined: Fri May 09, 2008 1:14 pm

Re: Relocating Linux partition

Post by remoulder »

If you have another used partition between the empty space and your mint partition, you won't be able to move it. What you could do is shuffle your data and mint partitions down, effectively moving the 40GB to the end. Alternatively you could create a new partition in the empty space and copy everything in the mint partition down to it then delete the original mint partition. This would involve some editing of files to get it to work. Or you could backup the data then delete it, move the mint down, then recreate the data.
[Edit] your original post and add [SOLVED] once your question is resolved.

“The people are my God” stressing the factor determining man’s destiny lies within man not in anything outside man, and thereby defining man as the dominator and remoulder of the world.
NimaSepassi

Re: Relocating Linux partition

Post by NimaSepassi »

Isn't there a simple way of copying everything from one partition to another? Maybe an application that does it for you?

Thanks,
seeley

Re: Relocating Linux partition

Post by seeley »

Hi!
With GParted
http://gparted.sourceforge.net/
Perform actions with partitions such as:
1. create or delete
2. resize or move
3. check
4. label
5. copy and paste
I did 1. -4. very often - with live CD - without problem ("move" 40 GB took 6 hours), but never "copy and paste".
seeley

Edit:
If you only have one partition for Mint ("/") it makes sense to save datas, partition with GParted and make a fresh install.
DataMan

Re: Relocating Linux partition

Post by DataMan »

As Remoulder mentioned, if you can effectively copy the contents of the existing partition to a new or other partition, you will still be faced with editing files to make it happy. Things that come to mind are the /etc/fstab and, of course the infamous GRUB rebuilding. There's probably other files also.

I've never heard of an application or utility that will cleanly do all of the updates to the new environment automatically for you (might be a good summer coding project).

-DataMan
NimaSepassi

Re: Relocating Linux partition

Post by NimaSepassi »

DataMan wrote:I've never heard of an application or utility that will cleanly do all of the updates to the new environment automatically for you (might be a good summer coding project).

-DataMan
Yeah, thanks for the suggestion but that's no task for a newbie like myself. I guess I'll just stay on this partition for now. If I run out of room I'll just re-install Julia on the other. My data files are on a different partition entirely so it does make it a bit easier.
StanTheMan

Re: Relocating Linux partition

Post by StanTheMan »

I have done installs with Linux root on the last partition, with absolutely no problem.
But changing a root partition also involves having to edit the grub bootloader.
If you were to format the unallocated space and do a brand new install there , this would take care of the bootloader automatically. The old system files on the original Mint root partition could be deleted later at any time.
A new install will of course need the applications re-installed, but with Mint's Software Manager that is a breeze.
mick55

Re: Relocating Linux partition

Post by mick55 »

Blizzie wrote:Is there a software that I can use to image the partition over, or is there an easier way?
I agree that gparted is an excellent way to accomplish this.

You can use the copy/paste function in gparted.

The partition you paste to must be unformatted. If it is formatted the "paste" will fail
because gparted will see the partition as "in use".

As others have stated, you will have to hand edit some configuration files.

Fstab and grub.cfg will both need to be edited before you can boot into your newly
relocated Mint partition.You will need to run "blkid" after the copy/paste because the UUID
of the Mint partition has changed.

If you are not comfortable editing configuration files or performing a system rescue if it goes wrong,

DO NOT ATTEMPT THIS. :mrgreen:



mick
User avatar
tdockery97
Level 14
Level 14
Posts: 5058
Joined: Sun Jan 10, 2010 8:54 am
Location: Mt. Angel, Oregon

Re: Relocating Linux partition

Post by tdockery97 »

If the unallocated area is the same size or larger than your present Mint partition, you can easily use Clonezilla. It will only take about 10 minutes to run Clonezilla and copy/save your system you want to move. Next make the unallocated area into an Ext4 partition (if that is what your system is that you want to move) using GParted. Then run Clonezilla again and select restorepart instead of savepart. Make your new partition the target partition you are restoring to and within 10 minutes you'll have your Mint system in the new partition. There are some steps in between what I've said, but just read the instructions as you use Clonezilla and you'll be fine. I've done this 3 or 4 times on my HDD so far and it's worked beautifully. And at the end of the restore Clonezilla also reinstalls your Grub2.
Mint Cinnamon 20.1
Locked

Return to “Beginner Questions”