Differenze tra le versioni di "Installare Arch Linux su ZFS"

Da GolemWiki.
Jump to navigation Jump to search
(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 '''Archiso''' che contiene una serie di script per realizzare supporti per l'installazione.
+
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
  
Start the process:
+
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
  
Embed the archzfs packages into an archiso
 
It is a good idea make an installation media with the needed software included. Otherwise, the latest archiso installation media burned to a CD or a USB key is required.
 
To embed zfs in the archiso, from an existing install, download the archiso package.
 
  
# pacman -S archiso
+
Per aggiungere il supporto allo ZFS occorre:
  
Start the process:
+
* Modificare le seguenti righe al file '''pacman.conf''' di archiso
# cp -r /usr/share/archiso/configs/releng /root/media
+
[demz-repo-core]
 +
SigLevel = Never
 +
Server = http://demizerone.com/$repo/$arch
  
Edit the packages.x86_64 file adding those lines:
+
* 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
  
Edit the pacman.conf file adding those lines (TODO, correctly embed keys in the installation media?):
+
* Lanciare lo script
[demz-repo-core]
+
# ./build.sh -v
SigLevel = Never
+
L'immagine sarà generata nella directory /root/media/out
Server = http://demizerone.com/$repo/$arch
 
  
 +
= Boot col nuovo supporto (CD/USB) =
 +
Effettuare il boot e scegliere l'architettura x86_64, ZFS non è ben supportato su i686.
  
Add other packages in packages.both, packages.i686, or packages.x86_64 if needed and create the image.
+
== SSH ==
# ./build.sh -v
+
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.
The image will be in the /root/media/out directory.
 
 
 
 
 
Boot with the new media.
 
Choose x86_64, I suggest to set a root password, enable ssh daemon and do the install process from another computer so you can easily have paste and copy from this guide.
 
 
 
# systemctl enable sshd.service
 
# systemctl start sshd.service
 
  
 +
# 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
+
= 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

  1. Create a bios_grub partition (type EF02) starting at 1MB with size 64MB. The
  2. 1MB offset is to ensure proper sector alignment for SSD's and other 4k sector drives.
  3. After the utility partition, the rest of the drive is setup for ZFS. Repeat for all
  4. 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


  1. Create a pool:
   $ zpool create rpool sda2
  1. 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
                                            1. $ zfs set canmount=off rpool
   $ zfs create -o mountpoint=legacy rpool/ROOT
   $ zpool set bootfs=rpool/ROOT rpool
   
  1. Now mount the root filesystem in the usual spot:
   $ mount -t zfs rpool/ROOT /mnt


  1. In addition to the root dataset, we'll create several other datasets to help keep things organized.
  2. 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


  1. 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


  1. pacstrap /mnt base base-devel


  1. #
  2. CHROOT #
  3. #
  1. arch-chroot /mnt


  1. zpool set cachefile=/etc/zfs/rpool.cache rpool


I don't have uefi so I install the regular grub

  1. pacman -S grub


                                                    1. DIVERSAMENTE ########################################################
  1. mkdir /boot/EFI
  2. mount /dev/sda1 /boot/EFI
  3. grub-install --target=x86_64-efi --efi-directory=$esp --bootloader-id=grub --recheck --debug
  4. grub-mkconfig -o /boot/grub/grub.cfg


  1. 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

  1. pacman -Sy
  2. pacman -S archzfs


To regenerate the initramfs with the command:

  1. mkinitcpio -p linux
  1. ln -s /usr/share/zoneinfo/Europe/Rome /etc/localtime
  1. 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


  1. grub-mkconfig -o /boot/grub/grub.cfg
  2. grub-install /dev/sda

Add zfs=bootfs to the kernel line of grub.cfg


  1. systemctl enable zfs.service
  1. exit
  2. zfs unmount -a
  3. zfs set mountpoint=/ rpool
  1. cp /etc/zfs/rpool.cache /mnt/etc/zfs/rpool.cache
  1. 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