linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How to get the devid of a missing device
@ 2015-04-26 18:39 Wolfgang Mader
  2015-04-27  2:11 ` Duncan
  2015-04-27  4:48 ` Anand Jain
  0 siblings, 2 replies; 5+ messages in thread
From: Wolfgang Mader @ 2015-04-26 18:39 UTC (permalink / raw)
  To: linux-btrfs

Hello,

I have a raid10 with one device missing. I would like to use btrfs replace to 
replace it. However, I am unsure on how to obtain the devid of the missing 
device. Having the filesystem mounted in degraded mode under mnt, btrfs fs 
show /mnt returns

sudo btrfs filesystem show /mnt
Label: 'dataPool'  uuid: b5f082e2-2ce0-4f91-b54b-c2d26185a635
        Total devices 4 FS bytes used 665.88GiB
        devid    2 size 931.51GiB used 336.03GiB path /dev/sdb
        devid    4 size 931.51GiB used 336.03GiB path /dev/sdd
        devid    5 size 931.51GiB used 336.03GiB path /dev/sde
        *** Some devices missing

but does not mention the devid of the missing device. The device stat is

sudo btrfs device stats /mnt 
[/dev/sdb].write_io_errs   0 
[/dev/sdb].read_io_errs    0 
[/dev/sdb].flush_io_errs   0 
[/dev/sdb].corruption_errs 0 
[/dev/sdb].generation_errs 0 
[(null)].write_io_errs   1448 
[(null)].read_io_errs    0 
[(null)].flush_io_errs   0 
[(null)].corruption_errs 0 
[(null)].generation_errs 0 
[/dev/sdd].write_io_errs   0 
[/dev/sdd].read_io_errs    0 
[/dev/sdd].flush_io_errs   0 
[/dev/sdd].corruption_errs 0 
[/dev/sdd].generation_errs 0 
[/dev/sde].write_io_errs   0 
[/dev/sde].read_io_errs    0 
[/dev/sde].flush_io_errs   0 
[/dev/sde].corruption_errs 0 
[/dev/sde].generation_errs 0


Btw, the file system is too old for skinny metadata and extended inode refs. 
If I do a btrfs replace or a btrfs device add, must I myself ensure that the 
new features are not enables for the new device which is to be added?

Thank!
Wolfgang



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

* Re: How to get the devid of a missing device
  2015-04-26 18:39 How to get the devid of a missing device Wolfgang Mader
@ 2015-04-27  2:11 ` Duncan
  2015-04-27  8:00   ` Wolfgang Mader
  2015-04-27  4:48 ` Anand Jain
  1 sibling, 1 reply; 5+ messages in thread
From: Duncan @ 2015-04-27  2:11 UTC (permalink / raw)
  To: linux-btrfs

Wolfgang Mader posted on Sun, 26 Apr 2015 20:39:34 +0200 as excerpted:

> Hello,
> 
> I have a raid10 with one device missing. I would like to use btrfs
> replace to replace it. However, I am unsure on how to obtain the devid
> of the missing device.

The devid is if the device is still active in the filesystem.  If it's 
missing...

btrfs device delete missing

That, along with a bunch of other likely helpful information, is covered 
on the wiki:

https://btrfs.wiki.kernel.org

Specifically for that (reassemble from the wrap, too lazy to fiddle with 
it on my end):

https://btrfs.wiki.kernel.org/index.php/
Using_Btrfs_with_Multiple_Devices#Replacing_failed_devices

But since it was a four-device raid10 and four devices is the minimum for 
that, I don't believe it'll let you delete until you device add, first.

Of course that means probably some hours for the add, then some more 
hours for the delete missing, during which you obviously hope not to lose 
another device.  Of course the sysadmin's backup rule of thumb applies -- 
if you don't have a backup, by definition, loss of the data isn't a big 
deal, or you'd have it backed up.  (And the corollary, it's not a backup 
until it's tested, applies as well.)  So you shouldn't have to worry 
about loss of a second device during that time, because it's either 
backed up or the data isn't worth the trouble to backup and thus loss of 
it with the loss of a second device isn't a big deal.

That page doesn't seem to cover direct replacement, probably because the 
replace command is new and it hasn't been updated.  But AFAIK replace 
doesn't work with a missing device anyway; it's the fast way to replace a 
still listed device, so you don't have to add and then delete, but the 
device has to still be there in ordered to use that shortcut.  (You could 
try using missing with the -r option tho, just in case it works now.  The 
wiki/manpage is a bit vague on that point.)

> Btw, the file system is too old for skinny metadata and extended inode
> refs. If I do a btrfs replace or a btrfs device add, must I myself
> ensure that the new features are not enables for the new device which is
> to be added?

I don't believe there's any way to set that manually even if you wanted 
to -- you don't use mkfs on it and the add/replace would overwrite 
existing if you did.  The new device should just take on the attributes 
of the filesystem you're adding it to.


-- 
Duncan - List replies preferred.   No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."  Richard Stallman


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

* Re: How to get the devid of a missing device
  2015-04-26 18:39 How to get the devid of a missing device Wolfgang Mader
  2015-04-27  2:11 ` Duncan
@ 2015-04-27  4:48 ` Anand Jain
  2015-04-27  8:01   ` Wolfgang Mader
  1 sibling, 1 reply; 5+ messages in thread
From: Anand Jain @ 2015-04-27  4:48 UTC (permalink / raw)
  To: Wolfgang Mader, linux-btrfs



On 04/27/2015 02:39 AM, Wolfgang Mader wrote:
> Hello,
>
> I have a raid10 with one device missing. I would like to use btrfs replace to
> replace it. However, I am unsure on how to obtain the devid of the missing
> device. Having the filesystem mounted in degraded mode under mnt, btrfs fs

  At the user end there is no way. unless you want to use gdb and dump
  the fs_uuids and check.

  Submitted these patches as of now to obtain from the logs. Will
  help in the situation when device is missing at the time of mount.

Btrfs: check error before reporting missing device and add uuid
Btrfs: log when missing device is created

  For long term we have sysfs interface, patches are in the ML if you
  want to tests.

Good luck.

Anand



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

* Re: How to get the devid of a missing device
  2015-04-27  2:11 ` Duncan
@ 2015-04-27  8:00   ` Wolfgang Mader
  0 siblings, 0 replies; 5+ messages in thread
From: Wolfgang Mader @ 2015-04-27  8:00 UTC (permalink / raw)
  To: Duncan; +Cc: linux-btrfs

On Monday, April 27, 2015 02:11:05 AM Duncan wrote:
> Wolfgang Mader posted on Sun, 26 Apr 2015 20:39:34 +0200 as excerpted:
> > Hello,
> > 
> > I have a raid10 with one device missing. I would like to use btrfs
> > replace to replace it. However, I am unsure on how to obtain the devid
> > of the missing device.
> 
> The devid is if the device is still active in the filesystem.  If it's
> missing...
> 
> btrfs device delete missing
> 
> That, along with a bunch of other likely helpful information, is covered
> on the wiki:
> 
> https://btrfs.wiki.kernel.org
> 
> Specifically for that (reassemble from the wrap, too lazy to fiddle with
> it on my end):
> 
> https://btrfs.wiki.kernel.org/index.php/
> Using_Btrfs_with_Multiple_Devices#Replacing_failed_devices
> 
> But since it was a four-device raid10 and four devices is the minimum for
> that, I don't believe it'll let you delete until you device add, first.

Thanks for your answer. I know the stuff of that page, but since it is 
possible to use btrfs replace on a missing device I wanted to try that 
approach.

> 
> Of course that means probably some hours for the add, then some more
> hours for the delete missing, during which you obviously hope not to lose
> another device.  Of course the sysadmin's backup rule of thumb applies --
> if you don't have a backup, by definition, loss of the data isn't a big
> deal, or you'd have it backed up.  (And the corollary, it's not a backup
> until it's tested, applies as well.)  So you shouldn't have to worry
> about loss of a second device during that time, because it's either
> backed up or the data isn't worth the trouble to backup and thus loss of
> it with the loss of a second device isn't a big deal.

Well, of course, there is a backup on a different machine. Its in the same 
room, but who has the luxury for off-site backups in a home-use setting! :)

> 
> That page doesn't seem to cover direct replacement, probably because the
> replace command is new and it hasn't been updated.  But AFAIK replace
> doesn't work with a missing device anyway; it's the fast way to replace a
> still listed device, so you don't have to add and then delete, but the
> device has to still be there in ordered to use that shortcut.  (You could
> try using missing with the -r option tho, just in case it works now.  The
> wiki/manpage is a bit vague on that point.)
> 
> > Btw, the file system is too old for skinny metadata and extended inode
> > refs. If I do a btrfs replace or a btrfs device add, must I myself
> > ensure that the new features are not enables for the new device which is
> > to be added?
> 
> I don't believe there's any way to set that manually even if you wanted
> to -- you don't use mkfs on it and the add/replace would overwrite
> existing if you did.  The new device should just take on the attributes
> of the filesystem you're adding it to.

 Good to know.

Thanks


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

* Re: How to get the devid of a missing device
  2015-04-27  4:48 ` Anand Jain
@ 2015-04-27  8:01   ` Wolfgang Mader
  0 siblings, 0 replies; 5+ messages in thread
From: Wolfgang Mader @ 2015-04-27  8:01 UTC (permalink / raw)
  To: Anand Jain; +Cc: linux-btrfs

On Monday, April 27, 2015 12:48:07 PM Anand Jain wrote:
> On 04/27/2015 02:39 AM, Wolfgang Mader wrote:
> > Hello,
> > 
> > I have a raid10 with one device missing. I would like to use btrfs replace
> > to replace it. However, I am unsure on how to obtain the devid of the
> > missing device. Having the filesystem mounted in degraded mode under mnt,
> > btrfs fs
>   At the user end there is no way. unless you want to use gdb and dump
>   the fs_uuids and check.
> 
>   Submitted these patches as of now to obtain from the logs. Will
>   help in the situation when device is missing at the time of mount.
> 
> Btrfs: check error before reporting missing device and add uuid
> Btrfs: log when missing device is created
> 
>   For long term we have sysfs interface, patches are in the ML if you
>   want to tests.
> 
> Good luck.
> 
> Anand

Great. Thank you for patching this in.

Best,
Ẃolfgang

> 
> 
> --
> 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


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

end of thread, other threads:[~2015-04-27  8:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-26 18:39 How to get the devid of a missing device Wolfgang Mader
2015-04-27  2:11 ` Duncan
2015-04-27  8:00   ` Wolfgang Mader
2015-04-27  4:48 ` Anand Jain
2015-04-27  8:01   ` Wolfgang Mader

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).