Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
putting /usr/portage into its own BTRFS file
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3922
Location: Hamburg

PostPosted: Sun Feb 16, 2014 10:47 am    Post subject: putting /usr/portage into its own BTRFS file Reply with quote

Inspired by http://blogs.gentoo.org/mgorny/2014/02/06/using-deltas-to-speed-up-squashfs-updates/ I created a 1.5 GB file /var/lib/portage.fs
Code:
dd if=/dev/zero of=/var/lib/portage.fs bs=1024 count=1500K
mkfs.btrfs /var/lib/portage.fs
with BTRFS and moved all directories of /usr/portage/* into it. Before I moved ./distfiles out to /var/lib and symlinked it back afterwards:
Code:
mv /usr/portage/distfiles /var/lib/ && ln -s /var/lib/distfiles /usr/portage/
With the following entry in /etc/fstab :
Code:
/var/lib/portage.fs /usr/portage btrfs auto,noatime,compress=lzo
the portage directory is mounted automatically.

Advantage: a huge speed up in the rsync process for my very slow external hard disk.
Update: added used commands/Update


Last edited by toralf on Mon Feb 17, 2014 9:31 pm; edited 2 times in total
Back to top
View user's profile Send private message
dambacher
Apprentice
Apprentice


Joined: 11 Feb 2003
Posts: 289
Location: Germany

PostPosted: Sun Feb 16, 2014 1:27 pm    Post subject: Reply with quote

I put everything about portage and layman to /pkg
wich is on an extra subvolume.
And I removed everything from the the original places, without leaving links and set in make.conf:
Code:
# install my portage and layman files to /pkg
PORTDIR="/pkg/portage"
DISTDIR="/pkg/distfiles"
PKGDIR="/pkg/packages"

PORTDIR_OVERLAY="
/pkg/overlays/gentoo-ulda
$PORTDIR_OVERLAY
"
source /pkg/layman/make.conf

and layman.conf:
Code:
storage   : /pkg/layman
Back to top
View user's profile Send private message
kernelOfTruth
Watchman
Watchman


Joined: 20 Dec 2005
Posts: 6111
Location: Vienna, Austria; Germany; hello world :)

PostPosted: Mon Feb 17, 2014 4:51 pm    Post subject: Reply with quote

*subscribed*

this is probably even better than using a separate partition for it


thanks !
_________________
https://github.com/kernelOfTruth/ZFS-for-SystemRescueCD/tree/ZFS-for-SysRescCD-4.9.0
https://github.com/kernelOfTruth/pulseaudio-equalizer-ladspa

Hardcore Gentoo Linux user since 2004 :D
Back to top
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3922
Location: Hamburg

PostPosted: Mon Feb 17, 2014 8:02 pm    Post subject: Reply with quote

FWIW it is important to mount the BTRFS file with option compres=... before you move the data. Then the effect of the compression is maximal as seen here :
Code:
# df -m
Filesystem     1M-blocks  Used Available Use% Mounted on
...
/dev/loop1           400    63       334  16% /var/db/pkg
/dev/loop0          1500   571       736  44% /usr/portage

# du -ms /usr/portage/
724     /usr/portage/

# du -ms /var/db/pkg
182     /var/db/pkg

And of course /var/tmp/portage is on a tmpfs :
Code:
# grep /var/tmp/portage /etc/fstab
tmpfs                   /var/tmp/portage        tmpfs   auto,noatime,size=4G
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10587
Location: Somewhere over Atlanta, Georgia

PostPosted: Mon Feb 17, 2014 9:21 pm    Post subject: Reply with quote

Moved from Installing Gentoo to Documentation, Tips & Tricks. I think this is worthy of preserving where it won't get lost in the chaff. Might even deserve a sticky. :)

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks 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