Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente Dernière révision Les deux révisions suivantes | ||
linux:btrfs [11-06-2017 23:23] edmc73 |
linux:btrfs [21-04-2021 14:45] edmc73 [Passer de ext4 à btrfs] |
||
---|---|---|---|
Ligne 3: | Ligne 3: | ||
===== Description ===== | ===== Description ===== | ||
- | FIXME | ||
Tuto => http:// | Tuto => http:// | ||
+ | Installation | ||
+ | apt install btrfs-tools | ||
===== Commandes ===== | ===== Commandes ===== | ||
Ligne 63: | Ligne 64: | ||
>the checksums, there' | >the checksums, there' | ||
> Hugo. | > Hugo. | ||
+ | |||
+ | ===== Passer de ext4 à btrfs ===== | ||
+ | |||
+ | Dans le cas d'une conversion d'une partition racine, il faudra booter sur un live système. | ||
+ | |||
+ | 1ère vérification, | ||
+ | |||
+ | Avec mount | ||
+ | mount | ||
+ | /dev/sda2 on / type ext4 (rw, | ||
+ | |||
+ | L'UUID | ||
+ | blkid /dev/sda2 | ||
+ | /dev/sda2: UUID=" | ||
+ | |||
+ | On doit le retrouver dans le /etc/fstab | ||
+ | vi /etc/fstab | ||
+ | # <file system> <mount point> | ||
+ | # / was on /dev/sda2 during installation | ||
+ | UUID=3b3f3e41-c1cf-437f-a90f-80aeda99110d / | ||
+ | |||
+ | Lancer la conversion | ||
+ | btrfs-convert /dev/sda2 | ||
+ | |||
+ | Monter le disque pour vérifier que tout s'est bien passé | ||
+ | mount /dev/sda2 / | ||
+ | |||
+ | Si vous constatez des problèmes | ||
+ | umount / | ||
+ | btrfs-convert -r /dev/sda2 | ||
+ | |||
+ | Si tout vous semble ok, supprimez la possibilité de revenir en ext4 afin de ne pas alourdir le système et gagner en performance | ||
+ | rm -fr / | ||
+ | btrfs subvolume delete /ext2_saved | ||
+ | btrfs balance start / | ||
+ | |||
+ | Maintenant, il va falloir mettre à jour votre fstab sinon votre système ne redémarrera pas. | ||
+ | |||
+ | Options de montage | ||
+ | | OPTION DE MONTAGE PROPRES À BTRFS | RÔLE | | ||
+ | | autodefrag | ||
+ | | compress=zlib | La compression la plus importante. Par défaut | | ||
+ | | compress=lzo | La compression la plus rapide | | ||
+ | | compress=no | Pas de compression | | ||
+ | | degraded | Utilisé dans le cas des RAID. Permet de monter le volume même si certains disques sont manquants | | ||
+ | | discard | Utilise le TRIM pour les disques SSD | | ||
+ | | recovery | Lance la réparation automatique après le montage. A utilise si le volume ne veut plus se monter. un fois monté réaliser un scrub pour réparer les erreurs. (Ne fonctionne qu' | ||
+ | | ssd | Utilise l' | ||
+ | | subvol=/ | ||
+ | | subvolid=id | Permet de monter un subvolume par son id. La racine a un id=0 | | ||
+ | |||
+ | Pour un ssd par exemple | ||
+ | mount /dev/sda2 -o rw, | ||
+ | |||
+ | Pour hdd | ||
+ | mount /dev/sda2 -o rw, | ||
+ | |||
+ | Dans un fichier fstab, refaite la commande blkid et mettez à jour votre fstab | ||
+ | UUID=a69d9182-f4c7-4276-b35d-7d5f9bd50a57 | ||
+ | |||
+ | FIXME | ||
+ | |||
+ | Mettre à jour grub | ||
+ | mount /dev/sda2 /mnt | ||
+ | mount /dev/sda1 / | ||
+ | for fs in proc sys dev dev/pts; do mount --bind /$fs /mnt/$fs; done | ||
+ | chroot /mnt | ||
+ | update-initramfs -u -k all | ||
+ | update-grub | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | La suite peut aider mais pas nécessaire normalement. | ||
+ | |||
+ | |||
+ | With Grub Legacy we need to modify root=UUID value in menu.lst file to btrfs partition’s manually. I used the following lines for Grub’s menu.lst file. | ||
+ | |||
+ | title Linux 2.6.32.67 | ||
+ | uuid 89591593-766e-4565-9d5c-017fb0e33298 | ||
+ | kernel | ||
+ | initrd | ||
+ | |||
+ | In this example, a90c79b1-5883-44cc-9e74-752db9ca764d is the UUID of btrfs partition and 89591593-766e-4565-9d5c-017fb0e33298 is UUID of /boot partition. | ||
+ | |||
+ | Also, I used following lines for my /etc/fstab file. | ||
+ | |||
+ | / | ||
+ | / | ||
+ | As you can see, I just wrote a path (/dev/sda1) instead of UUID as described in the referenced site. | ||
+ | |||
+ | Update initrd images | ||
+ | Because some scripts and hooking are added to initramfs, initrd images in /boot directory should be updated. | ||
+ | |||
+ | I could not update them with command (i.e. update-initramfs -u -k all) described in the referenced site. It was guessed due to the kernel version difference between Live USB and my original installation. I designated the kernel version as a parameter like below and it worked. | ||
+ | |||
+ | update-initramfs -u -k 2.6.32.67 | ||
+ | |||
+ | |||
+ | ----------------------- | ||
+ | |||
+ | Si votre grub est coincé au redémarrage | ||
+ | < | ||
+ | grub>ls #pour lister les partition | ||
+ | set root=(hd0, | ||
+ | linux /vmlinuz root=/ | ||
+ | initrd /initrd.img | ||
+ | boot | ||
+ | </ | ||
+ | |||
+ | ensuite, pour réparer grub | ||
+ | update-grub | ||
+ | |||
+ | |||
+ | ===== Scripts tiers ===== | ||
+ | |||
+ | # btrfs-list: a wrapper to btrfs-progs to show a nice overview of your btrfs subvolumes and snapshots, a la 'zfs list' | ||
+ | # | ||
+ | # Check for the latest version at: | ||
+ | # https:// | ||
+ | # git clone https:// | ||
+ | # or wget https:// | ||
+ | # or curl -L https:// | ||
+ |