Moving the root partition to a new drive

Write tutorials for Linux Mint here
More tutorials on https://github.com/orgs/linuxmint/discu ... /tutorials and (archive) on https://community.linuxmint.com/tutorial
Forum rules
Don't add support questions to tutorials; start your own topic in the appropriate sub-forum instead. Before you post read forum rules
User avatar
austin.texas
Level 20
Level 20
Posts: 12003
Joined: Tue Nov 17, 2009 3:57 pm
Location: at /home

Moving the root partition to a new drive

Post by austin.texas »

[Tutorial] Moving the root partition to a new drive:
TUTORIAL En Español

NOTE: this tutorial covers moving a Legacy Mint installation, not UEFI.

I just got my 120GB SSD, and wanted to move my Mint 17.3 Cinnamon root partition from sdb3 on the old hard drive to the new SSD.
Since similar questions are asked occasionally, I documented the move.
EDIT: I later moved my Mint 18 root partition in the same manner. Both work great.

Moving LM17.3Cinn on sdb3 to sdc2 on a new drive (SSD):
Boot the live Mint DVD or USB or boot into a different OS (other than the one you are moving).
Open GParted.
Make a GPT partition table on the new drive: Device menu > New Partition Table > GPT > APPLY
NOTE: You don't have to make a GPT partition table. You can make a msdos partition table - but I don't understand why anyone would want to do that...
Right-click on the unallocated space > New Partition > 1MB > unformatted > APPLY
Right-click on the new 1MB partition > Manage Flags > bios_grub > APPLY
The details for doing those steps are in this tutorial.
If you create a swap partition, it should be on the big hard drive, not the SSD. I don't have any swap partitions any more, because I have 8GB of ram, and I install the swapspace program.

After the partition table and the first partition (bios_grub) are created, per the tutorial, you are ready to copy your Mint root partition.
In GParted, right-click on the original Mint root partition > Copy
Right-click on the unallocated space on the new SSD > Paste
My 30GB root partition took 3 minutes, 12 seconds to copy to the SSD.
Open a terminal and run the command sudo blkid to determine the UUID numbers.
You will see that the original Mint partition and the new copy both have the same UUID number. This is a bad situation which MUST be corrected before you reboot.
Right-click on the new partition > New UUID > APPLY
I like to have a Label on my partitions, so I right-click on the new partition > Label File System > LM17.3Cinn (or any Label you like) > APPLY

Close GParted and go back to the terminal.
My new root partition shows as /dev/sdc2. I will use that here as an example. You might have to change that for your configuration.
Mount the new root partition at /mnt:

Code: Select all

sudo mount /dev/sdc2 /mnt
Again run the command sudo blkid to determine the new UUID number for the new partition.
Edit /etc/fstab, with gedit or xed, to reflect the new UUID number of the new / partition.:

Code: Select all

gksudo gedit /mnt/etc/fstab
Example of root partition fstab entry:

Code: Select all

# new / cloned to /dev/sdc2
UUID=a09ad702-6248-41ac-a5c6-af105bb55de9   /        ext4    errors=remount-ro   0       1
Also, edit or delete any other mount commands in that fstab that you want to change - like swap or /home or your /data partition (but those probably are not going to change).
DO NOT use the same /home partition for 2 different OS's !

Now you are ready to fix the initramfs and install Grub.
Close gedit and go back to the terminal.
Enter all these commands:

Code: Select all

for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done

Code: Select all

sudo chroot /mnt
The prompt will change to a root prompt.

Code: Select all

update-initramfs -u
Install Grub to the approprate drive - sda? sdb? In my case, I want /dev/sdc.

Code: Select all

grub-install --recheck /dev/sdc

Code: Select all

update-grub
CTRL-D to exit chroot
CTRL-D to exit the terminal

All done!

When you reboot, you might want to set the new drive (in my case, the SSD), to be the first drive in the boot order, if that is where you installed Grub.

It all worked perfectly, I am editing this tutorial from the new Mint installation - on the new SSD !

Forum rules:
Please don't add support questions to tutorials, start your own thread in the appropriate sub-forum instead.
Last edited by austin.texas on Sat Jan 14, 2017 3:40 pm, edited 4 times in total.
Mint 18.2 Cinnamon, Quad core AMD A8-3870 with Radeon HD Graphics 6550D, 8GB DDR3, Ralink RT2561/RT61 802.11g PCI
Linux Linx 2018
User avatar
BG405
Level 9
Level 9
Posts: 2500
Joined: Fri Mar 11, 2016 3:09 pm
Location: England

Re: Moving the root partition to a new drive

Post by BG405 »

This is a great tutorial and definitely something I'll need in future. Better than messing with cloning tools and subsequent drive size difference problems and you've also helped with potential UUID issues.

Thanks for posting this! I've bookmarked this page 8)
Dell Inspiron 1525 - LM17.3 CE 64-------------------Lenovo T440 - Manjaro KDE with Mint VMs
Toshiba NB250 - Manjaro KDE------------------------Acer Aspire One D255E - LM21.3 Xfce
Acer Aspire E11 ES1-111M - LM18.2 KDE 64 ----Two ROMS don't make a WRITE
User avatar
all41
Level 19
Level 19
Posts: 9498
Joined: Tue Dec 31, 2013 9:12 am
Location: Computer, Car, Cage

Re: Moving the root partition to a new drive

Post by all41 »

This is a great tutorial and definitely something I'll need in future.
Yes--excellent. Still groovin in Austin. Good work. Thanks for sharing.
Everything in life was difficult before it became easy.
User avatar
MurphCID
Level 15
Level 15
Posts: 5896
Joined: Fri Sep 25, 2015 10:29 pm
Location: Near San Antonio, Texas

Re: Moving the root partition to a new drive

Post by MurphCID »

Thanks for that great post.
JediFonger

Re: Moving the root partition to a new drive

Post by JediFonger »

this one is amazing... thank you OP for creating this tutorial!

i just wanted to suggest that the the steps here work if you have new destination drive hooked up to the HW that you wish it to live on.

i was performing a lot of these not on a HW that i wish to have so for the step where it goes for i in /dev /dev/pts, etc. make sure you run that step on the HW you wish for the final destination of where the destination drive will live as that step resets your root partition maps to the specific HW of the machine you're working on.

Question: what's the point of resetting UUID if you no longer wish to use the OLD HDD and will wipe it and get rid of it?
User avatar
austin.texas
Level 20
Level 20
Posts: 12003
Joined: Tue Nov 17, 2009 3:57 pm
Location: at /home

Re: Moving the root partition to a new drive

Post by austin.texas »

JediFonger wrote:Question: what's the point of resetting UUID if you no longer wish to use the OLD HDD and will wipe it and get rid of it?
You can delete the original root partition instead of changing the UUID on the new one - but you have to do one or the other. I leave the original - at least until I see if the new one is working OK.
Mint 18.2 Cinnamon, Quad core AMD A8-3870 with Radeon HD Graphics 6550D, 8GB DDR3, Ralink RT2561/RT61 802.11g PCI
Linux Linx 2018
pegasis
Level 4
Level 4
Posts: 470
Joined: Fri Dec 26, 2014 12:56 pm

Re: Moving the root partition to a new drive

Post by pegasis »

thru some very weird way this drive became GPT according to gparted

[sudo] password for tdv:
/dev/sda1: UUID="fa752849-db4d-4c8b-9e3d-33dcd654d93a" TYPE="ext4" PARTUUID="7548b09a-01"
/dev/sda2: UUID="c67b73ff-2e61-4a67-8f19-b1067b4de78e" TYPE="swap" PARTUUID="7548b09a-02"
/dev/sda3: LABEL="data" UUID="1f100a74-dbfb-439d-8415-3e08930eea1e" TYPE="ext4" PARTUUID="7548b09a-03"
/dev/sdb1: UUID="fa752849-db4d-4c8b-9e3d-33dcd654d93a" TYPE="ext4" PARTLABEL="Linux filesystem" PARTUUID="e5dd570d-eb48-414f-a93d-37a781e7f01d"
/dev/sdb3: LABEL="data" UUID="1f100a74-dbfb-439d-8415-3e08930eea1e" TYPE="ext4" PARTLABEL="Linux filesystem" PARTUUID="368e1413-870a-48cd-8112-b8352ff73a63"
/dev/sdb2: UUID="555e3fd3-65ff-4462-90ed-958fb96d96b2" TYPE="swap" PARTUUID="cb874659-3462-481f-baac-a1263ef46c3a"

why do i need to update Fstab if it is just basically a bigger hd (clone) of the 2TB? not sure why?

I do still need to do the commands from/after the fstab command on? right

I am not clear what the commands will do, so I am a bit hesitant

linux is one thing in a command book, and another implementing in real terminal :O
pegasis
Level 4
Level 4
Posts: 470
Joined: Fri Dec 26, 2014 12:56 pm

Re: Moving the root partition to a new drive

Post by pegasis »

here is what blkid shows:

I am lost on what to do next?

(original 2TB)

/dev/sda1: UUID="fa752849-db4d-4c8b-9e3d-33dcd654d93a" TYPE="ext4" PARTUUID="7548b09a-01"

/dev/sda2: UUID="c67b73ff-2e61-4a67-8f19-b1067b4de78e" TYPE="swap" PARTUUID="7548b09a-02"

/dev/sda3: LABEL="data" UUID="1f100a74-dbfb-439d-8415-3e08930eea1e" TYPE="ext4" PARTUUID="7548b09a-03"

(new 3TB with cloned data)

/dev/sdb1: UUID="fa752849-db4d-4c8b-9e3d-33dcd654d93a" TYPE="ext4" PARTLABEL="Linux filesystem" PARTUUID="e5dd570d-eb48-414f-a93d-37a781e7f01d"

/dev/sdb2: UUID="555e3fd3-65ff-4462-90ed-958fb96d96b2" TYPE="swap" PARTUUID="cb874659-3462-481f-baac-a1263ef46c3a"

/dev/sdb3: LABEL="data" UUID="1f100a74-dbfb-439d-8415-3e08930eea1e" TYPE="ext4" PARTLABEL="Linux filesystem" PARTUUID="368e1413-870a-48cd-8112-b8352ff73a63"

the sdX2 partitions are different, but the other (2) partitions have same UUID
pegasis
Level 4
Level 4
Posts: 470
Joined: Fri Dec 26, 2014 12:56 pm

Re: Moving the root partition to a new drive

Post by pegasis »

i found (2) issues:

I get these error trying to follow the commands:

for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
mount: mount point /mnt/dev does not exist
mount: mount point /mnt/dev/pts does not exist
mount: mount point /mnt/proc does not exist
mount: mount point /mnt/sys does not exist
mount: mount point /mnt/run does not exist
tdv@BladeRunner ~ $ sudo chroot /mnt
chroot: failed to run command ‘/bin/bash’: No such file or directory

3TB drive root was mounted to /mnt at the time.


AND, when I boot up and have the cloned HD drive on and in an external HD dock, the boo stalls and gives this error;

46.011457]nouveau 0000:01:00.0: unknown chipset (137000a1)

this only happens when the second HD is in the external HD dock and it is turned on.
what does this ,mean?


If i have 1) drive with MBR, and another with GPT and I want to read both from my drive bays, (not from external HD dock),

do I set boot up to legacy for the main drive (which is mbr), and to uefi for the Gpt drive which would be the slave drive?
User avatar
austin.texas
Level 20
Level 20
Posts: 12003
Joined: Tue Nov 17, 2009 3:57 pm
Location: at /home

Re: Moving the root partition to a new drive

Post by austin.texas »

You have copied the root partition to the new drive. That is good.
Now you need to proceed with the next step listed in the tutorial:
(in Gparted)
Right-click on the new partition > New UUID > APPLY
Mint 18.2 Cinnamon, Quad core AMD A8-3870 with Radeon HD Graphics 6550D, 8GB DDR3, Ralink RT2561/RT61 802.11g PCI
Linux Linx 2018
User avatar
austin.texas
Level 20
Level 20
Posts: 12003
Joined: Tue Nov 17, 2009 3:57 pm
Location: at /home

Re: Moving the root partition to a new drive

Post by austin.texas »

pegasis wrote:If i have 1) drive with MBR, and another with GPT and I want to read both from my drive bays, (not from external HD dock),
do I set boot up to legacy for the main drive (which is mbr), and to uefi for the Gpt drive which would be the slave drive?
austin.texas wrote:[Tutorial] Moving the root partition to a new drive:
NOTE: this tutorial covers moving a Legacy Mint installation, not UEFI.
No. you do not switch to UEFI for anything. You use the GPT drive in Legacy mode according to the Tutorial :arrow:
austin.texas wrote:[Tutorial] Moving the root partition to a new drive:
Right-click on the unallocated space > New Partition > 1MB > unformatted > APPLY
Right-click on the new 1MB partition > Manage Flags > bios_grub > APPLY
The details for doing those steps are in this tutorial.
You have missed that step,
Mint 18.2 Cinnamon, Quad core AMD A8-3870 with Radeon HD Graphics 6550D, 8GB DDR3, Ralink RT2561/RT61 802.11g PCI
Linux Linx 2018
pegasis
Level 4
Level 4
Posts: 470
Joined: Fri Dec 26, 2014 12:56 pm

Re: Moving the root partition to a new drive

Post by pegasis »

grub-install --recheck /dev/sdb

getting this error??


Installing for i386-pc platform.
grub-install.real: warning: this GPT partition label contains no BIOS Boot Partition; embedding won't be possible.
grub-install.real: warning: Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are UNRELIABLE and their use is discouraged..
grub-install.real: error: will not proceed with blocklists.
root@BladeRunner /
User avatar
austin.texas
Level 20
Level 20
Posts: 12003
Joined: Tue Nov 17, 2009 3:57 pm
Location: at /home

Re: Moving the root partition to a new drive

Post by austin.texas »

pegasis wrote:grub-install --recheck /dev/sdb
getting this error??
Installing for i386-pc platform.
grub-install.real: warning: this GPT partition label contains no BIOS Boot Partition; embedding won't be possible.
As I posted above, you missed the part about creating a bios_grub partition.
austin.texas wrote:[Tutorial] Moving the root partition to a new drive:
Right-click on the unallocated space > New Partition > 1MB > unformatted > APPLY
Right-click on the new 1MB partition > Manage Flags > bios_grub > APPLY
The details for doing those steps are in this tutorial.
You have missed that step,
Mint 18.2 Cinnamon, Quad core AMD A8-3870 with Radeon HD Graphics 6550D, 8GB DDR3, Ralink RT2561/RT61 802.11g PCI
Linux Linx 2018
pegasis
Level 4
Level 4
Posts: 470
Joined: Fri Dec 26, 2014 12:56 pm

Re: Moving the root partition to a new drive

Post by pegasis »

that attempt with gparted locked up the computer, and the drive in the ext was not doing anything, no read/writes.

does the 1MB partition need to be the first partition?

and I will copy the root, home and swap partitions from the master drive for a total of 4 partitions?

does this sound correct?
User avatar
austin.texas
Level 20
Level 20
Posts: 12003
Joined: Tue Nov 17, 2009 3:57 pm
Location: at /home

Re: Moving the root partition to a new drive

Post by austin.texas »

pegasis wrote:does the 1MB partition need to be the first partition?
Yes. You need to delete the existing partitions and start over.
pegasis wrote:and I will copy the root, home and swap partitions from the master drive for a total of 4 partitions? does this sound correct?
Yes.
Mint 18.2 Cinnamon, Quad core AMD A8-3870 with Radeon HD Graphics 6550D, 8GB DDR3, Ralink RT2561/RT61 802.11g PCI
Linux Linx 2018
pegasis
Level 4
Level 4
Posts: 470
Joined: Fri Dec 26, 2014 12:56 pm

Re: Moving the root partition to a new drive

Post by pegasis »

I have deleted the partitions, and created the 1MB grub partition, flagged it as grub

I CAN NOT copy the root, and other partitions off the master drive

I can use gparted and rt click on the partition, but the copy command is grayed out???
User avatar
austin.texas
Level 20
Level 20
Posts: 12003
Joined: Tue Nov 17, 2009 3:57 pm
Location: at /home

Re: Moving the root partition to a new drive

Post by austin.texas »

pegasis wrote:I have deleted the partitions, and created the 1MB grub partition, flagged it as grub
I hope you mean "bios_grub", not "grub"
pegasis wrote:I CAN NOT copy the root, and other partitions off the master drive
I can use gparted and rt click on the partition, but the copy command is grayed out???
I am guessing you did not boot the live Mint, you booted the installed Mint. :?: :?:
austin.texas wrote:[Tutorial] Moving the root partition to a new drive:
Moving LM17.3Cinn on sdb3 to sdc2 on a new drive (SSD):
Boot the live Mint DVD or USB or boot into a different OS (other than the one you are moving).
Mint 18.2 Cinnamon, Quad core AMD A8-3870 with Radeon HD Graphics 6550D, 8GB DDR3, Ralink RT2561/RT61 802.11g PCI
Linux Linx 2018
pegasis
Level 4
Level 4
Posts: 470
Joined: Fri Dec 26, 2014 12:56 pm

Re: Moving the root partition to a new drive

Post by pegasis »

this is very much not easy

and

very much a PIA :x

I hope it works
pegasis
Level 4
Level 4
Posts: 470
Joined: Fri Dec 26, 2014 12:56 pm

Re: Moving the root partition to a new drive

Post by pegasis »

I have migrated linux to a 5TB drive (GPT) and it boots as GPT
original drive was a 2TB MBR HD

but there is an issue extending the partition using gparted

GParted 0.25.0 --enable-libparted-dmraid --enable-online-resize

Libparted 3.2

Grow /dev/sdb3 from 1.75 TiB to 4.35 TiB 00:00:00 ( ERROR )

calibrate /dev/sdb3 00:00:00 ( SUCCESS )

path: /dev/sdb3 (partition)
start: 117190656
end: 3869130751
size: 3751940096 (1.75 TiB)
grow partition from 1.75 TiB to 4.35 TiB 00:00:00 ( ERROR )

old start: 117190656
old end: 3869130751
old size: 3751940096 (1.75 TiB)
requested start: 117190656
requested end: 9458728959
requested size: 9341538304 (4.35 TiB)
libparted messages ( INFO )

partition length of 9341538304 sectors exceeds the msdos-partition-table-imposed maximum of 4294967295


How can I fix this??
User avatar
austin.texas
Level 20
Level 20
Posts: 12003
Joined: Tue Nov 17, 2009 3:57 pm
Location: at /home

Re: Moving the root partition to a new drive

Post by austin.texas »

Boot into Mint on the 5TB drive, and post the result of the command:

Code: Select all

sudo parted --list
Mint 18.2 Cinnamon, Quad core AMD A8-3870 with Radeon HD Graphics 6550D, 8GB DDR3, Ralink RT2561/RT61 802.11g PCI
Linux Linx 2018
Post Reply

Return to “Tutorials”