Re: Making a partition larger without affecting my OS.

Dale <[email protected]>
Newsgroups gmane.linux.gentoo.user
Message-ID <[email protected]>
On 3/16/26 10:18 AM, Dave Sizer wrote:
> Thank you Dale, that insight is really helpful!
>
> On Sun, 15 Mar 2026, Dale wrote:
>
> [...]
>> I copy the binaries over and emerge those, no compiling for those.  This
>> way my updates are only going to be out of sync version wise for maybe
>> 20 to 30 minutes or even less in a lot of cases.  Usually when I start
>> emerging the binaries, I start closing programs so that I can logout and
>> back in anyway.  It takes me a few minutes to close certain things and
>> make notes of something I need to get back to when I log back in.
> Is there any doc or anything about how to emerge the binaries that were
> built in the chroot? Or would you mind giving me a quick writeup of the
> commands you use? Mostly curiosity, I'm always trying to learn more about
> the interals of Gentoo :)
>
> - Dave
>


I just copy the packages from the chroot to my main OS install. Then 
within my main install, I do a emerge -aukDN world.  It finds the 
binaries I copied over and emerges them.  I'm attaching the scripts I 
use to do some of this.

I first run eix-sync on my main OS and while that is updating, I run the 
mount script.  It's a lot like you do when doing a fresh install or 
rescue of Gentoo.  Once eix-sync is done, I run emerge -auDN world and 
see if it looks OK.  If needed, I change USE flags, keyword packages etc 
until I get a update that works for me.  Then I run the rsync-build 
script.  That duplicates my OS including the new tree, and changes in 
/etc and such.  While that is working, I chroot into the copy of my OS.  
Make sure to update the environment.  I use the command "source 
/etc/profile && env-update && export PS1="(chroot) ${PS1}"" which is 
usually in bash history and I can up arrow to.  One could put it in a 
script as well.  Once that is done, I run emerge -auDN world in the 
chroot OS which should match the main OS output.  Once it is done, I 
copy the packages over to the main install with the packages script.  
Note there is a line at the bottom that I can copy and paste to move the 
emerge.log file over later after emerging the binaries.  This keeps the 
compile times for genlop -c in tact and removes the binaries installs 
which throw genlop -c off.  It really throws off the times of large 
packages like qtwebengine, libreoffice etc.  Once the packages are 
copied to the main OS, I then go back to the main OS and run emerge 
-aukDN world.  At the bottom, it should show the same number for 
packages to update and ones being done as binaries.  On occasion, some 
packages won't build in a chroot because of /boot not being mounted 
correctly etc.  Those I usually do manually with a -B option on the main 
OS.  Once the binaries have emerged, I copy the emerge.log file over and 
then run the unmount command.

Don't forget, run depclean to clean out any unneeded packages as well.

The list is like this.  I hope I don't forget anything.

Main OS.  eix-sync && emerge -auDN world
the mount command

After checking the output and making changes,

rsync-build script.

Then I chroot in and update the environment.

source /etc/profile && env-update && export PS1="(chroot) ${PS1}"

then

emerge -auDN world within the chroot.

When finished, packages script.

Back to the main OS.

emerge -aukDN world

Check output and let it update.  Once it is done, I copy the emerge.log 
file over.

rsync -av --progress /mnt/build-sys/var/log/emerge.log /var/log/

Then run depclean.

emerge -a --depclean

While that is thinking, I unmount by running the unmount script.

When all this is done, I run eclean and clear out tmpfs as well. That 
prevents build up of things that are not needed.

Also, I do this in a Konsole, within KDE.  Switching from the main OS to 
the chroot is as simple as switching tabs.  It's also why I change the 
prompt to show it is a chroot.  To make sure I don't type something in 
the wrong place.  I'm sure there are other similar tools one could use 
to do this that are just as easy.

It sounds like a lot but it really isn't.  The scripts do most of the 
work.  The biggest thing is doing the chroot and copying the stuff back 
and forth.  Oh, if you mess up up the main OS somehow, you might be able 
to copy the build environment over as a rescue. They should match each 
other.

Again, I started doing this because of crashes and such when updates 
took a long time to complete.  The only problem I've ran into in the 
meantime is a update to Firefox and it wants to restart before opening a 
new tab.  No more crashes and such.  Some may think this is not needed 
and if that is the case, then they don't have to use it.  However, if 
you do updates in the background that causes data loss or something, it 
makes you want to find a way to prevent that. This is the way I came up 
with.  So far, no problems.

If something doesn't sound right, ask.  I sometimes forget things. :/

Dale

:-)  :-)
gentoo-mount (text/plain, 542 B)
mount /dev/nvme0n1p5 /mnt/build-sys
mount --types proc /proc /mnt/build-sys/proc/
mount --rbind /sys /mnt/build-sys/sys/
mount --rbind /dev /mnt/build-sys/dev/
#mount -t tmpfs tmpfs /mnt/build-sys/var/tmp/portage/
mount -t tmpfs -o size=70G tmpfs /mnt/build-sys/var/tmp/portage/
#mount -t tmpfs /run /mnt/build-sys/run


#mount --make-rslave /mnt/build-sys/sys  systemd stuff
#mount --make-rslave /mnt/build-sys/dev  systemd stuff
mount --bind /run /mnt/build-sys/run
#mount --make-slave /mnt/build-sys/run  systemd stuff

mount | grep build
gentoo-packages (text/plain, 500 B)
#!/bin/sh
RED='\033[0;31m'
NC='\033[0m' # No Color
###printf "I ${RED}love${NC} Stack Overflow\n"


rsync -auv --progress /mnt/build-sys/var/cache/portage/* /var/cache/portage/

#rsync -av --progress --delete /mnt/build-sys/var/cache/portage/distfiles/* /var/cache/portage/distfiles/

# rsync -av --progress /mnt/build-sys/var/log/emerge.log /var/log/

echo -e "${RED}Run this after binaries are installed${NC}"
echo -e "${RED}rsync -av --progress /mnt/build-sys/var/log/emerge.log /var/log/${NC}"
gentoo-rsync-build (text/plain, 1.7 KB)
RED='\033[0;31m'
NC='\033[0m' # No Color
echo -e "${RED}bin sync${NC}"
rsync -alv --progress --delete /bin /mnt/build-sys/

echo -e "${RED}boot sync${NC}"
rsync -alv --progress --delete /boot /mnt/build-sys/

echo -e "${RED}etc sync${NC}"
rsync -alv --progress --delete /etc /mnt/build-sys/

echo -e "${RED}lib sync${NC}"
rsync -alv --progress --delete /lib /mnt/build-sys/

echo -e "${RED}lib64 sync${NC}"
rsync -alv --progress --delete /lib64 /mnt/build-sys/

echo -e "${RED}opt sync${NC}"
rsync -alv --progress --delete /opt /mnt/build-sys/

echo -e "${RED}run sync${NC}"
rsync -alv --progress --delete /run /mnt/build-sys

echo -e "${RED}sbin sync${NC}"
rsync -alv --progress --delete /sbin /mnt/build-sys/

echo -e "${RED}usr sync${NC}"
rsync -alv --progress --delete /usr /mnt/build-sys/

echo -e "${RED}var sync${NC}"
#rsync -alv --progress --delete  --exclude log/emerge.log --exclude cache/portage/packages /var /mnt/build-sys/
#rsync -alv --progress --delete --exclude cache/portage/packages --exclude log/emerge.log /var /mnt/build-sys/
#
# rsync -alv --progress /var/log/emerge.log /mnt/build-sys/var/log/
#
rsync -alv --progress --delete --exclude cache/portage/packages   /var /mnt/build-sys/
echo "Sync done" 


#rsync -alv --progress --delete /etc/portage /mnt/build-sys/etc/
# DO NOT USE THIS!!! sync tree only  #  rsync -av --progress --delete  /var/cache/portage/tree/* /mnt/build-sys/var/cache/portage/tree/
# sync tree only old system.  Updates tree from OS to chroot.  #  rsync -av --progress --delete  /var/db/repos/gentoo/ /mnt/build-sys/var/db/repos/gentoo
# sync tree only NEW system.  Updates tree from chroot to OS.  #  rsync -av --progress --delete  /mnt/build-sys/var/db/repos/gentoo/ /var/db/repos/gentoo
gentoo-unmount (text/plain, 317 B)
umount /mnt/build-sys/dev/shm
umount /mnt/build-sys/dev/pts
umount /mnt/build-sys/dev/mqueue
umount /mnt/build-sys/dev
umount /mnt/build-sys/var/tmp/portage/
umount -R /mnt/build-sys
#umount /mnt/build-sys/var/tmp/portage/
#umount -R /mnt/build-sys/*
echo "unmount grep gentoo-build"
mount | grep build

echo "Done"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.