Differenze tra le versioni di "Installare Arch Linux su ZFS"
(Creata pagina con '= Requisiti = * Un sistema funzionante con Arch Linux x86_64 * Almeno 4 GB di RAM = Installation media = Dato che lo ZFS non è ufficialmente supportato da nessuna distribu...') |
|||
Riga 6: | Riga 6: | ||
= Installation media = | = Installation media = | ||
− | Dato che lo ZFS non è ufficialmente supportato da nessuna distribuzione Linux, tantomento da Arch, sarà necessario realizzare un'immagine live appositamente per questo scopo. | + | Dato che lo ZFS non è ufficialmente supportato da nessuna distribuzione Linux, tantomento da Arch, sarà necessario realizzare un'immagine live creata appositamente per questo scopo. |
== Archiso == | == Archiso == | ||
− | A tale scopo, Arch Linux mette a disposizione un pacchetto denominato | + | A tale scopo, Arch Linux mette a disposizione un pacchetto, denominato [https://wiki.archlinux.org/index.php/Archiso_(Italiano) Archiso], contenente una serie di script per la realizzazione di supporti per l'installazione. |
# pacman -S archiso | # pacman -S archiso | ||
− | + | Copiare il contenuto del pacchetto in una directory di lavoro, es.: ''/root/media'' | |
− | # cp -r /usr/share/archiso/configs/releng /root/media | + | # cp -r /usr/share/archiso/configs/releng /root/media |
− | |||
− | |||
− | |||
− | + | Per aggiungere il supporto allo ZFS occorre: | |
− | + | * Modificare le seguenti righe al file '''pacman.conf''' di archiso | |
− | + | [demz-repo-core] | |
+ | SigLevel = Never | ||
+ | Server = http://demizerone.com/$repo/$arch | ||
− | + | * Aggiungere le seguenti righe al file ''packages.x86_64'' | |
− | spl-utils | + | spl-utils |
− | spl | + | spl |
− | zfs-utils | + | zfs-utils |
− | zfs | + | zfs |
− | net-tools | + | net-tools |
− | + | * Lanciare lo script | |
− | + | # ./build.sh -v | |
− | + | L'immagine sarà generata nella directory /root/media/out | |
− | |||
+ | = Boot col nuovo supporto (CD/USB) = | ||
+ | Effettuare il boot e scegliere l'architettura x86_64, ZFS non è ben supportato su i686. | ||
− | + | == SSH == | |
− | + | Suggerisco di abilitare il demone ssh e di effettuare il processo di installazione collegandosi da un altro computer così da poter facilmente effettuare dei copia ed incolla da questa o altre guide. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | # systemctl enable sshd.service | ||
+ | # systemctl start sshd.service | ||
+ | == Partizionamento == | ||
# Create a bios_grub partition (type EF02) starting at 1MB with size 64MB. The | # Create a bios_grub partition (type EF02) starting at 1MB with size 64MB. The | ||
# 1MB offset is to ensure proper sector alignment for SSD's and other 4k sector drives. | # 1MB offset is to ensure proper sector alignment for SSD's and other 4k sector drives. | ||
Riga 192: | Riga 187: | ||
When running ZFS on root, the machine's hostid will not be available at the time of mounting the root filesystem. There are two solutions to this. You can either place your spl hostid in the kernel parameters in your boot loader. For example, adding spl.spl_hostid=0x00bab10c. | When running ZFS on root, the machine's hostid will not be available at the time of mounting the root filesystem. There are two solutions to this. You can either place your spl hostid in the kernel parameters in your boot loader. For example, adding spl.spl_hostid=0x00bab10c. | ||
The other solution is to make sure that there is a hostid in /etc/hostid, and then regenerate the initramfs image. Which will copy the hostid into the initramfs image. | The other solution is to make sure that there is a hostid in /etc/hostid, and then regenerate the initramfs image. Which will copy the hostid into the initramfs image. | ||
− | # hostid > /etc/hostid | + | # hostid > /etc/hostid |
− | # mkinitcpio -p linux | + | # mkinitcpio -p linux |
+ | |||
+ | = Trucchi = | ||
+ | Limitare l'utilizzo di RAM | ||
+ | # echo "options zfs zfs_arc_max=2147483648" > /etc/modprobe.d/zfs.conf | ||
− | + | = Bibliografia = | |
https://github.com/pendor/gentoo-zfs-install/blob/master/install/GentooInstall.mdown | https://github.com/pendor/gentoo-zfs-install/blob/master/install/GentooInstall.mdown | ||
+ | |||
https://github.com/zfsonlinux/pkg-zfs/wiki/HOWTO-install-Ubuntu-to-a-Native-ZFS-Root-Filesystem | https://github.com/zfsonlinux/pkg-zfs/wiki/HOWTO-install-Ubuntu-to-a-Native-ZFS-Root-Filesystem | ||
+ | |||
http://www.howtoforge.com/a-beginners-guide-to-btrfs | http://www.howtoforge.com/a-beginners-guide-to-btrfs | ||
+ | |||
https://wiki.archlinux.org/index.php/Installing_Arch_Linux_on_ZFS | https://wiki.archlinux.org/index.php/Installing_Arch_Linux_on_ZFS | ||
+ | |||
https://bbs.archlinux.org/viewtopic.php?pid=1365007#p1365007 | https://bbs.archlinux.org/viewtopic.php?pid=1365007#p1365007 |
Versione delle 12:34, 9 feb 2014
Requisiti
- Un sistema funzionante con Arch Linux x86_64
- Almeno 4 GB di RAM
Installation media
Dato che lo ZFS non è ufficialmente supportato da nessuna distribuzione Linux, tantomento da Arch, sarà necessario realizzare un'immagine live creata appositamente per questo scopo.
Archiso
A tale scopo, Arch Linux mette a disposizione un pacchetto, denominato Archiso, contenente una serie di script per la realizzazione di supporti per l'installazione.
# pacman -S archiso
Copiare il contenuto del pacchetto in una directory di lavoro, es.: /root/media
# cp -r /usr/share/archiso/configs/releng /root/media
Per aggiungere il supporto allo ZFS occorre:
- Modificare le seguenti righe al file pacman.conf di archiso
[demz-repo-core] SigLevel = Never Server = http://demizerone.com/$repo/$arch
- Aggiungere le seguenti righe al file packages.x86_64
spl-utils spl zfs-utils zfs net-tools
- Lanciare lo script
# ./build.sh -v
L'immagine sarà generata nella directory /root/media/out
Boot col nuovo supporto (CD/USB)
Effettuare il boot e scegliere l'architettura x86_64, ZFS non è ben supportato su i686.
SSH
Suggerisco di abilitare il demone ssh e di effettuare il processo di installazione collegandosi da un altro computer così da poter facilmente effettuare dei copia ed incolla da questa o altre guide.
# systemctl enable sshd.service # systemctl start sshd.service
Partizionamento
- Create a bios_grub partition (type EF02) starting at 1MB with size 64MB. The
- 1MB offset is to ensure proper sector alignment for SSD's and other 4k sector drives.
- After the utility partition, the rest of the drive is setup for ZFS. Repeat for all
- drives to be used in the pool.
$ sgdisk \ --new=1:2048:133120 --typecode=1:EF02 --change-name=1:"grub" \ --largest-new=2 --typecode=2:BF01 --change-name=2:"zfs" \ /dev/sda
- Create a pool:
$ zpool create rpool sda2
- The zpool will initially be mounted at /rpool, but we need to move it to /mnt/ to work on it
$ zfs unmount rpool $ zfs set mountpoint=/mnt/ rpool
- $ zfs set canmount=off rpool
$ zfs create -o mountpoint=legacy rpool/ROOT $ zpool set bootfs=rpool/ROOT rpool
- Now mount the root filesystem in the usual spot:
$ mount -t zfs rpool/ROOT /mnt
- In addition to the root dataset, we'll create several other datasets to help keep things organized.
- Note that /bin, /boot, /sbin, /etc, /dev, /sys, and /proc must all be in the root dataset, not part of sub-datasets.
$ zfs create rpool/home $ zfs create rpool/usr/src $ zfs create rpool/var $ zfs create rpool/srv
- zpool set cachefile=/etc/zfs/rpool.cache rpool
Copy zpool.cache Now is also a good time to copy over the zpool cache so your initramfs will have access to it.
$ mkdir -p /mnt/etc/zfs $ cp /etc/zfs/rpool.cache /mnt/etc/zfs/rpool.cache
- pacstrap /mnt base base-devel
- #
- CHROOT #
- #
- arch-chroot /mnt
- zpool set cachefile=/etc/zfs/rpool.cache rpool
I don't have uefi so I install the regular grub
- pacman -S grub
- DIVERSAMENTE ########################################################
- mkdir /boot/EFI
- mount /dev/sda1 /boot/EFI
- grub-install --target=x86_64-efi --efi-directory=$esp --bootloader-id=grub --recheck --debug
- grub-mkconfig -o /boot/grub/grub.cfg
- nano /etc/fstab
rpool/ROOT / zfs noatime 0 0
Edit /etc/mkinitcpio.conf and add zfs before filesystems. Also, move keyboard hook before zfs so you can type in console if something goes wrong. Your HOOKS line should look something like this:
HOOKS="base udev autodetect modconf block keyboard zfs filesystems"
Edit the pacman.conf in the chroot adding those lines
[demz-repo-core] Server = http://demizerone.com/$repo/$arch SigLevel = Never
- pacman -Sy
- pacman -S archzfs
To regenerate the initramfs with the command:
- mkinitcpio -p linux
- ln -s /usr/share/zoneinfo/Europe/Rome /etc/localtime
- nano /etc/vconsole.conf
KEYMAP=it
Create Swap (Optional)
Running swap in ZVOL will currently deadlock when the system grows into swap.
If you NEED swap, you must create separate partitions for it and setup mdadm in necessary.
Swap can be run from with the zpool as a zvol:
# Set size as desired. Checksum'ing isn't necessary for swap and turning it off improves performance.
$ zfs create -V 2G rpool/swap $ zfs set checksum=off rpool/swap $ swapon /dev/rpool/swap $ echo "/dev/rpool/swap none swap sw 0 0" >> /mnt/etc/fstab
- grub-mkconfig -o /boot/grub/grub.cfg
- grub-install /dev/sda
Add zfs=bootfs to the kernel line of grub.cfg
- systemctl enable zfs.service
- exit
- zfs unmount -a
- zfs set mountpoint=/ rpool
- cp /etc/zfs/rpool.cache /mnt/etc/zfs/rpool.cache
- zpool export rpool
After the first boot
If everything went fine up to this point, your system will boot. Once. For your system to be able to reboot without issues, you need to enable the zfs service and set the hostid. When running ZFS on root, the machine's hostid will not be available at the time of mounting the root filesystem. There are two solutions to this. You can either place your spl hostid in the kernel parameters in your boot loader. For example, adding spl.spl_hostid=0x00bab10c. The other solution is to make sure that there is a hostid in /etc/hostid, and then regenerate the initramfs image. Which will copy the hostid into the initramfs image.
# hostid > /etc/hostid # mkinitcpio -p linux
Trucchi
Limitare l'utilizzo di RAM
# echo "options zfs zfs_arc_max=2147483648" > /etc/modprobe.d/zfs.conf
Bibliografia
https://github.com/pendor/gentoo-zfs-install/blob/master/install/GentooInstall.mdown
https://github.com/zfsonlinux/pkg-zfs/wiki/HOWTO-install-Ubuntu-to-a-Native-ZFS-Root-Filesystem
http://www.howtoforge.com/a-beginners-guide-to-btrfs
https://wiki.archlinux.org/index.php/Installing_Arch_Linux_on_ZFS
https://bbs.archlinux.org/viewtopic.php?pid=1365007#p1365007