Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Duplicating an installation.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
52midnight
Apprentice
Apprentice


Joined: 20 Mar 2012
Posts: 176
Location: Brisbane AU

PostPosted: Thu Dec 20, 2012 9:43 pm    Post subject: Duplicating an installation. Reply with quote

I'm currently running a project to install Gentoo on my Desktop and Laptop (as one of multiple other Linux partitions), and on an SdCard for my Raspberry Pi. I'm on a tight download budget and want to minimize duplicated downloads. I'm also documenting the whole process to produce a series of pages for my website providing concise instructions for half a dozen standard install paths. This is an alternative to Gentoo's official docn that bundles them into a few long pages, making information review and retrieval difficult and somewhat confusing. First-time Users could then arrive quickly at a selected outcome - a big confidence builder.

I have a working installation on the laptop using 'startx' to get into Fluxbox, and am in process of transferring this to the desktop as efficiently as possible. I found out about 'quickpkg' after I'd 'emerge'd the laptop packages, and now realize I should have used the '--buildpkg' option on emerge to create packages for everything. I've also got nfs running for file transfer, but am now faced with the prospect of building packages for all of Xorg, transferring them, and re-emerging them. At this stage I'd be happy simply to duplicate the laptop installation on the desktop partition, and am wondering what my options are. I know of these:

1. Use 'partimage' to mirror the laptop partition and copy it to the desktop. Problem: past experience suggests that partimage requires identical partition sizes for source and target, so I'd have to shrink the desktop partn, mirror it, and regrow it - long and tedious.

2. Use 'dd' to copy the raw partition image. Problem: it doesn't know about empty storage, will create a file that's mostly unused storage, and probably requires identical partn sizes as well.

3. Use a 'LiveCd' tool to create a live installation CD. Problem: I've used this successfully with PCLOS; not sure if Gentoo has one, or if it would meet the requirement.

Does anyone have any experience or suggestions here?
Back to top
View user's profile Send private message
NotQuiteSane
Guru
Guru


Joined: 30 Jan 2005
Posts: 488
Location: Klamath Falls, Jefferson, USA, North America, Midgarth

PostPosted: Thu Dec 20, 2012 10:14 pm    Post subject: Reply with quote

either use rsync or search the forums for stage 4 backup

NQS
_________________
These opinions are mine, mine I say! Piss off and get your own.

As I see it -- An irregular blog, Improved with new location

To delete French language packs from system use 'sudo rm -fr /'
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 8291
Location: Saint Amant, Acadiana

PostPosted: Thu Dec 20, 2012 10:18 pm    Post subject: Reply with quote

Just don't download sources for every box, share existing portage over NFS.
_________________
My Gentoo installation notes.
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
52midnight
Apprentice
Apprentice


Joined: 20 Mar 2012
Posts: 176
Location: Brisbane AU

PostPosted: Fri Dec 21, 2012 12:34 am    Post subject: Reply with quote

> either use rsync

Of course! Should've thought of it, since I use it regularly for backup. Thanks.

> or search the forums for stage 4 backup

Backup? The result was "No topics or posts met your search criteria". Do you mean Stage 4 tarball?

> Just don't download sources for every box, share existing portage over NFS.

Yes; I've got an 8GB USB stick that I'm rsyncing to /usr/portage/ At present I'm copying over files, but am thinking that it could be mounted over the /usr/portage/ on the hard disk when needed; saves storage space and should give consistent results across platforms. Perhaps a reference HDD directory on one machine could be mounted via NFS a la your suggestion to save the copying.

I'm still interested in the LiveCD option but am not sure if Gentoo has this available with installation tools as with PCLOS.
Back to top
View user's profile Send private message
NotQuiteSane
Guru
Guru


Joined: 30 Jan 2005
Posts: 488
Location: Klamath Falls, Jefferson, USA, North America, Midgarth

PostPosted: Fri Dec 21, 2012 4:11 am    Post subject: Reply with quote

Ok, it's been one of those days, but I'm gonna try to be helpful here, because I think you are doing more than needed.

First, you need at least two computers running same architecture (i686, amd64, sparc). We'll cover differing architectures, such as your raspberry pi, later.

You will also need a switch or a hub. I reccomend against a hub, unless you have one and can't afford to go buy a switch, they are next to worthless. Some routers have switches built in. Wireless will also work.

We'll call the two computers "master" and "slave". uh, let's say 192.168.1.10 and 192.168.1.20. Assign IP addresses that suit your needs.

Set up the master however you'd set up a basic gentoo system. Don't worry about specialized stuff like X or {star|open|libre}office. You will want to install NFS and I reccomend using static IP addresses.

Also you want to activate SSH

Code:
master # rc-update add sshd default


Once the master computer is up and working, use the Stage 4 script to make a backup.

Put
Code:
FEATURES="buildpkg"

in /etc/portage/make.conf

Now if you want, you can put on the extra crap like X.

I'm going to assume you are using System Rescue CD, mostly because it's what I use. I'm unsure how to do things using the official install media, but it should be similar.

Load up the install media on the slave and set up networking using the included script. You don't have to use a static IP at this point, but if you don't, use 'ipconfig' to find your IP address.

make sure you can access the master computer
Code:
slave # ping -c 3 192.168.1.10

If you can't ping, make sure ifconfig gives a sane reading. Here's mine:

Code:
[nqs@tablet]  OK % ifconfig                                                                                                2012-12-20-18:40:46
eth0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 00:17:42:26:eb:c0  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 16

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 16436
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 66199  bytes 1065174154 (1015.8 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 66199  bytes 1065174154 (1015.8 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.10.93  netmask 255.255.0.0  broadcast 192.168.255.255
        inet6 fe80::219:d2ff:fe20:e783  prefixlen 64  scopeid 0x20<link>
        ether 00:19:d2:20:e7:83  txqueuelen 1000  (Ethernet)
        RX packets 534857  bytes 201906530 (192.5 MiB)
        RX errors 0  dropped 47505  overruns 0  frame 0
        TX packets 711355  bytes 936909086 (893.5 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

~ on terminal pts/8, Command #1009
[nqs@tablet]  OK %


You'll notice I'm using wireless, which gives an IP address. The wired port is unused and basically zero's across the board.

Use fdisk to set up the partitions as you wish. If you choose to, also use lvm. Use mkfs.{ext2|ext3|ext4|reiserfs|reiser4|jfs|xfs|btrfs|whatever} to format the partitions. Everyone has their favorites, but for me, I like to make /boot ext2, /usr/portage and /var reiserfs /media xfs and the rest ext4. There's no perfect filesystem, so what you use will depend on what suits your needs.

Use scp to copy the stage 4 to the new computer

Code:
slave # scp root@192.168.1.10:/path/to/stage4/location/stage4.backup.tgz /mnt/gentoo/


Extract the backup:

Code:
slave # cd /mnt/gentoo
slave # tar xvjpf stage4.backup.tgz


And mount portage

Code:
slave # mount -t nfs 192.168.1.10:/usr/portage /mnt/gentoo/usr/portage


From this point, follow the handbook from section five Charlie make sure you're using correct handbook, that's the x86 one.

Most of the stuff you'll just be checking to make sure it's correct. A few comments in the order they pertain to the handbook:

    I like to use the program 'flaggie' to ease use flag management
    unless the hardware is exactly the same, build a new kernel.
    I don't use genkernel, can't help with it
    Never used it, but I hear good things about pappy's Kernel Seeds project
    Be sure to include any NFS entries in your fstab
    If you want to use GRUB2, a howto is here
    For adding users, I like the program 'superadduser'


That's pretty much it, but here are some advanced topics to consider:

    Distcc will let you use all your computer for compiling (spread the load).
    You can Cross Compile for a different system (i.e. use your desktop to do the grunt work of building packages for the pi).
    For best results, combine both
    Speaking from experience, sparc binaries don't work on ppc. Nor arm on amd64, etc. To avoid this problem put a line like
    Code:
    PKGDIR="/usr/local/portage/sparc"
    on each computer, changing the last to match the arch it uses.
    Use nfs to export /usr/local/portage/$arch. That way you can keep all packages in sync across the LAN
    For emerge, I usually like to use
    Code:
    #emerge -DuNavtbk --jobs=21 --keep-going world
    . Translated thats 'Deep, Update, Newuse, Ask, Verbose, Tree, Build Package Tarball, Use Package tarball' I set '--jobs=x' to the number of CPU's in my distcc farm (I only count whole cpu's not cores) and '--keep-going' will keep going until portage cannot compile anymore due to a failure
    If the update is excessive (i.e I have to press 'page up' more than once) I run
    Code:
    emerge -DuNpv --nodeps world
    then run the above command, replacing 'world' with individual package names


NQS
_________________
These opinions are mine, mine I say! Piss off and get your own.

As I see it -- An irregular blog, Improved with new location

To delete French language packs from system use 'sudo rm -fr /'
Back to top
View user's profile Send private message
52midnight
Apprentice
Apprentice


Joined: 20 Mar 2012
Posts: 176
Location: Brisbane AU

PostPosted: Fri Dec 21, 2012 3:50 pm    Post subject: Reply with quote

Thanks for a very useful summary. I used rsync to transfer the system across NFS, edited fstab and grub.conf, and it's up and running; quick and simple!

> First, you need at least two computers running same architecture (i686, amd64, sparc).

Yep, desktop and laptop both x86.

> My DSL router covers this.

> We'll call the two computers ... IP addresses that suit your needs ... I reccomend using static IP addresses.

OK - 192.168.1.100 and 192.168.1.101 assigned using MAC binding.

> Also you want to activate SSH.

Hmm, haven't done so before, but let's do it.

> Once the master computer is up and working, use the Stage 4 script to make a backup.

Thanks for the ref, now understand what Stage 4 is.

> Put Code: FEATURES="buildpkg" in /etc/portage/make.conf

You've done this before!

> I'm going to assume you are using System Rescue CD, mostly because it's what I use.

I'm a big fan of SysRcd - it's one of the reasons I decided to return to Gentoo.

> Load up the install media on the slave ... basically zero's across the board.

Done.

> Use fdisk to set up the partitions as you wish. If you choose to, also use lvm.

Never used LVM so I'll check it out. My machines each have a dozen partitions of about 6GB for different distros. My own data is on a separate HDD on the desktop, partition on the laptop.

> I prefer to Use mkfs.{ext2|ext3 ... depend on what suits your needs.

You're ahead of me here; i've only ever used ext2 for smaller partitions, and ext3 for big ones that take hours to reconstruct. Don't use separate partitions for /boot etc - this strikes me as a server-style setup that's unnecessary for a home system, though I could be mistaken.

> Use scp to copy the stage 4 to the new computer ... Extract the backup ... mount portage

scp is new to me, so I'll look into it.

> I like to use the program 'flaggie' to ease use flag management
> :
> For adding users, I like the program 'superadduser'

Good stuff, some new that I'll check out. I regard GRUB2 as way overkill - the product of someone with a PhD (Permanent Head Damage).

> That's pretty much it, but here are some advanced topics to consider:

Again, your experience far exceeds mine here, so I'll work through what you've suggested. Experience to date with compiling on the Rpi is that it's painfully slow, so cross-compiling on the desktop would be highly desirable, but something new that I'll need to learn.

My interest in the LiveCD was to preserve crucial stages of the process, but a Stage 4 backup looks like a better solution. I'm resigned to repeating the install process several times in order to check and recheck the documentation I'm writing (and clarify it in my own mind) but don't want to repeat all the compilation; and the ability to return reliably to a "bookmarked" (backed-up) point in the process will certainly save time and frustration.

Your post has been most useful - many thanks for the time and effort.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum