Pi-TV

# Arch Linux, Nginx, Pacman, mount, rsync 2022-01-29

Arch Linux mirror

Make a mirror

Arch repository contains almost all software I need. Its size is about 50GB+ of packages.

Script to make a local mirror:

#!/bin/bash

SOURCE=rsync://mirror.yandex.ru/archlinux
TARGET=/mirror/archlinux

RSYNC_OPTS=(
  --recursive --hard-links --safe-links --copy-links --times --delete-after --delay-updates
  --info=progress2
  --filter="merge archlinux-filter.lst"
  --dry-run --stats --human-readable
)

rsync "${RSYNC_OPTS[@]}" $SOURCE/core $TARGET
rsync "${RSYNC_OPTS[@]}" $SOURCE/extra $TARGET
rsync "${RSYNC_OPTS[@]}" $SOURCE/community $TARGET
rsync "${RSYNC_OPTS[@]}" $SOURCE/iso $TARGET

But Arch repository has tons of garbage (some ugly packages like “kea-devel-docs” or national translations). See Disk usage section. They can be excluded from mirroring using “–filter” option and this “archlinux-filter.lst” file with includes and excludes for rsync:

- /community/os/x86_64/kea-devel-docs-*

+ /community/os/x86_64/firefox-developer-edition-i18n-en-us-*
- /community/os/x86_64/firefox-developer-edition-i18n-*
+ /community/os/x86_64/gimp-help-en-*
- /community/os/x86_64/gimp-help-*

+ /extra/os/x86_64/firefox-i18n-en-us-*
- /extra/os/x86_64/firefox-i18n-*
+ /extra/os/x86_64/libreoffice-fresh-en-*
- /extra/os/x86_64/libreoffice-fresh-[a-z]*
+ /extra/os/x86_64/libreoffice-still-en-*
- /extra/os/x86_64/libreoffice-still-[a-z]*
+ /extra/os/x86_64/thunderbird-i18n-en-us-*
- /extra/os/x86_64/thunderbird-i18n-*
+ /extra/os/x86_64/vim-spell-en-*
- /extra/os/x86_64/vim-spell-*

+ /iso/latest
+ /iso/latest/*
- /iso/**

Use the mirror via a local filesystem

Set Server=file:///mirror/archlinux/$repo/os/$arch into the “/etc/pacman.d/mirrorlist”.

Personally I keep the mirror on a separate disk (“/dev/sdc”), so I mount it as read-only:

Use the mirror via a local webserver

    location /mirror/archlinux/ {
        alias /mirror/archlinux/;
        autoindex on;
        expires max;
    }

Set Server=http://localhost/mirror/archlinux/$repo/os/$arch into the “/etc/pacman.d/mirrorlist”.

Mirror disk usage

Originally the mirror spends 57.9GB of disk space:

But with the specified includes/excludes it spends a bit less, 54.86GB: