Outils pour utilisateurs

Outils du site


linux:btrfs (lu 11025 fois)

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
linux:btrfs [21-10-2018 11:40]
edmc73 [Description]
linux:btrfs [28-04-2021 16:16] (Version actuelle)
edmc73
Ligne 119: Ligne 119:
  
 Pour hdd Pour hdd
-  mount /dev/sda2 -o rw,noatime,compress=zlib,autodefrag+  mount /dev/sda2 -o rw,noatime,compress=lzo,autodefrag
  
 Dans un fichier fstab, refaite la commande blkid et mettez à jour votre fstab Dans un fichier fstab, refaite la commande blkid et mettez à jour votre fstab
   UUID=a69d9182-f4c7-4276-b35d-7d5f9bd50a57      /      btrfs      rw,noatime,ssd,discard,autodefrag,compress=lzo      0      0   UUID=a69d9182-f4c7-4276-b35d-7d5f9bd50a57      /      btrfs      rw,noatime,ssd,discard,autodefrag,compress=lzo      0      0
  
 +FIXME
  
 +Mettre à jour grub
 +  mount /dev/sda2 /mnt
 +  mount /dev/sda1 /mnt/boot/efi
 +  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      /vmlinuz-2.6.32.67 root=UUID=a90c79b1-5883-44cc-9e74-752db9ca764d ro
 +  initrd      /initrd.img-2.6.32.67
 +
 +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.
 +
 +  /dev/sda3       /boot       ext4     defaults               
 +  /dev/sda1       /           btrfs    defaults        0       1
 +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
 +<code>
 +grub>ls #pour lister les partition
 +set root=(hd0,gpt2) # faite TAB en cours de frappe montre pas mal d'info sur la partition à choisir)
 +linux /vmlinuz root=/dev/sda2 ro
 +initrd /initrd.img
 +boot
 +</code>
 +
 +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://github.com/speed47/btrfs-list
 +  # git clone https://github.com/speed47/btrfs-list.git
 +  # or wget https://raw.githubusercontent.com/speed47/btrfs-list/master/btrfs-list -O btrfs-list
 +  # or curl -L https://raw.githubusercontent.com/speed47/btrfs-list/master/btrfs-list -o btrfs-list
 +
 +===== io disk =====
 +
 +-- source: https://kinvolk.io/docs/flatcar-container-linux/latest/setup/debug/btrfs-troubleshooting/
 +
 +Disable copy-on-write
 +
 +Copy-On-write isn’t ideal for workloads that create or modify many small files, such as databases. Without disabling COW, you can heavily fragment the file system as explained above.
 +
 +The best strategy for successfully running a database in a container is to disable COW on directory/volume that is mounted into the container.
 +
 +The COW setting is stored as a file attribute and is modified with a utility called chattr. To disable COW for a MySQL container’s volume, run:
 +
 +  chattr -R +C /var/lib/mysql
 +  
 +The directory /var/lib/mysql is now ready to be used by a Docker container without COW. Let’s break down the command:
 +
 +-R indicates that want to recursively change the file attribute +C means we want to set the NOCOW attribute on the file/directory
 +
 +To verify, we can run:
 +
 +<code>
 +$ lsattr /var/lib/
 +---------------- /var/lib/portage
 +---------------- /var/lib/gentoo
 +---------------- /var/lib/iptables
 +---------------- /var/lib/ip6tables
 +---------------- /var/lib/arpd
 +---------------- /var/lib/ipset
 +---------------- /var/lib/dbus
 +---------------- /var/lib/systemd
 +---------------- /var/lib/polkit-1
 +---------------- /var/lib/dhcpcd
 +---------------- /var/lib/ntp
 +---------------- /var/lib/nfs
 +---------------- /var/lib/etcd
 +---------------- /var/lib/docker
 +---------------- /var/lib/update_engine
 +---------------C /var/lib/mysql
 +</code>
linux/btrfs.1540114828.txt.gz · Dernière modification: 21-10-2018 11:40 de edmc73