2006-01-30

Using Sparse File for Gentoo Portage

$ cd /usr/portage
$ mv distfiles /home/ftp/gentoo/distfiles
$ mv packages /home/ftp/gentoo/packages

$ dd if=/dev/null of=/.portage.sf bs=1048576 count=0 seek=600

$ mkfs.reiserfs -f /.portage.sf (or mkfs.reiser4)

$ mv /usr/portage /usr/portage.old

$ mount /.portage.sf /usr/portage -o loop,noatime,notail,nodev (reiser4 doesn't need notail)

$ cp -r --no-dereference --preserve=all -T \
    /usr/portage.old /usr/portage/
$ nano -w /etc/fstab
/.portage.sf  /usr/portage     reiserfs  loop,auto,noatime,notail,nodev  0 0
/.ccache.sf   /var/tmp/ccache  reiserfs  loop,auto,noatime,notail,nodev  0 0
$ df && du /.portage.sf
Filesystem           1K-blocks      Used Available Use% Mounted on
/.portage.sf            614376    178632    435744  30% /usr/portage
/.ccache.sf            2097084    498564   1598520  24% /var/tmp/ccache

179344  /.portage.sf
$ mount
/.portage.sf on /usr/portage type reiserfs (rw,nodev,noatime,loop=/dev/loop0,notail)
/.ccache.sf on /var/tmp/ccache type reiserfs (rw,nodev,noatime,loop=/dev/loop1,notail)
The sparse files:
-rw-r--r--  1 root    root    2147483648 2006-02-21 22:24 .ccache.sf
-rw-r--r--  1 root    root     629145600 2006-01-30 14:32 .portage.sf

No comments: