cut the ramdisk size

This commit is contained in:
HugoPoi 2020-10-24 13:58:33 +02:00
parent 6e7d82884e
commit 432fe563c3
2 changed files with 22 additions and 11 deletions

20
exclude.list Normal file
View File

@ -0,0 +1,20 @@
/dev/*
/run/*
/sys/*
/proc/*
/tmp/*
/var/tmp/*
/var/lib/apt/*
/var/lib/dpkg/*
/var/run/*
/var/cache/*
/boot/*
/usr/lib/modules/*
/usr/lib/python*
/usr/lib/*-linux-gnu/perl*
/usr/share/GeoIP*
/usr/share/man*
/usr/share/i18n*
/usr/share/perl*
/usr/share/doc*
/usr/share/locale*

View File

@ -7,23 +7,14 @@ mkdir /tmp/sys
sudo mount /dev/zram0 /tmp/sys sudo mount /dev/zram0 /tmp/sys
sudo tar -cpSf - \ sudo tar -cpSf - \
--acls --xattrs --selinux \ --acls --xattrs --selinux \
--exclude '/dev/*' \ --exclude-from /vagrant/exclude.list \
--exclude '/run/*' \
--exclude '/sys/*' \
--exclude '/proc/*' \
--exclude '/tmp/*' \
--exclude '/var/tmp/*' \
--exclude '/var/lib/apt/*' \
--exclude '/var/lib/dpkg/*' \
--exclude '/var/run/*' \
--exclude '/boot/*' \
/ | / |
sudo tar -xvf - \ sudo tar -xvf - \
--acls --xattrs --selinux \ --acls --xattrs --selinux \
-C /tmp/sys -C /tmp/sys
sudo truncate -s0 /tmp/sys/etc/fstab sudo truncate -s0 /tmp/sys/etc/fstab
sudo swapoff -a sudo swapoff -a
sudo mkdir /sysroot sudo mkdir -p /sysroot
sudo mount --rbind /tmp/sys /sysroot sudo mount --rbind /tmp/sys /sysroot
sudo touch /etc/initrd-release sudo touch /etc/initrd-release