[solved] Howto migrate endless to new disk


#1

I tried to migrate endless to a larger disk and did the following:

After connecting the new disk to an usb->SATA converter I used
dd if=/dev/sda of=/dev/sdb bs=10M
and used the expert mode of gdisk to relocate the backup copy of the GUID partition table to the end of the disk, and swapped the disk. Endless booted and I felt good, but I soon realized that I was not able to start any application. After some research I got the impression that this is caused by the fact that the disk was mounted read only. So I swapped back and ask for help now:

What do I have to do that the new disk is mounted correct and endless might work normally?

How can I move my home partition to a new partition (which I created in the free space)? Yes, I know that this is a bit challenging, but I planned to mount the new partition temporarily and copy/move the old contents to the temporary location. But how do I mount it finally?

Thanks in advance for any tips …

eos-diagnostic-190923_122747_UTC 0200.txt (800.9 KB)
diagnostics are with the original (writeable) disk, not the new one. If needed I could try to swap again and try to save the diagnostics to an usb stick.


#2

When you ran your dd command to clone from sda to sdb, were you booted into your Endless installation from sda?

If so, that is unsafe and likely to cause problems like the one you now observed.
I suggest creating an Endless USB disk and booting from that. Once booted from the USB media, with all partitions on sda and sdb unmounted (umount /dev/sda* /dev/sdb*), do the dd clone again.


#3

yes

thanks Daniel, I should have had considered this, but I forgot. I try again.


#4

If you want to clone your installation to a new, bigger disk, you have to:

  1. Boot with the EOS USB Bootmedia in Live mode
  2. Determine which is your source and target disk:
sudo bash
blkid
  1. Now that you have these information, copy it bitwise (i assume /dev/sda is the source, /dev/sdb is the target)
dd if=/dev/sda of=/dev/sdb bs=16384 conv=sync,noerror
  1. Now every single bit of your source disk is duplicated at the target
  2. Shutdown and remove the source disk
  3. Boot into your new installation
  4. Open a Terminal and run: (i assume /dev/sda is your only disk now)
sudo bash
fdisk /dev/sda

With the ‘p’ Key you can print your current partition table. Write down the start block of your “Linux root” paritition. We will need to delete this partition and create a new entry, starting at the same, original offset but with a larger size. In my case it looks like:

Command (m for help): p
Disk /dev/sda: 447,1 GiB, 480103981056 bytes, 937703088 sectors
Disk model: INTEL SSDSC2BW48
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: D1B8649F-2A04-B348-90AB-1F606628518B

Device      Start       End   Sectors   Size Type
/dev/sda1    2048    129023    126976    62M EFI System
/dev/sda2  129024    131071      2048     1M BIOS boot
/dev/sda3  131072 937703054 937571983 447,1G Linux root (x86-64)

so i’ll remember 131072. Now press ‘d’ to remove this partition, and then ‘n’ to create a new one. As the first sectory, specify the one you’ve remembered from a moment ago. For the end sector use the one given by default and answer “no” when asked to remove the partition signature. Press ‘q’ to quit fdisk.

Now your partition has the right size, but the containing filesystem has not. Reboot your machine for the new partition table to take effect, open a terminal and enter:

sudo bash
resize2fs /dev/sda3

I assume that your new partition you created was /dev/sda3. When this command has been completed, your transfer to a new hdd is complete. Verify the free space with:

df -h /dev/sda3

#5

thanks a lot for the detailed instructions, this is almost a howto.

The only problem I encountered was:
There was an additional partition at the end of the original disk (type ED01, ntfs formatted) so there would have been an overlap. So I had to move that partition before being able to resize the ostree partition.