YouTube Videos

FILTERS:
ALL
Backup Cloning
Cloning Kubuntu 16.10 to USB
Cloning Kubuntu 20.04 to USB
Cloning Kubuntu 22.04 to USB
Install Windows XP on USB-Stick
Moving Windows XP Installation
MultiBoot USB-Stick
Partclone - Backup
PartImage - Backup
PartImage - Move Partition
ShadowCopy Registry Backup
Xcopy Incremental Backup
Android
Android-x86
Chromecast
Dual Boot MultiBoot
Linux
Messaging IM SMS
Misc. Soc Media
Music Jazz MPB
Remote Controls
Screen Recording
Smart-TV IPTV
USB Flash Drives
Windows

Krister's Blog
krister at hallergard dot com


Last Updated:
2014-01-24

Move Linux to another partition with Partimage

Sometimes I use PartImage to move my Linux partitions, which have exactly the same size. You can restore to a bigger target partition, but not to a smaller. I use this method when getting a new hard drive. With Partimage you can not use ext4 and btrfs filesystems. I use ext3 for all Linux partitions.
View Video 5 min

Restoring to a different target partitions than the source is rather much the same as to its own source as described here, except of course specifying another target partition.
  • Open a root terminal
  • Enter "blkid" and make a note of the UUID for sdb4
  • Enter "umount /dev/sdb4"
  • Enter "partimage"
  • Arrow key down to highlight the sdb4 partition
  • Tab key down to "Image file to create/use"
  • Enter "/mnt/w5/winfix/Mint.img.000" See picture!
    Note the 000 for the first file, the second will be restored automatically
  • Tab key down to action "Restore partition---"
  • Hit space to select
  • Press F5
The two image files 2+1 GB were restored to their new location in 6 minutes.


Restoring from images of sdb3 residing at sdb1 (w5) to sdb4
Now comes the tricky part: How to make the partition bootable in its new location? We now have two identical Linux Mint partitions (unless we have already used sdb3 for something else), which is not acceptable. The bootsector of the restored partition now has the same UUID (universally unique identifier) as the source. Will change it back to its previous UUID (which you have made a note of above):
  • Open a root terminal
  • Enter "tune2fs /dev/sdb4 -U bf18628f-55ee-41d2-8556-541f8e5ebfc8"
We also have to edit the file /etc/fstab of the new partition location, which requires us to mount the partition:
  • Open a root terminal
  • Enter "mount /dev/sdb4"

Start a file manager and navigate to /mnt/l8/etc/fstab. Open fstab in a text editor and change the first line to the same UUID as before, defining the root location. Also move the hash (#) from /dev/sdb3 to /dev/sdb4.


/mnt/sdb4/etc/fstab (textfile)

If you like most people are happy with having only one boot menu on the very first partition, you can stop reading here!

My desktop PC uses BIOS-MBR. I want to be able to boot sdb4 independently using its own boatloader menu. Then there are some more steps as we cannot boot from the restored sdb4 yet. Its grub2 boot menu has not been updated, and this update has to be done after booting sdb4! Catch 22! There is a workaround: Booting sdb4 using another partition's boot menu.


Bootmenu Linux Ubuntu on sda2

Key down to boot sdb4! - Click to see!
Linux Mint is now on sdb4, not Linux Fedora!


Here is Linux Ubuntu's boot menu. The last item states Linux Fedora, which was previously on sdb4 and had the UUID that we now have restored to Linux Mint on sdb4. Move to the last item and press enter to boot Linux Mint!



After successfully booting Linux Mint in its new location sdb4, we can update the partition boot sector and then the Grub2 bootmenu:
  • Open a root terminal
  • Enter "/usr/sbin/grub-install --force /dev/sdb4"
  • Enter "update-grub" Now we can boot Linux Mint from sdb4!
I have made some cosmetic edits to the Linux Mint boot menu on sdb4, such as showing the systems in partition order. I also have to update the other partitions boot menus as the distro has changed for partition sdb4.

Linux Mint boot menu on sdb4!
after some cosmetic edits