Gentoo Archives: gentoo-user

From: Michael <confabulate@××××××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] duplicate gentoo system
Date: Wed, 18 Nov 2020 11:23:36
Message-Id: 22000631.6Emhk5qWAg@lenovo.localdomain
In Reply to: Re: [gentoo-user] duplicate gentoo system by thelma@sys-concept.com
1 On Wednesday, 18 November 2020 06:46:35 GMT thelma@×××××××××××.com wrote:
2 > On 11/17/2020 11:26 AM, Michael wrote:
3 > > On Tuesday, 17 November 2020 17:47:09 GMT thelma@×××××××××××.com wrote:
4 > >> I'm looking for an idea to duplicate my old gentoo system.
5 > >> I'm using old programs that require older version php, ( PHP Version
6 > >> 5.6) the program is not compatible with newer php. 7.4 and apache 2.2
7 > >>
8 > >> Gentoo is install on 1TB SSD (/dev/sda)
9 > >> The new 2TB SSD is M.2 (so it has a strange name)
10 > >>
11 > >> 1.) Is my option only:
12 > >> dd if=/dev/sdX of=/dev/sdY bs=64K conv=noerror,sync
13 > >>
14 > >> If I duplicate the drive this way I'll end-up with two partitions, as
15 > >> I'll have 1TB free on a new drive. Or is there a way to resize
16 > >> partition on M.2 SSD
17 > >>
18 > >> 2.) Another options, I could dig-out the old programs from "attic", but
19 > >> that will not be an easy job.
20 > >
21 > > You could go about this in a number of different ways.
22 > >
23 > > dd command will take forever, as it is copying every bit and byte from one
24 > > disk to the next, whether it contains data or not.
25 > >
26 > > I prefer to use a clonezilla liveUSB to copy a disk or selected partitions
27 > > between disks, which will take significantly less time as only blocks with
28 > > data get copied over.
29 > >
30 > > You can increase the partition size after you finish copying it onto the
31 > > new disk and then the filesystem size within it. Gparted can run both
32 > > steps in a single stroke.
33 > >
34 > > If you prefer a more manual and tedious way, you can create a partition as
35 > > large as you need it to be on the new disk, format it with a filesystem of
36 > > choice, then use rsync or tar to copy over the files you want and
37 > > --exclude
38 > > anything you don't want copied over.
39 >
40 > Manual approach might be confusing and prone to errors.
41 > I will try Gparted as you suggested but I was wondering if it will allow
42 > me to combine/join partitions. On most modern system I think there is:
43 > 1 - boot partiton
44 > 2 - swap if needed
45 > 3 - root partition (where home is as well)
46 >
47 > My current layout is old one:
48 > dev/sda1 /boot ext2
49 > /dev/sda3 / ext4
50 > /dev/sda2 none swap
51 > /dev/sda4 /home ext4
52 >
53 > Is it possible with Gparted combine "/" and "home" partitions, or is it
54 > as simple as coping all file from "home" partition to "/" home folder.
55
56 Others have answered this already and I agree with them, a separate /home
57 partition is better for longer term OS maintenance/back up/replacement,
58 without messing up with your personal data in /home.
59
60 However, if you really want to have your /home directory on the same partition
61 as / then a step by step approach could be:
62
63 1. Use Gparted to create /boot[1], / and swap partitions of the desired size.
64 Use up the whole 2TB of the new disk if you want, or make each partition to
65 any size you like, as long as each partition on the new disk is at least as
66 large as the corresponding partition on the old disk. You can use LVM if you
67 want to have resizable logical volumes on the new disk.
68
69 2. Use Clonezilla LiveCD/USB to clone /boot and / partitions from the old to
70 the new disk. If the new partitions are larger in size compared to the old
71 partitions, use Gparted (or CLI tools like resize2fs) after you finish cloning
72 the partition data to resize the filesystem and fill up the new partitions.
73 Create the new swap (mkswap and swapon).
74
75 3. Then mount your /home partition on the old disk and the / partition on the
76 new disk and use 'rsync -axAHX' or tar (don't forget --xattrs) to copy over
77 the /home directory from the old to the new.
78
79 4. Adjust the new /etc/fstab accordingly.[2]
80
81 5. Reboot using the new disk to check all is as it should be.
82
83 [1] You may not want/need a new /boot partition - the old /boot in /dev/sda1
84 will be able to also boot the cloned / partition, but you would need to
85 adjust/update your boot manager to include the new / partition.
86
87 [2] Clonezilla will copy over the original partition UUID so you will need to
88 check this with blkid and change it with tune2fs to avoid clashes if both
89 disks will be on the same PC.
90
91 I hope I haven't missed up anything in the above, since it's not something I
92 do often, but troubleshooting omissions should be easy to resolve.

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-user] duplicate gentoo system antlists <antlists@××××××××××××.uk>