On Wednesday, 18 November 2020 06:46:35 GMT the...@sys-concept.com wrote:
> On 11/17/2020 11:26 AM, Michael wrote:
> > On Tuesday, 17 November 2020 17:47:09 GMT the...@sys-concept.com wrote:
> >> I'm looking for an idea to duplicate my old gentoo system.
> >> I'm using old programs that require older version php, ( PHP Version
> >> 5.6) the program is not compatible with newer php. 7.4 and apache 2.2
> >> 
> >> Gentoo is install on 1TB  SSD  (/dev/sda)
> >> The new 2TB  SSD is M.2 (so it has a strange name)
> >> 
> >> 1.) Is my option only:
> >> dd if=/dev/sdX of=/dev/sdY bs=64K conv=noerror,sync
> >> 
> >> If I duplicate the drive this way I'll end-up with two partitions, as
> >> I'll have 1TB free on a new drive.  Or is there a way to resize
> >> partition on M.2 SSD
> >> 
> >> 2.) Another options, I could dig-out the old programs from "attic", but
> >> that will not be an easy job.
> > 
> > You could go about this in a number of different ways.
> > 
> > dd command will take forever, as it is copying every bit and byte from one
> > disk to the next, whether it contains data or not.
> > 
> > I prefer to use a clonezilla liveUSB to copy a disk or selected partitions
> > between disks, which will take significantly less time as only blocks with
> > data get copied over.
> > 
> > You can increase the partition size after you finish copying it onto the
> > new disk and then the filesystem size within it.  Gparted can run both
> > steps in a single stroke.
> > 
> > If you prefer a more manual and tedious way, you can create a partition as
> > large as you need it to be on the new disk, format it with a filesystem of
> > choice, then use rsync or tar to copy over the files you want and
> > --exclude
> > anything you don't want copied over.
> 
> Manual approach might be confusing and prone to errors.
> I will try Gparted as you suggested but I was wondering if it will allow
> me to combine/join partitions.  On most modern system I think there is:
> 1 - boot partiton
> 2 - swap if needed
> 3 - root partition (where home is as well)
> 
> My current layout is old one:
> dev/sda1              /boot           ext2
> /dev/sda3             /               ext4
> /dev/sda2             none            swap
> /dev/sda4             /home   ext4
> 
> Is it possible with Gparted combine "/" and "home" partitions, or is it
> as simple as coping all file from "home" partition to "/" home folder.

Others have answered this already and I agree with them, a separate /home 
partition is better for longer term OS maintenance/back up/replacement, 
without messing up with your personal data in /home.

However, if you really want to have your /home directory on the same partition 
as / then a step by step approach could be:

1. Use Gparted to create /boot[1], / and swap partitions of the desired size.  
Use up the whole 2TB of the new disk if you want, or make each partition to 
any size you like, as long as each partition on the new disk is at least as 
large as the corresponding partition on the old disk.  You can use LVM if you 
want to have resizable logical volumes on the new disk.

2. Use Clonezilla LiveCD/USB to clone /boot and / partitions from the old to 
the new disk. If the new partitions are larger in size compared to the old 
partitions, use Gparted (or CLI tools like resize2fs) after you finish cloning 
the partition data to resize the filesystem and fill up the new partitions.  
Create the new swap (mkswap and swapon).

3. Then mount your /home partition on the old disk and the / partition on the 
new disk and use 'rsync -axAHX' or tar (don't forget --xattrs) to copy over 
the /home directory from the old to the new.

4. Adjust the new /etc/fstab accordingly.[2]

5. Reboot using the new disk to check all is as it should be.

[1] You may not want/need a new /boot partition - the old /boot in /dev/sda1 
will be able to also boot the cloned / partition, but you would need to 
adjust/update your boot manager to include the new / partition.

[2] Clonezilla will copy over the original partition UUID so you will need to 
check this with blkid and change it with tune2fs to avoid clashes if both 
disks will be on the same PC.

I hope I haven't missed up anything in the above, since it's not something I 
do often, but troubleshooting omissions should be easy to resolve. 

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to