Hi Clive,

> ...as the laptop has 4 partitions:
>     sda1=OS (Mint) system files
>     sda2=swop
>     sda3=Home
>     sda4=odds area
...
> From a 'live disk' would like to copy sda3 to another disk (USB 160Gb
> with 2 partitions - sdb1=NTFS and sdb2= Ext4 140Gb)

/dev/sda3 was about 286G big, with 102 GiB used, so the contents should
fit in that 140 Gb USB.

> How can I copy sda3 to sdb2 using a 'live disk' conserving all
> properties.

I don't know of a GUI program so command-line it is!

Before we start, it's worth making sure the USB drive is plugged into
the fastest USB port, if you have more than one and they're different
speeds.  This is normally coloured blue.

The live disk might have automatically mounted the sda3 and sdb2
devices.  To ensure they're not mounted run

    sudo umount /dev/sda3 /dev/sdb2

Now we're going to mount them where we want them to appear.

Make a temporary directory to work in, and change the working directory
to it.

    mkdir /tmp/disk-copy
    cd    /tmp/disk-copy

Make two directories, one for each of the filesystems we want to mount.

    mkdir source destination

Mount the filesystems onto those directories.  Make sure you get them
the right way around!

    sudo mount -o ro /dev/sda3 source
    sudo mount       /dev/sdb2 destination

A peek inside should show recognisable contents.

    ls source destination

Now copy the contents of the source directory into the destination
directory.  The trailing slash on each of those directory names is
vital.  (This is the rsync(1) program which Andrew mentioned.)

    sudo env RSYNC_ICONV=- rsync -PacivHAXxSsy source/ destination/

This will take a long time.  It will print how it's going which may slow
things down a little more, but the USB will probably be the bottleneck
and I'm assuming you'd like the reassurrance it's doing something.

That's assuming you want source/clive copied to destination/clive.  If
you want it in a subdirectory on destination then ensure it exists and
alter the rsync command's destination argument.

    mkdir destination/home-2020-09-05
    sudo env RSYNC_ICONV=- rsync -PacivHAXxSsy source/ 
destination/home-2020-09-05/

Again, note the trailing slash!

Now, when the rsync finishes a copy should exist.  But USB disk
interfaces can be contrary so I recommend double-checking by unmounting
the destination so Linux forgets all about its contents.

    sudo umount destination

Unplugging the USB drive, presumably cutting its power supply.
Plugging it back in again, then mounting it,

    sudo mount /dev/sdb2 destination

and then running the exact same copy command, whatever you ended up
with, a second time.  Note, the cursor up and down keys move through
your recent history of shell commands to save typing it all again.

    sudo env RSYNC_ICONV=- rsync -PacivHAXxSsy source/ destination/

It won't take so long this time because reading is quicker than writing
and it will see the destination already has each file which it will read
all the way through generating a checksum as it goes which it then
compares to the source file's checksum.  The checksums should match if
it's a good copy so it won't print anything for this file and move onto
the next.

If the checksums differ then it will print a line as it updates the
copy.  So after a long time of hopefully not printing anything, as that
shows the first copy was good, it will finish with a couple of summary
lines.

You can then unmount both devices.

    sudo umount source destination

Haven't tried any of that so if it deviates from what you expect then
probably best to halt and ask the list.  You may want to save bits of
text from the live disk.  A ‘pastebin’ is handy.
https://pastebin.centos.org/ is one example.  Just paste your text into
the big box on the form, and bump the ‘Delete After’ up to ‘1 Day’ so
you've time to make use of it.  On submitting the form it gives you a
URL like https://paste.centos.org/view/6de8067c which can be noted down
and re-entered on a different system to retrieve the text.

You could paste the text of this email into it so you can copy-and-paste
out of the pastebin when booted from the live disk to replace the chance
of typos with pasteoes.  :-)

-- 
Cheers, Ralph.

-- 
  Next meeting: Online, Jitsi, Tuesday, 2020-10-06 20:00
  Check to whom you are replying
  Meetings, mailing list, IRC, ...  http://dorset.lug.org.uk
  New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk

Reply via email to