public inbox for linux-bcache@vger.kernel.org
 help / color / mirror / Atom feed
* Hard to delete/unregister caching device
@ 2016-02-19  6:48 Marc MERLIN
  2016-02-21  4:17 ` Kent Overstreet
  0 siblings, 1 reply; 5+ messages in thread
From: Marc MERLIN @ 2016-02-19  6:48 UTC (permalink / raw)
  To: linux-bcache

So, I have this:
├─nvme0n1p4   259:4    0    30G part  bcache                   8fd98dbd-4e87-4faa-8cec-d5f1e3910daa ae581b32-8c62-41a9-bfcf-ca8cec66e46a
│ └─bcache0   252:0    0   1.1T disk  crypto_LUKS              d6c98ca4-23b4-4aa3-819b-b384d4ac1b6a 
│   └─pool2   251:3    0   1.1T crypt btrfs       /mnt/btrfs_p 5ed9d54d-2f12-4735-85c2-e0445a316088 
├─sda7          8:7    0   1.1T part  bcache                   6d88cea7-6cfc-4d30-8cf5-8c8b216e019d 753dca8b-07
│ └─bcache0   252:0    0   1.1T disk  crypto_LUKS              d6c98ca4-23b4-4aa3-819b-b384d4ac1b6a 
│   └─pool2   251:3    0   1.1T crypt btrfs       /mnt/btrfs_p 5ed9d54d-2f12-4735-85c2-e0445a316088 


├─sda6          8:6    0    65G part  bcache                   21c07a2c-6ed2-42c2-aafb-8e1bbfa471a5 753dca8b-06
└─sdb1          8:17   0   1.8T part  bcache                   b324cfc4-a5ae-4888-ad6c-a5ba1002fdce 89ba6da8-01
  └─bcache1   252:1    0   1.8T disk  crypto_LUKS              b519d6ce-291a-4500-937e-a5957e6ece6b 
    └─pool3   251:4    0   1.8T crypt btrfs       /mnt/btrfs_p 5874cad5-d6dd-4b3d-a455-4e0ae2611f09 

bcache0 is fine
bcache1 ended up in a bad state, I'm not sure how.
No biggie, right, just delete/recreate/re-register sda6, except how?

https://www.kernel.org/doc/Documentation/bcache.txt
SYSFS - CACHE DEVICE:
says nothing about how I can free/release sda6

saruman:~# echo /dev/sda6 > /sys/fs/bcache/unregister
-su: /sys/fs/bcache/unregister: Permission denied
is not helpful, nothing in kern.log

saruman:~# wipefs -a /dev/sda6
wipefs: error: /dev/sda6: probing initialization failed: Device or resource busy


saruman:~# l /dev/bcache/by-uuid/
total 0
drwxr-xr-x 2 root root 80 Feb 17 20:20 ./
drwxr-xr-x 3 root root 60 Feb 17 20:20 ../
lrwxrwxrwx 1 root root 13 Feb 17 20:20 6d88cea7-6cfc-4d30-8cf5-8c8b216e019d -> ../../bcache0
lrwxrwxrwx 1 root root 13 Feb 17 20:20 b324cfc4-a5ae-4888-ad6c-a5ba1002fdce -> ../../bcache1

Those UUIDs don't show up in lsblk

Oh my, what is this?
saruman:~# l /sys/block/sda/sda6/bcache/set
lrwxrwxrwx 1 root root 0 Feb 18 22:28 /sys/block/sda/sda6/bcache/set -> ../../../../../../../../../../../fs/bcache/f419195d-184e-44b7-9f88-a834a5458f8c/

This other UUID still does not show up in lsblk, by now I've lost count
of why I have 3 different kinds of UUIDs instead of 2.

Mmmh, now I'm starting to get it, I have to look at caching devices by UUID, find the right one, and stop it:
saruman:/sys/fs/bcache# l
total 0
drwxr-xr-x  5 root root    0 Feb 18 22:32 ./
drwxr-xr-x 10 root root    0 Feb 17 20:20 ../
drwxr-xr-x  7 root root    0 Feb 18 22:07 6698753e-78d0-4f6a-a8cb-fbb6a20ddae8/
drwxr-xr-x  7 root root    0 Feb 18 22:07 b7ba27a1-2398-4649-8ae3-0959f57ba128/
drwxr-xr-x  7 root root    0 Feb 18 22:32 f419195d-184e-44b7-9f88-a834a5458f8c/

Ok, let's try
saruman:/sys/fs/bcache/f419195d-184e-44b7-9f88-a834a5458f8c# echo 1 > stop

Ah, success:
saruman:~# wipefs -a /dev/sda6
/dev/sda6: 16 bytes were erased at offset 0x00001018 (bcache): c6 85 73 f6 4e 1a 45 ca 82 65 f5 7f 48 ba 6d 81

This isn't super obvious :)
Is there a howto document where those steps could be documented in a howto fashion?
(removing a caching device and replacing it with another one, maybe you got a bigger/faster SSD)

In https://www.kernel.org/doc/Documentation/bcache.txt or otherwise?

Thanks,
Marc
-- 
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems ....
                                      .... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/                         | PGP 1024R/763BE901

^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: Hard to delete/unregister caching device
@ 2016-02-24 19:13 Eric Wheeler
  2016-02-24 21:30 ` Marc MERLIN
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Wheeler @ 2016-02-24 19:13 UTC (permalink / raw)
  To: Marc MERLIN; +Cc: Kent Overstreet, linux-bcache


On Sun, 21 Feb 2016, Marc MERLIN wrote:

> On Sat, Feb 20, 2016 at 07:17:53PM -0900, Kent Overstreet wrote:
> > > bcache0 is fine
> > > bcache1 ended up in a bad state, I'm not sure how.
> > > No biggie, right, just delete/recreate/re-register sda6, except how?
> > > 
> > > https://www.kernel.org/doc/Documentation/bcache.txt
> > > SYSFS - CACHE DEVICE:
> > > says nothing about how I can free/release sda6
> > > 
> > > saruman:~# echo /dev/sda6 > /sys/fs/bcache/unregister
> > > -su: /sys/fs/bcache/unregister: Permission denied
> > > is not helpful, nothing in kern.log
> > 
> > echo 1 > /sys/fs/bcache/<uuid>/unregister
> 
> If you look lower down in my Email, I did do almost the same:
> saruman:/sys/fs/bcache/f419195d-184e-44b7-9f88-a834a5458f8c# echo 1 > stop
> 
> I was pointing out that for a newcomer, it's not all super obvious how
> all the pieces fit together.
> 
> Is https://www.kernel.org/doc/Documentation/bcache.txt still considered
> the canonical documentation?
> I could try writing some kind of howto update for it if so.

It is, or at least it would be ideal to have up to date.  By all means, 
write a patch and submit it!  Documentation patches are some of the most 
important to support the userbase.

-Eric

> 
> Marc
> -- 
> "A mouse is a device used to point at the xterm you want to type in" - A.S.R.
> Microsoft is to operating systems ....
>                                       .... what McDonalds is to gourmet cooking
> Home page: http://marc.merlins.org/                         | PGP 1024R/763BE901
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bcache" 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:[~2016-02-24 21:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-19  6:48 Hard to delete/unregister caching device Marc MERLIN
2016-02-21  4:17 ` Kent Overstreet
2016-02-21 21:22   ` Marc MERLIN
  -- strict thread matches above, loose matches on Subject: below --
2016-02-24 19:13 Eric Wheeler
2016-02-24 21:30 ` Marc MERLIN

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox