all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* btrfs raid configuration vs mdraid
@ 2019-05-16  6:00 Giovanni Biscuolo
  2019-05-20 19:59 ` Fredrik Salomonsson
  0 siblings, 1 reply; 4+ messages in thread
From: Giovanni Biscuolo @ 2019-05-16  6:00 UTC (permalink / raw)
  To: help-guix

[-- Attachment #1: Type: text/plain, Size: 680 bytes --]

Hello Guix!

My preferred storage setup until now was using RAID-1 software RAID
built with mdadm; for a new machine I'm considering setting up a RAID-1
btrfs volume as root, but I have much less experience with btrfs

Assuming I'm going to format the root filesystem as:

  mkfs.btrfs -m raid1 -d raid1 /dev/sda3 /dev/sdb3

how should I configure (file-system...)? this way:

(file-system
  (mount-point "/")
  (type "btrfs")
  (device (uuid "4dab5feb-d176-45de-b287-9b0a6e4c01cb")))

with UUID taken from "lsblk -f"?

From you experience is RAID on brtfs as solid as the one on mdadm?

Thanks!
Gio'.

-- 
Giovanni Biscuolo

Xelera IT Infrastructures

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: btrfs raid configuration vs mdraid
  2019-05-16  6:00 btrfs raid configuration vs mdraid Giovanni Biscuolo
@ 2019-05-20 19:59 ` Fredrik Salomonsson
  2019-05-21  8:25   ` Giovanni Biscuolo
  0 siblings, 1 reply; 4+ messages in thread
From: Fredrik Salomonsson @ 2019-05-20 19:59 UTC (permalink / raw)
  To: Giovanni Biscuolo, help-guix

[-- Attachment #1: Type: text/plain, Size: 1419 bytes --]


Hi Giovanni,

Giovanni Biscuolo <g@xelera.eu> writes:

> Hello Guix!
>
> My preferred storage setup until now was using RAID-1 software RAID
> built with mdadm; for a new machine I'm considering setting up a RAID-1
> btrfs volume as root, but I have much less experience with btrfs
>
> Assuming I'm going to format the root filesystem as:
>
>   mkfs.btrfs -m raid1 -d raid1 /dev/sda3 /dev/sdb3
>
> how should I configure (file-system...)? this way:
>
> (file-system
>   (mount-point "/")
>   (type "btrfs")
>   (device (uuid "4dab5feb-d176-45de-b287-9b0a6e4c01cb")))
>
> with UUID taken from "lsblk -f"?

That should work. Creating a label will also work and might be easier to
handle as you won't need to update the config file incase you reformat your
disks. One thing you should note is that guix might generate incorrect
paths for grub if you are using subvolumes. At least guix < 1.0 does
that for me, haven't tested 1.0+ yet. But I have been using a shell
script that works around that issue.

> From you experience is RAID on brtfs as solid as the one on mdadm?

I have very little experience with mdadm, so can only speak of my
experience with btrfs and RAID-1. Which I have been using for 3+ years.
For me it has been solid. Only issue I have encountered was when my
fileserver lost power a few times leaving the filesystem corrupt. A
"btrfs check --repair" fixed that issue.

--
s/Fred[re]+i[ck]+/Fredrik/g


[-- Attachment #2: Script for fixing broken paths in grub after guix reconfigure --]
[-- Type: application/x-sh, Size: 152 bytes --]

[-- Attachment #3: Guix configuration --]
[-- Type: text, Size: 6275 bytes --]

;; This is an operating system configuration template
;; for a "desktop" setup without full-blown desktop
;; environments.

(use-modules (gnu)
             (gnu packages)
             (gnu system nss)
             (gnu system locale)
             (gnu services nfs)
             (ice-9 rdelim)
             (ice-9 format))
(use-service-modules desktop networking ssh base xorg)
(use-package-modules wm certs shells xdisorg)

(define plattfot
  (user-account
   (name "plattfot")
   (group "users")
   ;; Define a G-Expr to find the path of the zsh binary:
   ;; https://gitlab.com/rain1/guix-wiki/wikis/FAQ#how-do-i-make-my-login-shell-zsh
   ;;(shell #~(string-append #$zsh "/bin/zsh"))
   (supplementary-groups '("wheel" "netdev" "audio" "video"))
   (home-directory "/home/plattfot")))

;; Specify a mapped device for the encrypted root partition.
;; The UUID is that returned by 'cryptsetup luksUUID'.
(define mapped-root
  (mapped-device
   (source (uuid "ab43f8be-1a18-4999-836d-71dac382dfb5"))
   (target "root")
   (type luks-device-mapping)))

(define mapped-swap
  (mapped-device
   (source (uuid "9f04f917-efd3-4036-b3f5-24705fee7ffa"))
   (target "swap")
   (type luks-device-mapping)))

;; Partion layout for /dev/mapper/root
;; under __current/
;; | subvol      | Mountpoint   | Comment            | Shared   |
;; |-------------+--------------+--------------------+----------|
;; | arch-root   | /            | root for Arch      | no       |
;; | guixsd-root | /            | root for GuixSD    | no       |
;; | grub        | /boot/grub   | grub config        | yes      |
;; | guix        | /var/guix    | guix stuff         | yes      |
;; | gnu         | /gnu         | Store etc          | yes      |
;; | home        | /home        | home partition     | yes      |

(define btrfs-common-options
  '("defaults" "discard" "compress=lzo" "space_cache" "autodefrag"))

(define (btrfs-mount-options subvol)
  "Return the btrfs mount options I use.
       Where SUBVOL is the subvolume to mount"
  (string-join `(,@btrfs-common-options ,(format #f "subvol=~a" subvol)) ","))

(define fs-root
  (file-system
   (mount-point "/")
   (type "btrfs")
   (device (file-system-label "root"))
   (options (btrfs-mount-options "__current/guixsd-root"))
   (needed-for-boot? #t)
   (dependencies `(,mapped-root))))

(define fs-grub
  (file-system
   (mount-point "/boot/grub")
   (type "btrfs")
   (device (file-system-label "root"))
   (options (btrfs-mount-options "__current/grub"))
   (needed-for-boot? #t)
   (dependencies `(,fs-root))))

(define fs-gnu
  (file-system
   (mount-point "/gnu")
   (type "btrfs")
   (device (file-system-label "root"))
   (options (btrfs-mount-options "__current/gnu"))
   (needed-for-boot? #t)
   (dependencies `(,fs-root))))

(define fs-guix
  (file-system
   (mount-point "/var/guix")
   (type "btrfs")
   (device (file-system-label "root"))
   (options (btrfs-mount-options "__current/guix"))
   (needed-for-boot? #t)
   (dependencies `(,fs-root))))

(define fs-home
  (file-system
   (mount-point "/home")
   (type "btrfs")
   (device (file-system-label "root"))
   (options (btrfs-mount-options "__current/home"))
   (needed-for-boot? #t)
   (dependencies `(,fs-root))))

(define nfs-valhalla
  (file-system
   (device "fafner:/srv/nfs4/Valhalla")
   (mount-point "/media/Valhalla")
   (type "nfs4")
   (mount? #f)
   (check? #f)))

(define menu-arch
  (menu-entry
   (label "Arch Linux")
   (linux "/__current/arch-root/boot/vmlinuz-linux")
   (linux-arguments
    '("luks.uuid=ab43f8be-1a18-4999-836d-71dac382dfb5"
      "luks.name=ab43f8be-1a18-4999-836d-71dac382dfb5=root"
      "luks.key=ab43f8be-1a18-4999-836d-71dac382dfb5=/boot/rootkey.bin"
      "luks.options=ab43f8be-1a18-4999-836d-71dac382dfb5=discard,luks"
      "luks.uuid=9f04f917-efd3-4036-b3f5-24705fee7ffa"
      "luks.name=9f04f917-efd3-4036-b3f5-24705fee7ffa=swap"
      "luks.key=9f04f917-efd3-4036-b3f5-24705fee7ffa=/boot/swapkey.bin"
      "luks.options=9f04f917-efd3-4036-b3f5-24705fee7ffa=swap,discard,luks"
      "root=LABEL=root"
      "resume=/dev/mapper/swap"
      "rootflags=compress=lzo,subvol=__current/arch-root"))
   (initrd (string-join '("/__current/arch-root/boot/intel-ucode.img"
                          "/__current/arch-root/boot/initramfs-linux.img") " "))))
(operating-system
 (host-name "loke")
 (timezone "Canada/Pacific")
 (locale "en_US.utf8")
 (locale-definitions
  (list
   (locale-definition (name "en_US.utf8") (source "en_US") (charset "UTF-8"))
   (locale-definition (name "sv_SE.utf8") (source "sv_SE") (charset "UTF-8"))))
 ;; Assuming /dev/sda is the target hard disk, and "root"
 ;; is the label of the target root file system.
 (bootloader
  (grub-configuration (target "/dev/sda")
                      (menu-entries `(,menu-arch))))
 ;; Kernel arguments
 (kernel-arguments '("rootflags=compress=lzo,subvol=__current/guixsd-root"))
 (mapped-devices (list mapped-root mapped-swap))
 (file-systems
  (cons*
   fs-home
   fs-grub
   fs-gnu
   fs-guix
   fs-root
   nfs-valhalla
   %base-file-systems))
 (swap-devices '("/dev/mapper/swap"))
 (users (cons plattfot %base-user-accounts))

 ;; Add a bunch of window managers; we can choose one at
 ;; the log-in screen with F1.
 (packages (cons* i3-wm i3status rofi ;window managers
                  ;;zsh
                  nss-certs            ;for HTTPS access
                  %base-packages))

 ;; Use the "desktop" services, which include the X11
 ;; log-in service, networking with Wicd, and more.
 (services
  ;;%desktop-services
  (cons* (service openssh-service-type
                  (openssh-configuration
                   (port-number 6060)
                   (password-authentication? #f)))
         (extra-special-file "/bin/env" (file-append coreutils "/bin/env"))
         (set-xorg-configuration
          (xorg-configuration
           (keyboard-layout
            ;; Keyboard layout for English and Swedish. CAPS as Ctrl,
            ;; toggle between the two layouts with scroll lock.
            (keyboard-layout
             "us,se"
             #:options '("ctrl:nocaps" "grp:sclk_toggle" "grp_led:scroll" ":2")))))
         %desktop-services))

 ;; Allow resolution of '.local' host names with mDNS.
 (name-service-switch %mdns-host-lookup-nss))

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: btrfs raid configuration vs mdraid
  2019-05-20 19:59 ` Fredrik Salomonsson
@ 2019-05-21  8:25   ` Giovanni Biscuolo
  2019-05-21 16:35     ` Fredrik Salomonsson
  0 siblings, 1 reply; 4+ messages in thread
From: Giovanni Biscuolo @ 2019-05-21  8:25 UTC (permalink / raw)
  To: Fredrik Salomonsson, help-guix

[-- Attachment #1: Type: text/plain, Size: 1491 bytes --]

Hi Fredrik,

Fredrik Salomonsson <plattfot@gmail.com> writes:

[...]

>> Assuming I'm going to format the root filesystem as:
>>
>>   mkfs.btrfs -m raid1 -d raid1 /dev/sda3 /dev/sdb3
>>
>> how should I configure (file-system...)? this way:
>>
>> (file-system
>>   (mount-point "/")
>>   (type "btrfs")
>>   (device (uuid "4dab5feb-d176-45de-b287-9b0a6e4c01cb")))
>>
>> with UUID taken from "lsblk -f"?
>
> That should work.

I confirm it worked, easily! :-)

[...]

> One thing you should note is that guix might generate incorrect
> paths for grub if you are using subvolumes. At least guix < 1.0 does
> that for me, haven't tested 1.0+ yet. But I have been using a shell
> script that works around that issue.

I did not use root on a subvolume for my installation, but I'll try to
reproduce it in a test install: can you please file a bug report for
this, IMHO this should be fixed

>> From you experience is RAID on brtfs as solid as the one on mdadm?
>
> I have very little experience with mdadm, so can only speak of my
> experience with btrfs and RAID-1. Which I have been using for 3+ years.
> For me it has been solid. Only issue I have encountered was when my
> fileserver lost power a few times leaving the filesystem corrupt. A
> "btrfs check --repair" fixed that issue.

Thanks for sharing! You give me courage to adopt btrfs more extensively
:-)

Best regards, Gio'.

[...]

-- 
Giovanni Biscuolo

Xelera IT Infrastructures

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: btrfs raid configuration vs mdraid
  2019-05-21  8:25   ` Giovanni Biscuolo
@ 2019-05-21 16:35     ` Fredrik Salomonsson
  0 siblings, 0 replies; 4+ messages in thread
From: Fredrik Salomonsson @ 2019-05-21 16:35 UTC (permalink / raw)
  To: Giovanni Biscuolo, help-guix


Hi Giovanni,

Giovanni Biscuolo <g@xelera.eu> writes:

[...]

>>> Assuming I'm going to format the root filesystem as:
>>>
>>>   mkfs.btrfs -m raid1 -d raid1 /dev/sda3 /dev/sdb3
>>>
>>> how should I configure (file-system...)? this way:
>>>
>>> (file-system
>>>   (mount-point "/")
>>>   (type "btrfs")
>>>   (device (uuid "4dab5feb-d176-45de-b287-9b0a6e4c01cb")))
>>>
>>> with UUID taken from "lsblk -f"?
>>
>> That should work.
>
> I confirm it worked, easily! :-)

Good to know :).

[...]

>> One thing you should note is that guix might generate incorrect
>> paths for grub if you are using subvolumes. At least guix < 1.0 does
>> that for me, haven't tested 1.0+ yet. But I have been using a shell
>> script that works around that issue.
>
> I did not use root on a subvolume for my installation, but I'll try to
> reproduce it in a test install: can you please file a bug report for
> this, IMHO this should be fixed

Looks like there is already a bug report on this:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=33517

And I just tested to reconfigure my system with guix v1.0.1 and the
issue is still there.

>>> From you experience is RAID on brtfs as solid as the one on mdadm?
>>
>> I have very little experience with mdadm, so can only speak of my
>> experience with btrfs and RAID-1. Which I have been using for 3+ years.
>> For me it has been solid. Only issue I have encountered was when my
>> fileserver lost power a few times leaving the filesystem corrupt. A
>> "btrfs check --repair" fixed that issue.
>
> Thanks for sharing! You give me courage to adopt btrfs more extensively
> :-)

Glad I could help out.

--
s/Fred[re]+i[ck]+/Fredrik/g

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-05-21 16:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-16  6:00 btrfs raid configuration vs mdraid Giovanni Biscuolo
2019-05-20 19:59 ` Fredrik Salomonsson
2019-05-21  8:25   ` Giovanni Biscuolo
2019-05-21 16:35     ` Fredrik Salomonsson

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.