1 (edited by KalaDude 2017-04-12 10:27:28)

Topic: unable to copy partition [SOLVED]

Aloha !  I have 3 drives on this machine

/sda which is the boot drive running Ubuntu 16.04

/sdb which is the intended source  drive.  I want to copy the data from a partition which only has 681 Gib of data in a 1.8Tib Ext4  partition

/sdc which is the intended destination drive.  I used gparted to shrink an Ext4 partition on this drive leaving me with 839 Gib of unallocated space.

When I right click on the source partition, I am able to use the copy command but when I right click on the target unallocated free space, I am unable to paste as the paste command is grayed out.

Do I have to shrink the source partition so it is smaller than the target partition even though the amount of data in the source partition is smaller than target partition?  Would it make more sense to use dd to copy the data?

/sdb was starting to fail so I used ddrescue to backup /sdb to yet another drive not presently connected to the machine.  ddrescue reported that it was able to recover all the data, however the backup drive is not bootable, there is just one big Loop (?) partition on it.  Is there a way to use gparted to transform the backup into a useable, bootable drive? If not can you point me in the right direction please?

2

Re: unable to copy partition [SOLVED]

Hello. You can shrink the original filesystem to a size slightly smaller than the available unallocated space, and then make the copy. GParted makes a copy of the whole filesystem, no just the data.

How much smaller? In theory -2 MiB would be enough iwth MiB aligned partitions, however I would advice to go smaller (say 10-20 MiB or even 1 GiB), to avoid any alignment issues between the old and the new drive. For the new drive you have to select the MiB alignment (it is the GParted default setting since several years, as most operating systems and actual hardware use it). After doing the copy operation you can eventually grow the new partition to take the entire available space.

I understand that you already have a backup of your sdb disk on another drive, otherwise I would advice to start by this backup step (better safe than sorry smile ).

Another solution can be to make the new partition and then manually copy the data structure from the old one to the new. This will change the partition UUID (the GParted copy operation keeps the original UUID; please give a look in the GParted manual (Documentation web page, chapter "Copying and pasting partitions").

As the original hard drive is failing, you don't have to grow again the original partition to the original size. I think you have to just discard that drive and, of course, avoid to use it as backup drive.

*** It is highly recommended to backup any important files before doing resize/move operations. ***

3

Re: unable to copy partition [SOLVED]

Thank-you very much. Ok I am going try making a new partition and manually copying the data.  To manually copy the data, should I just drag and drop in a file manger, use dd, or is gparted capable of doing this?

The big question that remains, I still can not figure out how to convert the backup I made with ddrescue into a usable, bootable drive. I believe the backup is referred to as a disk image and the partition type is LOOP.  Do I use gparted somehow?  Is grub part of the answer?

How do I do this?

4

Re: unable to copy partition [SOLVED]

To copy the data, you don't need dd or GParted, if the hard drive is still in condition to mount the partition. dd works rather on raw data, and GParted works on partitions.

About the ddrescue backup, I think you can find useful info in this article.

Another related article is there.

*** It is highly recommended to backup any important files before doing resize/move operations. ***

5

Re: unable to copy partition [SOLVED]

After you have restored the partition to a new drive, if you wish to restore the ability to boot from that drive then you will need to re-write the boot code which is not stored within a partition.

For information on how to do this, see the GParted FAQ or the GParted Manual - Fixing Operating System Boot Problems.