All of lore.kernel.org
 help / color / mirror / Atom feed
* how to cleanup old superblock
@ 2012-06-25 19:54 Dmitry MiksIr
  2012-06-25 22:49 ` David Sterba
  0 siblings, 1 reply; 5+ messages in thread
From: Dmitry MiksIr @ 2012-06-25 19:54 UTC (permalink / raw)
  To: linux-btrfs

Hello!
Long time ago I created btrfs on /dev/sda
After some changes btrfs moved to /dev/sda1 (well, to md, and sda1 is 
part of md).

As result, <btrfs fi show> show me 2 filesystems: new one and old one.
Probably I need to do some cleaning. Can someone tell me what to do.

fdisk -u -c -l /dev/sda

Disk /dev/sda: 2000.4 GB, 2000398934016 bytes
81 heads, 63 sectors/track, 765633 cylinders, total 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
Disk identifier: 0xde07ba46

    Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048  3907029167  1953513560   fd  Linux raid


btrfs fi show
Label: 'storage'  uuid: ea3824ec-2fd5-4813-88da-d96c319029f4
         Total devices 1 FS bytes used 50.87GB
         devid    1 size 1.82TB used 138.04GB path /dev/md127

Label: 'mainst'  uuid: 1bd2b9be-5464-4926-88da-af8e12c21f94
         Total devices 3 FS bytes used 45.94GB
         devid    1 size 1.82TB used 123.04GB path /dev/sda
         *** Some devices missing

Last one is wrong.



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

* Re: how to cleanup old superblock
  2012-06-25 19:54 how to cleanup old superblock Dmitry MiksIr
@ 2012-06-25 22:49 ` David Sterba
  2012-06-26  8:53   ` Xavier Nicollet
  0 siblings, 1 reply; 5+ messages in thread
From: David Sterba @ 2012-06-25 22:49 UTC (permalink / raw)
  To: Dmitry MiksIr; +Cc: linux-btrfs

On Mon, Jun 25, 2012 at 11:54:50PM +0400, Dmitry MiksIr wrote:
> Hello!
> Long time ago I created btrfs on /dev/sda
> After some changes btrfs moved to /dev/sda1 (well, to md, and sda1 is part
> of md).
> 
> As result, <btrfs fi show> show me 2 filesystems: new one and old one.
> Probably I need to do some cleaning. Can someone tell me what to do.

quick aid is to run this command:

dd if=/dev/zero of=/dev/sda bs=1k count=4 seek=64

(deletes just the btrfs superblock and will not touch anything
else)


david

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

* Re: how to cleanup old superblock
  2012-06-25 22:49 ` David Sterba
@ 2012-06-26  8:53   ` Xavier Nicollet
  2012-06-26 10:17     ` David Sterba
  0 siblings, 1 reply; 5+ messages in thread
From: Xavier Nicollet @ 2012-06-26  8:53 UTC (permalink / raw)
  To: Dmitry MiksIr, linux-btrfs

Le 26 June 2012 ? 00:49, David Sterba a écrit:
> On Mon, Jun 25, 2012 at 11:54:50PM +0400, Dmitry MiksIr wrote:
> > Hello!
> > Long time ago I created btrfs on /dev/sda
> > After some changes btrfs moved to /dev/sda1 (well, to md, and sda1 is part
> > of md).
> > 
> > As result, <btrfs fi show> show me 2 filesystems: new one and old one.
> > Probably I need to do some cleaning. Can someone tell me what to do.
> 
> quick aid is to run this command:
> 
> dd if=/dev/zero of=/dev/sda bs=1k count=4 seek=64
> 
> (deletes just the btrfs superblock and will not touch anything
> else)

Updated the wiki: 
https://btrfs.wiki.kernel.org/index.php/Problem_FAQ#How_to_clean_up_old_superblock_.3F

-- 
Xavier Nicollet

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

* Re: how to cleanup old superblock
  2012-06-26  8:53   ` Xavier Nicollet
@ 2012-06-26 10:17     ` David Sterba
  2012-06-26 11:11       ` Sander
  0 siblings, 1 reply; 5+ messages in thread
From: David Sterba @ 2012-06-26 10:17 UTC (permalink / raw)
  To: Xavier Nicollet; +Cc: Dmitry MiksIr, linux-btrfs

On Tue, Jun 26, 2012 at 10:53:24AM +0200, Xavier Nicollet wrote:
> Le 26 June 2012 ? 00:49, David Sterba a écrit:
> > On Mon, Jun 25, 2012 at 11:54:50PM +0400, Dmitry MiksIr wrote:
> > > Hello!
> > > Long time ago I created btrfs on /dev/sda
> > > After some changes btrfs moved to /dev/sda1 (well, to md, and sda1 is part
> > > of md).
> > > 
> > > As result, <btrfs fi show> show me 2 filesystems: new one and old one.
> > > Probably I need to do some cleaning. Can someone tell me what to do.
> > 
> > quick aid is to run this command:
> > 
> > dd if=/dev/zero of=/dev/sda bs=1k count=4 seek=64
> > 
> > (deletes just the btrfs superblock and will not touch anything
> > else)
> 
> Updated the wiki: 
> https://btrfs.wiki.kernel.org/index.php/Problem_FAQ#How_to_clean_up_old_superblock_.3F

Thanks. I redid the calculations and the statement that it 'will not
touch anything else' may not be correct in rare cases.

Depends where the first partition starts. If it's at sector 63, like
fdisk created by default in the past, overwriting the offset 64k
(relative to /dev/sda) is actually

offset = 64*1024 - 63*512 = 33280

relative to /dev/sda1.

If there are metadata (eg. raid, other fs) at this offset, then it can
cause problems. For safety reasons, a btrfs filesystem does not touch
first megabyte for allocations, so this does not clash. I'm not sure
about md-raid, but if the sda:64k block is used, then it would be
overwritten anyway.

Newer fdisks start the first partition at 1M, so it's safe.

Wiki page updated.

For the reference - this feature belongs to progs, discussed here
http://thread.gmane.org/gmane.comp.file-systems.btrfs/17065


david

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

* Re: how to cleanup old superblock
  2012-06-26 10:17     ` David Sterba
@ 2012-06-26 11:11       ` Sander
  0 siblings, 0 replies; 5+ messages in thread
From: Sander @ 2012-06-26 11:11 UTC (permalink / raw)
  To: Xavier Nicollet, Dmitry MiksIr, linux-btrfs

David Sterba wrote (ao):
> Thanks. I redid the calculations and the statement that it 'will not
> touch anything else' may not be correct in rare cases.

What about wipefs?

"wipefs allows to erase filesystem or raid signatures (magic strings)
from the device to make the filesystem invisible for libblkid. wipefs
does not erase the whole filesystem or any other data from the device.
When used without options -a or -o, it lists all visible filesystems and
offsets of their signatures."

	Sander

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

end of thread, other threads:[~2012-06-26 11:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-25 19:54 how to cleanup old superblock Dmitry MiksIr
2012-06-25 22:49 ` David Sterba
2012-06-26  8:53   ` Xavier Nicollet
2012-06-26 10:17     ` David Sterba
2012-06-26 11:11       ` Sander

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.