Re: merge status of per-chunk degradable check [was Re: Which device is missing ?]
On 10/09/2018 02:08 AM, Nicholas D Steeves wrote: > On Mon, Oct 08, 2018 at 04:10:55PM +, Hugo Mills wrote: >> On Mon, Oct 08, 2018 at 03:49:53PM +0200, Pierre Couderc wrote: >>> I ma trying to make a "RAID1" with /dev/sda2 ans /dev/sdb (or similar). >>> >>> But I have stranges status or errors about "missing devices" and I >>> do not understand the current situation : > [...] >>Note that, since the main FS is missing a device, it will probably >> need to be mounted in degraded mode (-o degraded), and that on kernels >> earlier than (IIRC) 4.14, this can only be done *once* without the FS >> becoming more or less permanently read-only. On recent kernels, it >> _should_ be OK. >> >> *WARNING ENDS* > > I think this was the patch that addressed this?: > https://www.spinics.net/lists/linux-btrfs/msg47283.html > https://patchwork.kernel.org/patch/7226931/ > > In my notes it wasn't present in <= 4.14.15, but my notes might be > wrong. Does this patch resolve the one-shot -o degraded, reboot, > forever read-only behaviour, or is something else required? When was > it merged? Has it been or will it be backported to 4.14.x? I'm > guessing 4.9.x is too far back, but it would be really nice to see it > there too :-) > > Also, will this issue be resolved for linux-4.19? If so I'd like to > update the Debian btrfs wiki with this good news :-) [...] > P.S. Please let me know if you'd prefer for me to shift this > documentation effort to btrfs.wiki.kernel.org. Yes, absolutely. This is not specific to how we do things for Debian. Upstream documentation can help all distros. -- Hans van Kranenburg signature.asc Description: OpenPGP digital signature
merge status of per-chunk degradable check [was Re: Which device is missing ?]
On Mon, Oct 08, 2018 at 04:10:55PM +, Hugo Mills wrote: > On Mon, Oct 08, 2018 at 03:49:53PM +0200, Pierre Couderc wrote: > > I ma trying to make a "RAID1" with /dev/sda2 ans /dev/sdb (or similar). > > > > But I have stranges status or errors about "missing devices" and I > > do not understand the current situation : [...] >Note that, since the main FS is missing a device, it will probably > need to be mounted in degraded mode (-o degraded), and that on kernels > earlier than (IIRC) 4.14, this can only be done *once* without the FS > becoming more or less permanently read-only. On recent kernels, it > _should_ be OK. > > *WARNING ENDS* I think this was the patch that addressed this?: https://www.spinics.net/lists/linux-btrfs/msg47283.html https://patchwork.kernel.org/patch/7226931/ In my notes it wasn't present in <= 4.14.15, but my notes might be wrong. Does this patch resolve the one-shot -o degraded, reboot, forever read-only behaviour, or is something else required? When was it merged? Has it been or will it be backported to 4.14.x? I'm guessing 4.9.x is too far back, but it would be really nice to see it there too :-) Also, will this issue be resolved for linux-4.19? If so I'd like to update the Debian btrfs wiki with this good news :-) Finally, is the following a valid workaround for users who don't have access to a kernel containing this fix: 1. Make a raid1 profile volume (both data and metadata) with >= 3 disks. 2. Lose one disk. 3. Allocator continues to write raid1 chunks instead of single, because it is still possible to write one chunk to two disks. 4. Thus reboot twice -> forever read-only averted? Kind regards, Nicholas P.S. Please let me know if you'd prefer for me to shift this documentation effort to btrfs.wiki.kernel.org. signature.asc Description: PGP signature
Re: Which device is missing ?
On 10/08/2018 11:21 PM, Hugo Mills wrote: On Mon, Oct 08, 2018 at 11:01:35PM +0200, Pierre Couderc wrote: On 10/08/2018 06:14 PM, Hugo Mills wrote: On Mon, Oct 08, 2018 at 04:10:55PM +, Hugo Mills wrote: On Mon, Oct 08, 2018 at 03:49:53PM +0200, Pierre Couderc wrote: I ma trying to make a "RAID1" with /dev/sda2 ans /dev/sdb (or similar). But I have stranges status or errors about "missing devices" and I do not understand the current situation : root@server:~# btrfs fi show Label: none uuid: 28c2b7ab-631c-40a3-bab7-00dac5dd20eb Total devices 1 FS bytes used 190.91GiB devid 1 size 1.82TiB used 196.02GiB path /dev/sda2 warning, device 1 is missing Label: none uuid: 2d45149a-fb97-4c2a-bae2-4cfe4e01a8aa Total devices 2 FS bytes used 116.18GiB devid 2 size 1.82TiB used 118.03GiB path /dev/sdb *** Some devices missing This looks like you've created a RAID-1 array with /dev/sda2 and /dev/sdb, and then run mkfs.btrfs again on /dev/sda2, overwriting the original [part of a] filesystem on /dev/sda2, and replacing it with a wholly different filesystem. Since the new FS on /dev/sda2 (UUID 28c2...) doesn't have the same UUID as the original FS (UUID 2d45...), and the original FS was made of two devices, btrfs fi show is telling you that there's some devices missing -- /dev/sda2 is no longer part of that FS, and is therefore a missing device. I note that you've got data on both filesystems, so they must both have been mounted somewhere and had stuff put on them. I recommend doing something like this: # mkfs /media/btrfs/myraid1 /media/btrfs/tmp # mount /dev/sdb /media/btrfs/myraid1/ # mount /dev/sda2 /media/btrfs/tmp/ # mount both filesystems # cp /media/btrfs/tmp/* /media/btrfs/myraid1 # put it where you want it # umount /media/btrfs/tmp/ # wipefs /dev/sda2 # destroy the FS on sda2 # btrfs replace start 1 /dev/sda2 /media/btrfs/myraid1/ This will copy all the data from the filesystem on /dev/sda2 into the filesystem on /dev/sdb, destroy the FS on sda2, and then use sda2 as the second device for the main FS. *WARNING!* Note that, since the main FS is missing a device, it will probably need to be mounted in degraded mode (-o degraded), and that on kernels earlier than (IIRC) 4.14, this can only be done *once* without the FS becoming more or less permanently read-only. On recent kernels, it _should_ be OK. *WARNING ENDS* Oh, and for the record, to make a RAID-1 filesystem from scratch, you simply need this: # mkfs.btrfs -m raid1 -d raid1 /dev/sda2 /dev/sdb You do not need to run mkfs.btrfs on each device separately. Hugo. Thnk you very much. I understand a bit better. I think that I have nothing of interest on /dev/sdb and that its contents is the result of previous trials. And that my system is on /dev/dsda2 as : root@server:~# df -h Filesystem Size Used Avail Use% Mounted on udev 3.9G 0 3.9G 0% /dev tmpfs 787M 8.8M 778M 2% /run /dev/sda2 1.9T 193G 1.7T 11% / tmpfs 3.9G 0 3.9G 0% /dev/shm tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup /dev/sda1 511M 5.7M 506M 2% /boot/efi tmpfs 100K 0 100K 0% /var/lib/lxd/shmounts tmpfs 100K 0 100K 0% /var/lib/lxd/devlxd root@server:~# Is it exact ? Yes, it looks like you're running / from the FS on /dev/sda2. If yes, I suppose I should wipe data on /dev/sdb, then build the RAID by expanding /dev/sda2. Correct. I would recommend putting a partition table on /dev/sdb, because it doesn't take up much space, and it's always easier to have one already there when you need it (and there's a few things that can get confused if there isn't a partition table). So I should : wipefs /dev/sdb btrfs device add /dev/sdb / btrfs balance start -v -mconvert=raid1 -dconvert=raid1 / Does it sound correct ? (my kernel is boot/vmlinuz-4.18.0-1-amd64) Yes, exactly. Hugo. Thnk you very very much. I do it now, as you with a partition table on /dev/sdb !
Re: Which device is missing ?
On Mon, Oct 08, 2018 at 11:01:35PM +0200, Pierre Couderc wrote: > On 10/08/2018 06:14 PM, Hugo Mills wrote: > >On Mon, Oct 08, 2018 at 04:10:55PM +, Hugo Mills wrote: > >>On Mon, Oct 08, 2018 at 03:49:53PM +0200, Pierre Couderc wrote: > >>>I ma trying to make a "RAID1" with /dev/sda2 ans /dev/sdb (or similar). > >>> > >>>But I have stranges status or errors about "missing devices" and I > >>>do not understand the current situation : > >>> > >>> > >>>root@server:~# btrfs fi show > >>>Label: none uuid: 28c2b7ab-631c-40a3-bab7-00dac5dd20eb > >>> Total devices 1 FS bytes used 190.91GiB > >>> devid 1 size 1.82TiB used 196.02GiB path /dev/sda2 > >>> > >>>warning, device 1 is missing > >>>Label: none uuid: 2d45149a-fb97-4c2a-bae2-4cfe4e01a8aa > >>> Total devices 2 FS bytes used 116.18GiB > >>> devid 2 size 1.82TiB used 118.03GiB path /dev/sdb > >>> *** Some devices missing > >>This looks like you've created a RAID-1 array with /dev/sda2 and > >>/dev/sdb, and then run mkfs.btrfs again on /dev/sda2, overwriting the > >>original [part of a] filesystem on /dev/sda2, and replacing it with a > >>wholly different filesystem. Since the new FS on /dev/sda2 (UUID > >>28c2...) doesn't have the same UUID as the original FS (UUID 2d45...), > >>and the original FS was made of two devices, btrfs fi show is telling > >>you that there's some devices missing -- /dev/sda2 is no longer part > >>of that FS, and is therefore a missing device. > >> > >>I note that you've got data on both filesystems, so they must both > >>have been mounted somewhere and had stuff put on them. > >> > >>I recommend doing something like this: > >> > >># mkfs /media/btrfs/myraid1 /media/btrfs/tmp > >># mount /dev/sdb /media/btrfs/myraid1/ > >># mount /dev/sda2 /media/btrfs/tmp/ # mount both filesystems > >># cp /media/btrfs/tmp/* /media/btrfs/myraid1 # put it where you want it > >># umount /media/btrfs/tmp/ > >># wipefs /dev/sda2 # destroy the FS on sda2 > >># btrfs replace start 1 /dev/sda2 /media/btrfs/myraid1/ > >> > >>This will copy all the data from the filesystem on /dev/sda2 into > >>the filesystem on /dev/sdb, destroy the FS on sda2, and then use sda2 > >>as the second device for the main FS. > >> > >>*WARNING!* > >> > >>Note that, since the main FS is missing a device, it will probably > >>need to be mounted in degraded mode (-o degraded), and that on kernels > >>earlier than (IIRC) 4.14, this can only be done *once* without the FS > >>becoming more or less permanently read-only. On recent kernels, it > >>_should_ be OK. > >> > >>*WARNING ENDS* > >Oh, and for the record, to make a RAID-1 filesystem from scratch, > >you simply need this: > > > ># mkfs.btrfs -m raid1 -d raid1 /dev/sda2 /dev/sdb > > > >You do not need to run mkfs.btrfs on each device separately. > > > >Hugo. > Thnk you very much. I understand a bit better. I think that I have > nothing of interest on /dev/sdb and that its contents is the result > of previous trials. > And that my system is on /dev/dsda2 as : > > root@server:~# df -h > Filesystem Size Used Avail Use% Mounted on > udev 3.9G 0 3.9G 0% /dev > tmpfs 787M 8.8M 778M 2% /run > /dev/sda2 1.9T 193G 1.7T 11% / > tmpfs 3.9G 0 3.9G 0% /dev/shm > tmpfs 5.0M 0 5.0M 0% /run/lock > tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup > /dev/sda1 511M 5.7M 506M 2% /boot/efi > tmpfs 100K 0 100K 0% /var/lib/lxd/shmounts > tmpfs 100K 0 100K 0% /var/lib/lxd/devlxd > root@server:~# > > Is it exact ? Yes, it looks like you're running / from the FS on /dev/sda2. > If yes, I suppose I should wipe data on /dev/sdb, then build the > RAID by expanding /dev/sda2. Correct. I would recommend putting a partition table on /dev/sdb, because it doesn't take up much space, and it's always easier to have one already there when you need it (and there's a few things that can get confused if there isn't a partition table). > So I should : > > wipefs /dev/sdb > btrfs device add /dev/sdb / > btrfs balance start -v -mconvert=raid1 -dconvert=raid1 / > Does it sound correct ? (my kernel is boot/vmlinuz-4.18.0-1-amd64) Yes, exactly. Hugo. -- Hugo Mills | Yes, this is an example of something that becomes hugo@... carfax.org.uk | less explosive as a one-to-one cocrystal with TNT. http://carfax.org.uk/ | (Hexanitrohexaazaisowurtzitane) PGP: E2AB1DE4 |Derek Lowe signature.asc Description: Digital signature
Re: Which device is missing ?
On Mon, Oct 08, 2018 at 04:10:55PM +, Hugo Mills wrote: > On Mon, Oct 08, 2018 at 03:49:53PM +0200, Pierre Couderc wrote: > > I ma trying to make a "RAID1" with /dev/sda2 ans /dev/sdb (or similar). > > > > But I have stranges status or errors about "missing devices" and I > > do not understand the current situation : > > > > > > root@server:~# btrfs fi show > > Label: none uuid: 28c2b7ab-631c-40a3-bab7-00dac5dd20eb > > Total devices 1 FS bytes used 190.91GiB > > devid 1 size 1.82TiB used 196.02GiB path /dev/sda2 > > > > warning, device 1 is missing > > Label: none uuid: 2d45149a-fb97-4c2a-bae2-4cfe4e01a8aa > > Total devices 2 FS bytes used 116.18GiB > > devid 2 size 1.82TiB used 118.03GiB path /dev/sdb > > *** Some devices missing > >This looks like you've created a RAID-1 array with /dev/sda2 and > /dev/sdb, and then run mkfs.btrfs again on /dev/sda2, overwriting the > original [part of a] filesystem on /dev/sda2, and replacing it with a > wholly different filesystem. Since the new FS on /dev/sda2 (UUID > 28c2...) doesn't have the same UUID as the original FS (UUID 2d45...), > and the original FS was made of two devices, btrfs fi show is telling > you that there's some devices missing -- /dev/sda2 is no longer part > of that FS, and is therefore a missing device. > >I note that you've got data on both filesystems, so they must both > have been mounted somewhere and had stuff put on them. > >I recommend doing something like this: > > # mkfs /media/btrfs/myraid1 /media/btrfs/tmp > # mount /dev/sdb /media/btrfs/myraid1/ > # mount /dev/sda2 /media/btrfs/tmp/ # mount both filesystems > # cp /media/btrfs/tmp/* /media/btrfs/myraid1 # put it where you want it > # umount /media/btrfs/tmp/ > # wipefs /dev/sda2 # destroy the FS on sda2 > # btrfs replace start 1 /dev/sda2 /media/btrfs/myraid1/ > >This will copy all the data from the filesystem on /dev/sda2 into > the filesystem on /dev/sdb, destroy the FS on sda2, and then use sda2 > as the second device for the main FS. > > *WARNING!* > >Note that, since the main FS is missing a device, it will probably > need to be mounted in degraded mode (-o degraded), and that on kernels > earlier than (IIRC) 4.14, this can only be done *once* without the FS > becoming more or less permanently read-only. On recent kernels, it > _should_ be OK. > > *WARNING ENDS* Oh, and for the record, to make a RAID-1 filesystem from scratch, you simply need this: # mkfs.btrfs -m raid1 -d raid1 /dev/sda2 /dev/sdb You do not need to run mkfs.btrfs on each device separately. Hugo. -- Hugo Mills | Welcome to Rivendell, Mr Anderson... hugo@... carfax.org.uk | http://carfax.org.uk/ | PGP: E2AB1DE4 |Machinae Supremacy, Hybrid signature.asc Description: Digital signature
Re: Which device is missing ?
On Mon, Oct 08, 2018 at 03:49:53PM +0200, Pierre Couderc wrote: > I ma trying to make a "RAID1" with /dev/sda2 ans /dev/sdb (or similar). > > But I have stranges status or errors about "missing devices" and I > do not understand the current situation : > > > root@server:~# btrfs fi show > Label: none uuid: 28c2b7ab-631c-40a3-bab7-00dac5dd20eb > Total devices 1 FS bytes used 190.91GiB > devid 1 size 1.82TiB used 196.02GiB path /dev/sda2 > > warning, device 1 is missing > Label: none uuid: 2d45149a-fb97-4c2a-bae2-4cfe4e01a8aa > Total devices 2 FS bytes used 116.18GiB > devid 2 size 1.82TiB used 118.03GiB path /dev/sdb > *** Some devices missing This looks like you've created a RAID-1 array with /dev/sda2 and /dev/sdb, and then run mkfs.btrfs again on /dev/sda2, overwriting the original [part of a] filesystem on /dev/sda2, and replacing it with a wholly different filesystem. Since the new FS on /dev/sda2 (UUID 28c2...) doesn't have the same UUID as the original FS (UUID 2d45...), and the original FS was made of two devices, btrfs fi show is telling you that there's some devices missing -- /dev/sda2 is no longer part of that FS, and is therefore a missing device. I note that you've got data on both filesystems, so they must both have been mounted somewhere and had stuff put on them. I recommend doing something like this: # mkfs /media/btrfs/myraid1 /media/btrfs/tmp # mount /dev/sdb /media/btrfs/myraid1/ # mount /dev/sda2 /media/btrfs/tmp/ # mount both filesystems # cp /media/btrfs/tmp/* /media/btrfs/myraid1 # put it where you want it # umount /media/btrfs/tmp/ # wipefs /dev/sda2 # destroy the FS on sda2 # btrfs replace start 1 /dev/sda2 /media/btrfs/myraid1/ This will copy all the data from the filesystem on /dev/sda2 into the filesystem on /dev/sdb, destroy the FS on sda2, and then use sda2 as the second device for the main FS. *WARNING!* Note that, since the main FS is missing a device, it will probably need to be mounted in degraded mode (-o degraded), and that on kernels earlier than (IIRC) 4.14, this can only be done *once* without the FS becoming more or less permanently read-only. On recent kernels, it _should_ be OK. *WARNING ENDS* Hugo. [snip] -- Hugo Mills | UNIX: Japanese brand of food containers hugo@... carfax.org.uk | http://carfax.org.uk/ | PGP: E2AB1DE4 | signature.asc Description: Digital signature
Which device is missing ?
I ma trying to make a "RAID1" with /dev/sda2 ans /dev/sdb (or similar). But I have stranges status or errors about "missing devices" and I do not understand the current situation : root@server:~# btrfs fi show Label: none uuid: 28c2b7ab-631c-40a3-bab7-00dac5dd20eb Total devices 1 FS bytes used 190.91GiB devid 1 size 1.82TiB used 196.02GiB path /dev/sda2 warning, device 1 is missing Label: none uuid: 2d45149a-fb97-4c2a-bae2-4cfe4e01a8aa Total devices 2 FS bytes used 116.18GiB devid 2 size 1.82TiB used 118.03GiB path /dev/sdb *** Some devices missing root@server:~# fdisk -l Disk /dev/sda: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: gpt Disk identifier: CFF97102-D6B5-4126-B2B4-FA735598D1F0 Device Start End Sectors Size Type /dev/sda1 2048 1050623 1048576 512M EFI System /dev/sda2 1050624 3907026943 3905976320 1.8T Linux filesystem Disk /dev/sdb: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes root@server:~# btrfs fi usage / Overall: Device size: 1.82TiB Device allocated: 196.02GiB Device unallocated: 1.63TiB Device missing: 0.00B Used: 191.84GiB Free (estimated): 1.63TiB (min: 835.27GiB) Data ratio: 1.00 Metadata ratio: 2.00 Global reserve: 263.64MiB (used: 0.00B) Data,single: Size:192.01GiB, Used:189.98GiB /dev/sda2 192.01GiB Metadata,DUP: Size:2.00GiB, Used:951.67MiB /dev/sda2 4.00GiB System,DUP: Size:8.00MiB, Used:48.00KiB /dev/sda2 16.00MiB Unallocated: /dev/sda2 1.63TiB root@server:~#