Re: [Dorset] 'Cloning' a Disk when the Partitions are not identical

2015-12-01 Thread Simon P Smith

On 12/08/15 13:57, Andrew wrote:
> .
>
> So I would do it in two stages, first clone, then resize/move the
> partitions.
>
> Clonezilla won't work where the target drive is smaller than the
> source, which is a problem I've had with SSDs.
>
> http://www.clonezilla.org/
> http://gparted.org/

The all-in-one swiss army knife which has gparted etc. is System
REscueCD which easily installs onto a small pen-drive.

http://www.sysresccd.org

Consider also using fsarchiver (also on that distro) to copy a
partitions content without having to resize the destination ie.
you fit the used size not the partition size.

Si


--
Next meeting:  Bournemouth, Tuesday, 2015-12-01 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread:  mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING
Reporting bugs well:  http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR


Re: [Dorset] 'Cloning' a Disk when the Partitions are not identical

2015-08-13 Thread Terry Coles
On Wednesday 12 Aug 2015 Ralph Corderoy wrote:

 You can copy the contents of a partition from one Linux block device to
 another, but you wouldn't normally use cp(1) to do it.  If you're
 copying the bytes of a partition then the filesystem is preserved along
 with the owner, etc., of files since that metadata is just bytes to the
 copier.

/ So to 'clone' these partitions, what is the best approach?/

 I'd use gparted, as Andrew said, and from a live recent Linux distro.

I started the process before your message arrived, so here is what I did:

1. I plugged both discs into the Optiplex and booted from the old disc.  This 
worked 
perfectly.

2. I used KDE Partition Manager to format the 1TB disc into two partitions; 
both 
bigger than the corresponding / and /home partitions on the old one, plus a 
swap 
partition to suit the new amount of RAM.

3. I then rebooted into Clonzilla, as Andrew suggested, and used it to do a 
partition 
to partition clone on the / and /home partitions, so that the 1TB disc 
contained 
exactly the same content as the corresponding partitions on the old one.

4. I disconnected the old disc and rebooted.  It started, but it clearly wasn't 
finding 
my old settings.  I then spent more time than I would care to admit to trying 
to 
sort this out, with no real success, see below.

In the meantime, you replied to my original message, so I'm now running with 
the 
old disc again so that I can write this message.

 There's two distinct things;  the size of the partition, and how much
 space the filesystem is set up to `own' in the partition.  So to copy
 and enlarge the partition and filesystem is a multi-stage thing.
 gparted will let you copy the partition from one disk to another,
 enlarge it, and it will then have the filesystem grow to have that extra
 space within its remit.  You can tell it multiple actions and it starts
 them all when you say.  Whether you give it several small tasks, or one
 long one and cross your fingers is personal preference.

Do you think that what I did with Clonezilla meets this set of criteria?

 IIRC gparted will also change the UUID of a filesystem so the two copies
 don't clash.  That may cause issues if your /etc/fstab is referring to
 filesystems by UUID.

This I think is where things went wrong for me.  Obviously (I hope) the cloned 
fstab 
will still be expecting to find my /home and swap partitions at the UUIDs of 
those 
locations on the old disc.  Can you suggest an easy way to resolve this?

-- 

Terry Coles


--
Next meeting:  Bournemouth, Tuesday, 2015-09-01 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread:  mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING
Reporting bugs well:  http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR


Re: [Dorset] 'Cloning' a Disk when the Partitions are not identical

2015-08-13 Thread Terry Coles
On Thursday 13 Aug 2015 08:34:42 Peter Merchant wrote:
 Terry, I would have used gparted to create a small partition on your
 original disk, then used Clonezilla to store an image of the other
 partitions on to that new partition, Then used clonezilla to bring them
 down on to the new disk. If you have a third disk available, can you use
 Clonezilla to image the whole of your master disk to that, then download
 it to the new disk and use gparted to resize?

Well I started off doing this with an 'Images' partition on the 1TB disc to 
store the / and /home images of the old disk.  Halfway through I realised that 
Clonezilla can do a direct partition to partition copy, which is what I ended 
up doing.

Either way the UUIDs in fstab on the new disc will be pointing at the 
partitions on the old disc, so I know that I need to change them.  I suppose I 
can edit them manually, presumably by getting the UUID from the partition 
manager.  Before I do that though I'd like to know how to edit/update fstab  
before I reboot, because, I suspect that if I run the machine with the wrong 
entries KDE will 'helpfully' update all sorts of things that I'd rather were 
untouched.

Anyone know whether I can mount the disc read/write from a live disc?  I've 
only been able to mount it read-only so far, but presumably, I can do it the 
shell and then make the changes using the editor in the live disc?  
Alternatively, would booting into a shell be safe?

I'm off shopping now for a few hours and I'd like to have another go at this 
after lunch.

-- 

Terry Coles



--
Next meeting:  Bournemouth, Tuesday, 2015-09-01 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread:  mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING
Reporting bugs well:  http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR


Re: [Dorset] 'Cloning' a Disk when the Partitions are not identical

2015-08-13 Thread Ralph Corderoy
Hi Terry,

 Halfway through I realised that Clonezilla can do a direct partition
 to partition copy, which is what I ended up doing.

Yep, saves a second lot of copying.

 Anyone know whether I can mount the disc read/write from a live disc?
 I've only been able to mount it read-only so far, but presumably, I
 can do it the shell and then make the changes using the editor in the
 live disc?  

Command line mounting, assuming root or prefixed with `sudo'.

mount  # Lists current mounts and their options.
umount /dev/sdb3   # U[n]mounts that device.
mkdir /tmp/b3  # Create a directory to mount over.
mount -o ro /dev/sdb3 /tmp/b3  # Mount it read-only.
mount /dev/sdb3 /tmp/b3# Mount it read-write.
cd /tmp/b3/etc
ed fstab   # Adjust editor to suit, e.g. nano.

You'll find umount complains if processes are still using the
filesystem, e.g. it's your current working directory.  To find what they
are and hunt them down, `sudo lsof /dev/sdb3' to LiSt the Open Files;
lsof(8).

 Alternatively, would booting into a shell be safe?

No sure.  Haven't got a clear picture of what's going on.

 I'm off shopping now for a few hours and I'd like to have another go
 at this after lunch.

I don't know how I ever found the time to go to work!

Cheers, Ralph.

--
Next meeting:  Bournemouth, Tuesday, 2015-09-01 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread:  mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING
Reporting bugs well:  http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR


Re: [Dorset] 'Cloning' a Disk when the Partitions are not identical

2015-08-13 Thread Ralph Corderoy
Hi Terry,

 1. I plugged both discs into the Optiplex and booted from the old
 disc.  This worked perfectly.

OK.

 2. I used KDE Partition Manager to format the 1TB disc into two
 partitions; both bigger than the corresponding / and /home partitions
 on the old one, plus a swap partition to suit the new amount of RAM.

Sounds fine, shouldn't matter they're bigger as it just means the
filesystem won't make use of the bytes beyond its original size.

 3. I then rebooted into Clonzilla, as Andrew suggested, and used it to
 do a partition to partition clone on the / and /home partitions, so
 that the 1TB disc contained exactly the same content as the
 corresponding partitions on the old one.

Yep.

 4. I disconnected the old disc and rebooted.  It started, but it
 clearly wasn't finding my old settings.

More precision required!  :-)  What started?  Grub?  The Linux kernel?
Your old settings for a logged in GUI user?

 In the meantime, you replied to my original message, so I'm now
 running with the old disc again so that I can write this message.

OK, so it is happy to boot off the old drive in the new machine with
both drives present?

 Do you think that what I did with Clonezilla meets this set of
 criteria?

I don't know Clonezilla, but I would guess it copied the filesystems,
but didn't enlarge them to the bigger partition size.  In gparted,
there's a dialogue showing what it's doing in high-level terms as it
works, and you can click the ▷ to expand to more detail.  I see mention
of enlarging filesystems there.

  IIRC gparted will also change the UUID of a filesystem so the two
  copies don't clash.  That may cause issues if your /etc/fstab is
  referring to filesystems by UUID.
 
 This I think is where things went wrong for me.  Obviously (I hope)
 the cloned fstab will still be expecting to find my /home and swap
 partitions at the UUIDs of those locations on the old disc.  Can you
 suggest an easy way to resolve this?

/etc/fstab will be used once the kernel's up and running;  grub can also
use UUIDs, and I think the RAM disk image used during booting can on
some systems too.

Anyway, get both drives connected with a running Linux system, whether
from the old drive or a live distro.  Run `sudo blkid -c /dev/null' to
list the block devices found along with their LABELs and UUIDs.
fstab(5) accepts either.

This will show you if your clones have had their UUIDs altered since.
If they haven't, then you boot failure has a different cause.  Have you
set up the partition table on the second drive in a similar manner to
the first?  I'm out of date here, but is /boot near enough to the
start of the drive.  Do boot flags on a partition matter any more?
I don't know what Dell's BIOS needs.

tune2fs(8)'s -L and -U options can be used to change LABEL and UUID for
an ext[234] filesystem, e.g. `sudo tune2fs -U random /dev/sdd3'.

Cheers, Ralph.

--
Next meeting:  Bournemouth, Tuesday, 2015-09-01 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread:  mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING
Reporting bugs well:  http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR

Re: [Dorset] 'Cloning' a Disk when the Partitions are not identical

2015-08-13 Thread Terry Coles
On Thursday 13 Aug 2015 09:23:42 Ralph Corderoy wrote:
  I'm off shopping now for a few hours and I'd like to have another go
  at this after lunch.
 
 I don't know how I ever found the time to go to work!

Work was infinitely better than going to Tesco!

Going off-line now to have another go.  Wish me luck!

-- 

Terry Coles



--
Next meeting:  Bournemouth, Tuesday, 2015-09-01 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread:  mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING
Reporting bugs well:  http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR


Re: [Dorset] 'Cloning' a Disk when the Partitions are not identical

2015-08-13 Thread Terry Coles
On Thursday 13 Aug 2015 09:15:12 Ralph Corderoy wrote:
 /etc/fstab will be used once the kernel's up and running;  grub can also
 use UUIDs, and I think the RAM disk image used during booting can on
 some systems too.

OK.  Working now.  Here is what i had to do for my particular setup.  I found 
that 
SystemRescueCD - http://www.sysresccd.org/SystemRescueCd_Homepage [1]
had all the tools that I needed and some useful Help in the online Manual:

1.  Plugged both discs in and used GParted to copy the old / and /home 
partitions, 
adjusting the partition sizes as I went.

2.  Mounted the new / partition and updated fstab with the new UUIDs.

3.  Removed the old disc, rebooted and found myself in a grub-rescue prompt.  
This 
is horrible, because hardly any shell commands work and there is no access to 
help.  
It took a while to work this one out.

4.  Rebooted using SystemRescueCD, but this time selected the 'Boot into an 
existing Linux installation' option.  This got me into my new OS (running under 
SystemRescueCD).

5.  Ran grub-install /dev/sda, which updated the grub.cfg in the /boot/grub 
directory.

Rebooted and :-)

Thanks for all the help.  I'll shortly have to do it all again with my / 
partition on the 
SSD drive (when it arrives) and my /home partition on a separate conventional 
2.5 
drive (the Optiplex SFF will only take one 3.5 drive or two 2.5 ones).   
Hopefully, 
with all the practice, it will be a bit less fraught...

-- 

Terry Coles




[1] http://www.sysresccd.org/SystemRescueCd_Homepage
--
Next meeting:  Bournemouth, Tuesday, 2015-09-01 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread:  mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING
Reporting bugs well:  http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR


[Dorset] 'Cloning' a Disk when the Partitions are not identical

2015-08-12 Thread Terry Coles
Hi,

As you may have gathered from yesterday's error, I obtained a Dell Optiplex 
from atechmedia and am now trying to copy my existing software from the old 
250Gb hard drive to the 1TB drive in the Optiplex.  Here is the setup on the 
250GB drive:

sda1/   ext438GB
sda2/home   ext4210GB
sda3swapswap4GB

Here is what I'd like to end up with on the new drive:
sda1/   ext440GB
sda2/home   ext4250GB
sda3swapswap8GB

I have both discs connected and the partitioner and disk utility programs can 
see them OK.  (Currently the 250GB drive is mounted at sdb.)  I initially 
thought I could do this with Redo Backup Live! which I have successfully used 
in the past (On Windows boxes).  The problem is that although Redo will let me 
take an image of individual partitions, it will only restore to a drive not a 
partition, so it b**s up the partition table and only lets me copy one 
partition.

I then tried booting into Kubuntu Live and copying each disc partition as files 
(I'm not sure it will work for the / partition, but thought it worth a try).  
The problem is that the discs are mounted read-only and I'm concerned that is 
I copy as root, I'll end up with files that are all owned by root in my home 
partition.

So to 'clone' these partitions, what is the best approach?

(I'll need to do this all over again when the SSD Drive turns up :-) )

-- 

Terry Coles



--
Next meeting:  Bournemouth, Tuesday, 2015-09-01 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread:  mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING
Reporting bugs well:  http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR


Re: [Dorset] 'Cloning' a Disk when the Partitions are not identical

2015-08-12 Thread Andrew

Hi Terry,

The tools I have used for this sort of thing are Clonezilla and GParted. 
Clonezilla to copy from one disk to another, and GParted to resize 
partitions.

There are live CDs for each, although GParted is in most Linux distros.

So I would do it in two stages, first clone, then resize/move the 
partitions.


Clonezilla won't work where the target drive is smaller than the source, 
which is a problem I've had with SSDs.


http://www.clonezilla.org/
http://gparted.org/

--

Andrew.


On 12/08/2015 13:13, Terry Coles wrote:

Hi,

As you may have gathered from yesterday's error, I obtained a Dell Optiplex
from atechmedia and am now trying to copy my existing software from the old
250Gb hard drive to the 1TB drive in the Optiplex.  Here is the setup on the
250GB drive:

sda1/   ext438GB
sda2/home   ext4210GB
sda3swapswap4GB

Here is what I'd like to end up with on the new drive:
sda1/   ext440GB
sda2/home   ext4250GB
sda3swapswap8GB

I have both discs connected and the partitioner and disk utility programs can
see them OK.  (Currently the 250GB drive is mounted at sdb.)  I initially
thought I could do this with Redo Backup Live! which I have successfully used
in the past (On Windows boxes).  The problem is that although Redo will let me
take an image of individual partitions, it will only restore to a drive not a
partition, so it b**s up the partition table and only lets me copy one
partition.

I then tried booting into Kubuntu Live and copying each disc partition as files
(I'm not sure it will work for the / partition, but thought it worth a try).
The problem is that the discs are mounted read-only and I'm concerned that is
I copy as root, I'll end up with files that are all owned by root in my home
partition.

So to 'clone' these partitions, what is the best approach?

(I'll need to do this all over again when the SSD Drive turns up :-) )





--
Next meeting:  Bournemouth, Tuesday, 2015-09-01 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread:  mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING
Reporting bugs well:  http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR


Re: [Dorset] 'Cloning' a Disk when the Partitions are not identical

2015-08-12 Thread Ralph Corderoy
Hi Terry,

 Here is what I'd like to end up with on the new drive:
 sda1/   ext440GB
 sda2/home   ext4250GB
 sda3swapswap8GB
...
 I then tried booting into Kubuntu Live and copying each disc partition
 as files (I'm not sure it will work for the / partition, but thought
 it worth a try).  The problem is that the discs are mounted read-only
 and I'm concerned that is I copy as root, I'll end up with files that
 are all owned by root in my home partition.

You can copy the contents of a partition from one Linux block device to
another, but you wouldn't normally use cp(1) to do it.  If you're
copying the bytes of a partition then the filesystem is preserved along
with the owner, etc., of files since that metadata is just bytes to the
copier.

 So to 'clone' these partitions, what is the best approach?

I'd use gparted, as Andrew said, and from a live recent Linux distro.

There's two distinct things;  the size of the partition, and how much
space the filesystem is set up to `own' in the partition.  So to copy
and enlarge the partition and filesystem is a multi-stage thing.
gparted will let you copy the partition from one disk to another,
enlarge it, and it will then have the filesystem grow to have that extra
space within its remit.  You can tell it multiple actions and it starts
them all when you say.  Whether you give it several small tasks, or one
long one and cross your fingers is personal preference.

IIRC gparted will also change the UUID of a filesystem so the two copies
don't clash.  That may cause issues if your /etc/fstab is referring to
filesystems by UUID.

Cheers, Ralph.

--
Next meeting:  Bournemouth, Tuesday, 2015-09-01 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread:  mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING
Reporting bugs well:  http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR