Tin*_*ank 5 zfsonlinux hetzner ubuntu-16.04
到目前为止,很可能让 Ubuntu 16.04 在 ZFS root-fs 上运行。Ubuntu的16.04已在默认的包管理ZFS,并与像导游这样,它并不难上手。
但是,我见过的所有指南都要求能够从 Ubuntu 安装映像启动。对于 Hetzner 专用服务器,这是一个不常见的安装过程,因为它需要工程师访问服务器并插入远程 KVM。
默认情况下,专用服务器启动进入救援系统,该系统允许通过其“installiamge”脚本安装各种 Linux 发行版。但是,此脚本尚不支持 ZFS。
如何让 Hetzner 专用服务器在 ZFS 根目录上运行?
Tin*_*ank 10
基本思想是将 Ubuntu 安装在硬盘上的一个小分区上,将硬盘分区以使用 ZFS 的剩余空间,然后将安装复制过来。我主要使用本指南来说明如何做到这一点。
懒惰,并且有 Ansible 的经验?我编写了一些脚本来自动执行这些步骤。它们位于:https : //github.com/tijszwinkels/hetzner-ubuntu-16.04-zfs-root-ansible/blob/master/hetzner-ubuntu-16.04.yml 注意,这些脚本假设主机被引导到Hetzner 救援系统,作为第一步,他们将擦除您的驱动器。使用风险自负!
# SSH into the host.
# Wipe the drives. Assuming SSDs on 'sda' and 'sdb'.
/sbin/blkdiscard /dev/sda
/sbin/blkdiscard /dev/sdb
# Install Ubuntu 16.04 on a 4G partition using the Hetzner 'installimage' script
/root/.oldroot/nfs/install/installimage -a -n my-hostname -r yes -l 1 -p /:ext4:4G -K /root/.ssh/robot_user_keys -i /root/.oldroot/nfs/install/../images/Ubuntu-1604-xenial-64-minimal.tar.gz
# Reboot the system.
/sbin/shutdown -r now
# Wait for the host to come back up, and SSH in.
# Install the 'parted' parition editor
apt-get update && apt-get install -y parted
# Run parted on the first drive, create a partition in all remaining space. (UNTESTED!)
sudo parted /dev/sda
(parted) mkpart primary 4097MB -1s
(parted) quit
# Run parted on the second drive, create a partition in all remaining space. (UNTESTED!)
sudo parted /dev/sdb
(parted) mkpart primary 4097MB -1s
(parted) quit
# Install required ZFS packages
apt-get install -y zfs-dkms zfs-initramfs
# Create a ZFS pool named 'tank'
# Please note that I'm using the /dev/disk/by-id interface. This is more resilient than /dev/sda and /dev/sdb
zpool create -f -o ashift=13 -O atime=off -O dedup=off -O compression=lz4 tank mirror `ls /dev/disk/by-id/ata-*-part2`
# Create OS partiton
zfs create tank/os
# Rsync the current system to the new partition.
rsync -a --one-file-system / /tank/os/
# Chroot into the system
cd /tank/os
mount --bind /dev dev
mount --bind /proc proc
mount --bind /sys sys
mount --bind /run run
chroot .
# Install GRUB into the drives
export ZPOOL_VDEV_NAME_PATH=YES
update-grub
grub-install /dev/sda
grub-install /dev/sdb
Run Code Online (Sandbox Code Playgroud)
现在,您应该拥有一个 Hetzner 专用服务器,它可以使用 ZFS 根 fs 愉快地启动到 Ubuntu 16.04。祝你好运!
| 归档时间: |
|
| 查看次数: |
3604 次 |
| 最近记录: |