Setting up and maintaining an FTP/HTTP/RSYNC mirror

with NetBSD 8/9


assuming a xen guest with additional drive

newfs -O2 /dev/xbd1a
#-b 64k
vi /etc/fstab

/dev/xbd1a      /tftpboot       ffs  rw      1 2

mount /tftpboot/
df -h

vi .profile


. ./.profile
echo $PKG_PATH
pkg_add -v rsync screen
cp /usr/pkg/share/examples/screen/etcscreenrc /usr/pkg/etc/screenrc
ln -s /usr/pkg/etc/screenrc
vi screenrc

caption always "%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%<"


Get a almost-fresh copy first-shot from your closesd mirror

mkdir -p /tftpboot/pub/NetBSD/
rsync -v -Wartz --delete-after rsync:// /tftpboot/pub/NetBSD/NetBSD-9.0/

then re-sync against the true master based on file size, not timestamp

rsync -Wrltvz --size-only --delete-after rsync:// /tftpboot/pub/NetBSD/NetBSD-9.0/

Ready to go

make sure your system is able to send emails and proceed

crontab -e

50      3       *       *       *       /root/MIRROR

vi /root/MIRROR


/usr/pkg/bin/rsync -Wrltvz --size-only --delete-after \
        rsync:// /tftpboot/pub/NetBSD/NetBSD-9.0/

chmod +x /root/MIRROR

Additional notes

Slackware provides this one:


FTP – see lukemftpd HTTP – see bozohttpd RSYNC – see rsyncd