Re: Re: Raid1 of a slow hdd and a fast(er) SSD, howto to prioritize the SSD?
From: Zygo Blaxell <hidden>
Date: 2021-01-08 14:01:00
On Fri, Jan 08, 2021 at 09:36:13AM +0100, wrote:
quoted hunk ↗ jump to hunk
--- Ursprüngliche Nachricht ---Von: Andrea Gelmini [off-list ref] Datum: 08.01.2021 09:16:26 An: Cedric.dewijs@eclipso.eu Betreff: Re: Raid1 of a slow hdd and a fast(er) SSD, howto to prioritize the SSD? Il giorno mar 5 gen 2021 alle ore 07:44 [off-list ref] ha scritto:quoted
Is there a way to tell btrfs to leave the slow hdd alone, and to prioritizethe SSD? You can use mdadm to do this (I'm using this feature since years in setup where I have to fallback on USB disks for any reason).quoted
From manpage:-W, --write-mostly subsequent devices listed in a --build, --create, or --add command will be flagged as 'write-mostly'. This is valid for RAID1 only and means that the 'md' driver will avoid reading from these devices if at all possible. This can be useful if mirroring over a slow link. --write-behind= Specify that write-behind mode should be enabled (valid for RAID1 only). If an argument is specified, it will set the maximum number of outstanding writes allowed. The default value is 256. A write-intent bitmap is required in order to use write-behind mode, and write-behind is only attempted on drives marked as write-mostly. So you can do this: (be carefull, this wipe your data) mdadm --create --verbose --assume-clean /dev/md0 --level=1 --raid-devices=2 /dev/sda1 --write-mostly /dev/sdb1 Then you use BTRFS on top of /dev/md0, after mkfs.btrfs, of course. Ciao, Gelma Thanks Gelma. What happens when I poison one of the drives in the mdadm array using this command? Will all data come out OK? dd if=/dev/urandom of=/dev/dev/sdb1 bs=1M count = 100?
mdadm doesn't handle data corruption, and (except for a /sys counter), reads from mirror devices interchangeably, and silently propagates data between devices during resync, so the array will almost certainly be destroyed.
When I do this test on a plain btrfs raid 1 with 2 drives, all the data comes out OK (while generating a lot of messages about correcting data in dmesg -w) Cheers, Cedric --- Take your mailboxes with you. Free, fast and secure Mail & Cloud: https://www.eclipso.eu - Time to change!