All of lore.kernel.org
 help / color / mirror / Atom feed
* btrfs trim erases bootloader area
@ 2016-01-07 19:11 Andrei Borzenkov
  2016-01-07 19:16 ` Filipe Manana
  2016-01-07 19:19 ` Holger Hoffstätte
  0 siblings, 2 replies; 9+ messages in thread
From: Andrei Borzenkov @ 2016-01-07 19:11 UTC (permalink / raw)
  To: The development of GNU GRUB, linux-btrfs

As discussed on opensuse-factory list, running fstrim on btrfs erases
bootloader area, rendering system unbootable. See

https://lists.opensuse.org/opensuse-factory/2016-01/msg00067.html
https://lists.opensuse.org/opensuse-factory/2016-01/msg00090.html

and follow-ups that demonstrate that beginning of device gets zeroed out.

Not sure what we can do, but from GRUB side I can only see disabling
embedding support on btrfs entirely.



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

* Re: btrfs trim erases bootloader area
  2016-01-07 19:11 btrfs trim erases bootloader area Andrei Borzenkov
@ 2016-01-07 19:16 ` Filipe Manana
  2016-01-07 22:05   ` Chris Murphy
  2016-01-07 19:19 ` Holger Hoffstätte
  1 sibling, 1 reply; 9+ messages in thread
From: Filipe Manana @ 2016-01-07 19:16 UTC (permalink / raw)
  To: Andrei Borzenkov; +Cc: The development of GNU GRUB, linux-btrfs

On Thu, Jan 7, 2016 at 7:11 PM, Andrei Borzenkov <arvidjaar@gmail.com> wrote:
> As discussed on opensuse-factory list, running fstrim on btrfs erases
> bootloader area, rendering system unbootable. See
>
> https://lists.opensuse.org/opensuse-factory/2016-01/msg00067.html
> https://lists.opensuse.org/opensuse-factory/2016-01/msg00090.html
>
> and follow-ups that demonstrate that beginning of device gets zeroed out.
>
> Not sure what we can do, but from GRUB side I can only see disabling
> embedding support on btrfs entirely.

Try this (sent to the btrfs mailing list yesterday):

http://git.kernel.org/cgit/linux/kernel/git/fdmanana/linux.git/commit/?h=integration-4.5&id=7b6cb6618b45bb383f9336ec89df5f1f31f9935b

thanks

>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Filipe David Manana,

"Reasonable men adapt themselves to the world.
 Unreasonable men adapt the world to themselves.
 That's why all progress depends on unreasonable men."

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

* Re: btrfs trim erases bootloader area
  2016-01-07 19:11 btrfs trim erases bootloader area Andrei Borzenkov
  2016-01-07 19:16 ` Filipe Manana
@ 2016-01-07 19:19 ` Holger Hoffstätte
  1 sibling, 0 replies; 9+ messages in thread
From: Holger Hoffstätte @ 2016-01-07 19:19 UTC (permalink / raw)
  To: Andrei Borzenkov, The development of GNU GRUB, linux-btrfs

On 01/07/16 20:11, Andrei Borzenkov wrote:
> As discussed on opensuse-factory list, running fstrim on btrfs erases
> bootloader area, rendering system unbootable. See
> 
> https://lists.opensuse.org/opensuse-factory/2016-01/msg00067.html
> https://lists.opensuse.org/opensuse-factory/2016-01/msg00090.html
> 
> and follow-ups that demonstrate that beginning of device gets zeroed out.
> 
> Not sure what we can do, but from GRUB side I can only see disabling
> embedding support on btrfs entirely.

Since you're probably not on the btrfs list and missed it earlier
today: http://www.spinics.net/lists/linux-btrfs/msg50860.html

-h


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

* Re: btrfs trim erases bootloader area
  2016-01-07 19:16 ` Filipe Manana
@ 2016-01-07 22:05   ` Chris Murphy
  2016-01-07 23:10     ` Filipe Manana
  0 siblings, 1 reply; 9+ messages in thread
From: Chris Murphy @ 2016-01-07 22:05 UTC (permalink / raw)
  To: fdmanana; +Cc: Andrei Borzenkov, The development of GNU GRUB, linux-btrfs

On Thu, Jan 7, 2016 at 12:16 PM, Filipe Manana <fdmanana@gmail.com> wrote:
> On Thu, Jan 7, 2016 at 7:11 PM, Andrei Borzenkov <arvidjaar@gmail.com> wrote:
>> As discussed on opensuse-factory list, running fstrim on btrfs erases
>> bootloader area, rendering system unbootable. See
>>
>> https://lists.opensuse.org/opensuse-factory/2016-01/msg00067.html
>> https://lists.opensuse.org/opensuse-factory/2016-01/msg00090.html
>>
>> and follow-ups that demonstrate that beginning of device gets zeroed out.
>>
>> Not sure what we can do, but from GRUB side I can only see disabling
>> embedding support on btrfs entirely.
>
> Try this (sent to the btrfs mailing list yesterday):
>
> http://git.kernel.org/cgit/linux/kernel/git/fdmanana/linux.git/commit/?h=integration-4.5&id=7b6cb6618b45bb383f9336ec89df5f1f31f9935b
>
> thanks

The description is a bit confusing by referring to MBR, which mainly
exists only at LBA 0. In the case of extended partitions, the EBR
(using the same MBR format) is still outside the LBA range for Btrfs
to apply fitrim ioctl. The VBR however, would be inside that range,
and it's that 64KiB bootloader pad Btrfs reserves that's being
inadvertently obliterated. Correct?



Chris Murphy

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

* Re: btrfs trim erases bootloader area
  2016-01-07 22:05   ` Chris Murphy
@ 2016-01-07 23:10     ` Filipe Manana
  2016-01-07 23:39         ` Chris Murphy
  2016-01-08  1:44       ` Christoph Anton Mitterer
  0 siblings, 2 replies; 9+ messages in thread
From: Filipe Manana @ 2016-01-07 23:10 UTC (permalink / raw)
  To: Chris Murphy; +Cc: Andrei Borzenkov, The development of GNU GRUB, linux-btrfs

On Thu, Jan 7, 2016 at 10:05 PM, Chris Murphy <lists@colorremedies.com> wrote:
> On Thu, Jan 7, 2016 at 12:16 PM, Filipe Manana <fdmanana@gmail.com> wrote:
>> On Thu, Jan 7, 2016 at 7:11 PM, Andrei Borzenkov <arvidjaar@gmail.com> wrote:
>>> As discussed on opensuse-factory list, running fstrim on btrfs erases
>>> bootloader area, rendering system unbootable. See
>>>
>>> https://lists.opensuse.org/opensuse-factory/2016-01/msg00067.html
>>> https://lists.opensuse.org/opensuse-factory/2016-01/msg00090.html
>>>
>>> and follow-ups that demonstrate that beginning of device gets zeroed out.
>>>
>>> Not sure what we can do, but from GRUB side I can only see disabling
>>> embedding support on btrfs entirely.
>>
>> Try this (sent to the btrfs mailing list yesterday):
>>
>> http://git.kernel.org/cgit/linux/kernel/git/fdmanana/linux.git/commit/?h=integration-4.5&id=7b6cb6618b45bb383f9336ec89df5f1f31f9935b
>>
>> thanks
>
> The description is a bit confusing by referring to MBR, which mainly
> exists only at LBA 0. In the case of extended partitions, the EBR
> (using the same MBR format) is still outside the LBA range for Btrfs
> to apply fitrim ioctl. The VBR however, would be inside that range,
> and it's that 64KiB bootloader pad Btrfs reserves that's being
> inadvertently obliterated. Correct?

Right, the title and description is confusing. I lacked the
terminology and all technical details of grub, so I just used MBR to
refer to any sector containing code used by the boot loader.
Do you like the following title/change log better?

http://git.kernel.org/cgit/linux/kernel/git/fdmanana/linux.git/commit/?h=integration-4.5&id=6a340b36b68463ddca2b088c398d94a067a00e82

I'll resend it later or tomorrow.

thanks

>
>
>
> Chris Murphy



-- 
Filipe David Manana,

"Reasonable men adapt themselves to the world.
 Unreasonable men adapt the world to themselves.
 That's why all progress depends on unreasonable men."

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

* Re: btrfs trim erases bootloader area
  2016-01-07 23:10     ` Filipe Manana
@ 2016-01-07 23:39         ` Chris Murphy
  2016-01-08  1:44       ` Christoph Anton Mitterer
  1 sibling, 0 replies; 9+ messages in thread
From: Chris Murphy @ 2016-01-07 23:39 UTC (permalink / raw)
  To: fdmanana
  Cc: Chris Murphy, Andrei Borzenkov, The development of GNU GRUB, linux-btrfs

On Thu, Jan 7, 2016 at 4:10 PM, Filipe Manana <fdmanana@gmail.com> wrote:
> On Thu, Jan 7, 2016 at 10:05 PM, Chris Murphy <lists@colorremedies.com> wrote:
>> On Thu, Jan 7, 2016 at 12:16 PM, Filipe Manana <fdmanana@gmail.com> wrote:
>>> On Thu, Jan 7, 2016 at 7:11 PM, Andrei Borzenkov <arvidjaar@gmail.com> wrote:
>>>> As discussed on opensuse-factory list, running fstrim on btrfs erases
>>>> bootloader area, rendering system unbootable. See
>>>>
>>>> https://lists.opensuse.org/opensuse-factory/2016-01/msg00067.html
>>>> https://lists.opensuse.org/opensuse-factory/2016-01/msg00090.html
>>>>
>>>> and follow-ups that demonstrate that beginning of device gets zeroed out.
>>>>
>>>> Not sure what we can do, but from GRUB side I can only see disabling
>>>> embedding support on btrfs entirely.
>>>
>>> Try this (sent to the btrfs mailing list yesterday):
>>>
>>> http://git.kernel.org/cgit/linux/kernel/git/fdmanana/linux.git/commit/?h=integration-4.5&id=7b6cb6618b45bb383f9336ec89df5f1f31f9935b
>>>
>>> thanks
>>
>> The description is a bit confusing by referring to MBR, which mainly
>> exists only at LBA 0. In the case of extended partitions, the EBR
>> (using the same MBR format) is still outside the LBA range for Btrfs
>> to apply fitrim ioctl. The VBR however, would be inside that range,
>> and it's that 64KiB bootloader pad Btrfs reserves that's being
>> inadvertently obliterated. Correct?
>
> Right, the title and description is confusing. I lacked the
> terminology and all technical details of grub, so I just used MBR to
> refer to any sector containing code used by the boot loader.
> Do you like the following title/change log better?
>
> http://git.kernel.org/cgit/linux/kernel/git/fdmanana/linux.git/commit/?h=integration-4.5&id=6a340b36b68463ddca2b088c398d94a067a00e82
>
> I'll resend it later or tomorrow.
>

Looks good to me!

-- 
Chris Murphy

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

* Re: btrfs trim erases bootloader area
@ 2016-01-07 23:39         ` Chris Murphy
  0 siblings, 0 replies; 9+ messages in thread
From: Chris Murphy @ 2016-01-07 23:39 UTC (permalink / raw)
  To: fdmanana
  Cc: Andrei Borzenkov, The development of GNU GRUB, Chris Murphy, linux-btrfs

On Thu, Jan 7, 2016 at 4:10 PM, Filipe Manana <fdmanana@gmail.com> wrote:
> On Thu, Jan 7, 2016 at 10:05 PM, Chris Murphy <lists@colorremedies.com> wrote:
>> On Thu, Jan 7, 2016 at 12:16 PM, Filipe Manana <fdmanana@gmail.com> wrote:
>>> On Thu, Jan 7, 2016 at 7:11 PM, Andrei Borzenkov <arvidjaar@gmail.com> wrote:
>>>> As discussed on opensuse-factory list, running fstrim on btrfs erases
>>>> bootloader area, rendering system unbootable. See
>>>>
>>>> https://lists.opensuse.org/opensuse-factory/2016-01/msg00067.html
>>>> https://lists.opensuse.org/opensuse-factory/2016-01/msg00090.html
>>>>
>>>> and follow-ups that demonstrate that beginning of device gets zeroed out.
>>>>
>>>> Not sure what we can do, but from GRUB side I can only see disabling
>>>> embedding support on btrfs entirely.
>>>
>>> Try this (sent to the btrfs mailing list yesterday):
>>>
>>> http://git.kernel.org/cgit/linux/kernel/git/fdmanana/linux.git/commit/?h=integration-4.5&id=7b6cb6618b45bb383f9336ec89df5f1f31f9935b
>>>
>>> thanks
>>
>> The description is a bit confusing by referring to MBR, which mainly
>> exists only at LBA 0. In the case of extended partitions, the EBR
>> (using the same MBR format) is still outside the LBA range for Btrfs
>> to apply fitrim ioctl. The VBR however, would be inside that range,
>> and it's that 64KiB bootloader pad Btrfs reserves that's being
>> inadvertently obliterated. Correct?
>
> Right, the title and description is confusing. I lacked the
> terminology and all technical details of grub, so I just used MBR to
> refer to any sector containing code used by the boot loader.
> Do you like the following title/change log better?
>
> http://git.kernel.org/cgit/linux/kernel/git/fdmanana/linux.git/commit/?h=integration-4.5&id=6a340b36b68463ddca2b088c398d94a067a00e82
>
> I'll resend it later or tomorrow.
>

Looks good to me!

-- 
Chris Murphy


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

* Re: btrfs trim erases bootloader area
  2016-01-07 23:10     ` Filipe Manana
  2016-01-07 23:39         ` Chris Murphy
@ 2016-01-08  1:44       ` Christoph Anton Mitterer
  2016-01-08  6:36         ` Andrei Borzenkov
  1 sibling, 1 reply; 9+ messages in thread
From: Christoph Anton Mitterer @ 2016-01-08  1:44 UTC (permalink / raw)
  To: fdmanana, Chris Murphy
  Cc: Andrei Borzenkov, The development of GNU GRUB, linux-btrfs

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

Hey.

Just a followup on this:
GPT and some others (e.g MD RAID) store data in the end of the device.

It's clear that when the fs is made inside a partition, this shouldn't
be seen (and thus TRIMmed) anyway... but can btrfs be installed e.g.
directly on the device while that continues to hold the GPT (by btrfs
simply always starting at some byte offset)?
If so, then one may possibly need to extend that patch for the end of
the device.

Cheers,
Chris.

[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5930 bytes --]

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

* Re: btrfs trim erases bootloader area
  2016-01-08  1:44       ` Christoph Anton Mitterer
@ 2016-01-08  6:36         ` Andrei Borzenkov
  0 siblings, 0 replies; 9+ messages in thread
From: Andrei Borzenkov @ 2016-01-08  6:36 UTC (permalink / raw)
  To: Christoph Anton Mitterer, fdmanana, Chris Murphy
  Cc: The development of GNU GRUB, linux-btrfs

08.01.2016 04:44, Christoph Anton Mitterer пишет:
> Hey.
> 
> Just a followup on this:
> GPT and some others (e.g MD RAID) store data in the end of the device.
> 
> It's clear that when the fs is made inside a partition, this shouldn't
> be seen (and thus TRIMmed) anyway... but can btrfs be installed e.g.
> directly on the device while that continues to hold the GPT (by btrfs
> simply always starting at some byte offset)?

If btrfs size includes metadata at the end of device - arguably it is
user error; it should not happen.

If user explicitly excluded metadata (mkfs.btrfs -b <size>) but btrfs
still attempts to trim beyond end of filesystem - this is obviously bug
and should not happen. I do not understand much of btrfs internals to
know if this is possible.

Note that corner case is when filesystem size is not multiple of trim
units size. Then incomplete chunks(s) at the beginning and end should
always be skipped.

> If so, then one may possibly need to extend that patch for the end of
> the device.
> 
> Cheers,
> Chris.
> 


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

end of thread, other threads:[~2016-01-08  6:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-07 19:11 btrfs trim erases bootloader area Andrei Borzenkov
2016-01-07 19:16 ` Filipe Manana
2016-01-07 22:05   ` Chris Murphy
2016-01-07 23:10     ` Filipe Manana
2016-01-07 23:39       ` Chris Murphy
2016-01-07 23:39         ` Chris Murphy
2016-01-08  1:44       ` Christoph Anton Mitterer
2016-01-08  6:36         ` Andrei Borzenkov
2016-01-07 19:19 ` Holger Hoffstätte

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.