bootstraponline.sh (FreeBSD root-on-zfs bootstrap script)
This commit is contained in:
parent
64f52f3e81
commit
88f055716e
2 changed files with 43 additions and 0 deletions
|
@ -7,6 +7,7 @@ Scripts
|
|||
-------
|
||||
|
||||
* [backupnaz.sh](https://forge.tourmentine.com/n/scripts/src/master/backupnaz.sh) => used to backup my NAS
|
||||
* [bootstraponline.sh](https://forge.tourmentine.com/n/scripts/src/master/bootstraponline.sh) => create a root-on-zfs FreeBSD server. can be used on Scaleway/Online, using this [howto](https://loicpefferkorn.net/2015/10/freebsd-10.2-release-on-a-dedibox-xc-server-online.net-with-root-on-zfs/)
|
||||
* [cleanmaildir.sh](https://forge.tourmentine.com/n/scripts/src/master/cleanmaildir.sh) => delete old mail in maildirs
|
||||
* [dodo.sh](https://forge.tourmentine.com/n/scripts/src/master/dodo.sh) => turn off screen using DPMS
|
||||
* [dump_mysql.sh](https://forge.tourmentine.com/n/scripts/src/master/dump_mysql.sh) => dump all mysql databases (and send a report to the monitoring system)
|
||||
|
|
42
bootstraponline.sh
Normal file
42
bootstraponline.sh
Normal file
|
@ -0,0 +1,42 @@
|
|||
gpart destroy -F ada0
|
||||
gpart create -s gpt ada0
|
||||
gpart add -s 222 -a 4k -t freebsd-boot -l boot0 ada0
|
||||
gpart add -s 2g -a 4k -t freebsd-swap -l swap0 ada0
|
||||
gpart add -s 25g -a 4k -t freebsd-zfs -l disk0 ada0
|
||||
#gpart add -a 4k -t freebsd-zfs -l disk0 ada0
|
||||
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0
|
||||
|
||||
zpool create -o altroot=/mnt -O canmount=off -m none zroot /dev/gpt/disk0
|
||||
|
||||
zfs set checksum=fletcher4 zroot
|
||||
zfs set atime=off zroot
|
||||
zfs create -o mountpoint=none zroot/ROOT
|
||||
zfs create -o mountpoint=/ zroot/ROOT/default
|
||||
zfs create -o mountpoint=/tmp -o compression=lz4 -o setuid=off zroot/tmp
|
||||
chmod 1777 /mnt/tmp
|
||||
|
||||
zfs create -o mountpoint=/usr zroot/usr
|
||||
zfs create zroot/usr/local
|
||||
zfs create -o mountpoint=/home -o setuid=off zroot/home
|
||||
zfs create -o compression=lz4 -o setuid=off zroot/usr/ports
|
||||
zfs create -o compression=off -o exec=off -o setuid=off zroot/usr/ports/distfiles
|
||||
zfs create -o compression=off -o exec=off -o setuid=off zroot/usr/ports/packages
|
||||
zfs create -o compression=lz4 -o exec=off -o setuid=off zroot/usr/src
|
||||
zfs create zroot/usr/obj
|
||||
zfs create -o mountpoint=/var zroot/var
|
||||
zfs create -o compression=lz4 -o exec=off -o setuid=off zroot/var/crash
|
||||
zfs create -o exec=off -o setuid=off zroot/var/db
|
||||
zfs create -o compression=lz4 -o exec=on -o setuid=off zroot/var/db/pkg
|
||||
zfs create -o exec=off -o setuid=off zroot/var/empty
|
||||
zfs create -o compression=lz4 -o exec=off -o setuid=off zroot/var/log
|
||||
zfs create -o compression=gzip -o exec=off -o setuid=off zroot/var/mail
|
||||
zfs create -o exec=off -o setuid=off zroot/var/run
|
||||
zfs create -o compression=lz4 -o exec=on -o setuid=off zroot/var/tmp
|
||||
chmod 1777 /mnt/var/tmp
|
||||
|
||||
zpool set bootfs=zroot/ROOT/default zroot
|
||||
|
||||
cat << EOF > /tmp/bsdinstall_etc/fstab
|
||||
# Device Mountpoint FStype Options Dump Pass#
|
||||
/dev/gpt/swap0 none swap sw 0 0
|
||||
EOF
|
Loading…
Reference in a new issue