public inbox for linux-bcache@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Wheeler <bcache@lists.ewheeler.net>
To: Clodoaldo Neto <clodoaldo.pinto.neto@gmail.com>
Cc: linux-bcache@vger.kernel.org
Subject: Re: Can't mount an encrypted backing device
Date: Thu, 16 Jan 2020 22:55:06 +0000 (UTC)	[thread overview]
Message-ID: <alpine.LRH.2.11.2001162250480.23088@mx.ewheeler.net> (raw)
In-Reply-To: <CA+Z73LFDs0zGk+24r7XG=oXDZU=wV34GpvAODY96BFXZxrbdhw@mail.gmail.com>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 9068 bytes --]

On Sat, 11 Jan 2020, Clodoaldo Neto wrote:

> On Mon, Jan 6, 2020 at 8:02 PM Eric Wheeler <bcache@lists.ewheeler.net> wrote:
> >
> > On Sun, 5 Jan 2020, Clodoaldo Neto wrote:
> >
> > > I'm struggling to mount an encrypted backing device. The backing
> > > device is a RAID 1 array at /dev/md127 and the cache device is
> > > /dev/sdb1.
> > >
> > > # lsblk
> > > NAME                                          MAJ:MIN RM   SIZE RO
> > > TYPE  MOUNTPOINT
> > > sda                                             8:0    0 223.6G  0 disk
> > > ├─sda1                                          8:1    0   700M  0 part  /boot
> > > ├─sda2                                          8:2    0   700M  0
> > > part  /boot/efi
> > > ├─sda3                                          8:3    0    26G  0 part
> > > │ └─luks-9793c78f-723c-4218-865f-83dbc4659192 253:1    0    26G  0 crypt [SWAP]
> > > └─sda4                                          8:4    0   162G  0 part
> > >   └─luks-569b1153-2fab-4984-b1b6-c4a02ee206ef 253:0    0   162G  0 crypt /
> > > sdb                                             8:16   0 111.8G  0 disk
> > > ├─sdb1                                          8:17   0    40G  0 part
> > > └─sdb2                                          8:18   0  71.8G  0 part
> > > sdc                                             8:32   0   1.8T  0 disk
> > > └─sdc1                                          8:33   0   1.8T  0 part
> > >   └─md127                                       9:127  0   1.8T  0 raid1
> > > sdd                                             8:48   0   1.8T  0 disk
> > > └─sdd1                                          8:49   0   1.8T  0 part
> > >   └─md127                                       9:127  0   1.8T  0 raid1
> > > sde                                             8:64   1  58.9G  0 disk
> > > ├─sde1                                          8:65   1    20G  0 part
> > > └─sde2                                          8:66   1  38.9G  0 part
> > > sr0                                            11:0    1  1024M  0 rom
> > >
> > > # blkid | grep -E "md127|sdb1"
> > > /dev/sdb1: UUID="535bfa2d-4c6e-4c19-91b2-d292872a1877" TYPE="bcache"
> > > PARTLABEL="Linux filesystem"
> > > PARTUUID="505789f1-0523-4c62-bdb1-81bc0cc7bff1"
> > > /dev/md127: UUID="b17ceaac-27ec-44d8-8bbb-235cfaa0c4a4" TYPE="bcache"
> > >
> > > It was working right when I installed Fedora 31 yesterday but then I
> > > resized the caching partition and I can't make it work again.
> > >
> > > This is what I tried
> > >
> > > # wipefs -a /dev/sdb1
> > > /dev/sdb1: 16 bytes were erased at offset 0x00001018 (bcache): c6 85
> > > 73 f6 4e 1a 45 ca 82 65 f5 7f 48 ba 6d 81
> > >
> > > # make-bcache -C --writeback /dev/sdb1
> > > UUID:                   eb7d8e72-f24c-48ee-bad0-771afccca876
> > > Set UUID:               50e33260-4623-4374-9a61-c78b7d75280e
> > > version:                0
> > > nbuckets:               81920
> > > block_size:             1
> > > bucket_size:            1024
> > > nr_in_set:              1
> > > nr_this_dev:            0
> > > first_bucket:           1
> > >
> > > # ll /sys/fs/bcache/
> > > total 0
> > > drwxr-xr-x. 7 root root    0 Jan  5 18:34 50e33260-4623-4374-9a61-c78b7d75280e
> > > --w-------. 1 root root 4096 Jan  5 17:39 pendings_cleanup
> > > --w-------. 1 root root 4096 Jan  5 18:03 register
> > > --w-------. 1 root root 4096 Jan  5 17:39 register_quiet
> > >
> > > # bcache-super-show /dev/sdb1
> > > sb.magic                ok
> > > sb.first_sector         8 [match]
> > > sb.csum                 C4CB62916B7825CE [match]
> > > sb.version              3 [cache device]
> > >
> > > dev.label               (empty)
> > > dev.uuid                eb7d8e72-f24c-48ee-bad0-771afccca876
> > > dev.sectors_per_block   1
> > > dev.sectors_per_bucket  1024
> > > dev.cache.first_sector  1024
> > > dev.cache.cache_sectors 83885056
> > > dev.cache.total_sectors 83886080
> > > dev.cache.ordered       yes
> > > dev.cache.discard       no
> > > dev.cache.pos           0
> > > dev.cache.replacement   0 [lru]
> > >
> > > cset.uuid               50e33260-4623-4374-9a61-c78b7d75280e
> > >
> > > # echo /dev/md127 > /sys/fs/bcache/register
> > > # echo 50e33260-4623-4374-9a61-c78b7d75280e > /sys/block/md127/bcache/attach
> > > # blkid | grep bcache0
> > > /dev/bcache0: UUID="7e2c0b40-8dec-4b13-8d00-b53b55160775" TYPE="crypto_LUKS"
> > >
> > > # bcache-status
> > > --- bcache ---
> > > UUID                        50e33260-4623-4374-9a61-c78b7d75280e
> > > Block Size                  512 B
> > > Bucket Size                 512.00 KiB
> > > Congested?                  False
> > > Read Congestion             2.0ms
> > > Write Congestion            20.0ms
> > > Total Cache Size            40 GiB
> > > Total Cache Used            409.6 MiB   (1%)
> > > Total Cache Unused          40 GiB      (99%)
> > > Evictable Cache             40 GiB      (100%)
> > > Replacement Policy          [lru] fifo random
> > > Cache Mode                  writethrough [writeback] writearound none
> > > Total Hits                  9   (64%)
> > > Total Misses                5
> > > Total Bypass Hits           13  (16%)
> > > Total Bypass Misses         64
> > > Total Bypassed              308.00 KiB
> > >
> > > # lsblk
> > > NAME                                          MAJ:MIN RM   SIZE RO
> > > TYPE  MOUNTPOINT
> > > sda                                             8:0    0 223.6G  0 disk
> > > ├─sda1                                          8:1    0   700M  0 part  /boot
> > > ├─sda2                                          8:2    0   700M  0
> > > part  /boot/efi
> > > ├─sda3                                          8:3    0    26G  0 part
> > > │ └─luks-9793c78f-723c-4218-865f-83dbc4659192 253:1    0    26G  0 crypt [SWAP]
> > > └─sda4                                          8:4    0   162G  0 part
> > >   └─luks-569b1153-2fab-4984-b1b6-c4a02ee206ef 253:0    0   162G  0 crypt /
> > > sdb                                             8:16   0 111.8G  0 disk
> > > ├─sdb1                                          8:17   0    40G  0 part
> > > │ └─bcache0                                   252:0    0   1.8T  0 disk
> > > └─sdb2                                          8:18   0  71.8G  0 part
> > > sdc                                             8:32   0   1.8T  0 disk
> > > └─sdc1                                          8:33   0   1.8T  0 part
> > >   └─md127                                       9:127  0   1.8T  0 raid1
> > >     └─bcache0                                 252:0    0   1.8T  0 disk
> > > sdd                                             8:48   0   1.8T  0 disk
> > > └─sdd1                                          8:49   0   1.8T  0 part
> > >   └─md127                                       9:127  0   1.8T  0 raid1
> > >     └─bcache0                                 252:0    0   1.8T  0 disk
> > > sde                                             8:64   1  58.9G  0 disk
> > > ├─sde1                                          8:65   1    20G  0 part
> > > └─sde2                                          8:66   1  38.9G  0 part
> > > sr0                                            11:0    1  1024M  0 rom
> > >
> > > # mount /dev/bcache0 /r
> > > mount: /r: unknown filesystem type 'crypto_LUKS'.
> > >
> > > # cryptsetup open /dev/bcache0 backing-device
> > > Enter passphrase for /dev/bcache0:
> > >
> > > # mount /dev/mapper/backing-device /r
> > > mount: /r: unknown filesystem type 'bcache'.
> >
> > I'm guessing that make-bcache was run upon /dev/mapper/backing-device at
> > some point in time. Hopefully it wasn't clobbered.
> >
> I guess you are right because /dev/mapper/backing-device is seen as a
> cache device:
> 
> # bcache-super-show /dev/mapper/backing-device
> sb.magic                ok
> sb.first_sector         8 [match]
> sb.csum                 D9C2336DD00A6E69 [match]
> sb.version              3 [cache device]
> 
> dev.label               (empty)
> dev.uuid                8022eea3-fcf0-40b8-850a-31e5f841d0bd
> dev.sectors_per_block   1
> dev.sectors_per_bucket  1024
> dev.cache.first_sector  1024
> dev.cache.cache_sectors 3774576640
> dev.cache.total_sectors 3774577664
> dev.cache.ordered       yes
> dev.cache.discard       no
> dev.cache.pos           0
> dev.cache.replacement   0 [lru]
> 
> cset.uuid               4a63d2b5-1568-473d-925d-53306af2ba7c
> 
> Is there a path to revert it? Like just formatting it to ext4?
> 
> > Try
> >
> > mount -t ext2 /dev/mapper/backing-device /r
> >          ^^^^ or whatever your original FS really was.
> >
> # mount /dev/mapper/backing-device /r
> mount: /r: unknown filesystem type 'bcache'.

I don't see a -t option to mount.  Does it work with -t ?

If not, and if the cache device is gone forever, you could try this to 
force the device online:

echo 1 > /sys/block/bcache0/bcache/run

> > --
> > Eric Wheeler
> >
> >
> > >
> > > What am I missing?
> > >
> > > Regards, Clodoaldo
> > >
> 

  reply	other threads:[~2020-01-16 22:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CA+Z73LFJLiP7Z2_cDUsO4Om_8pdD6w1jTSGQB0jY5sL-+nw1Wg@mail.gmail.com>
     [not found] ` <CA+Z73LGvXa_V8t=KYPkrmeJ-xmEXmz1uAnaT=Yj5AReZgLeqhg@mail.gmail.com>
     [not found]   ` <alpine.LRH.2.11.2001062258320.2074@mx.ewheeler.net>
2020-01-11 13:42     ` Can't mount an encrypted backing device Clodoaldo Neto
2020-01-16 22:55       ` Eric Wheeler [this message]
2020-01-18 10:44         ` Clodoaldo Neto
     [not found]   ` <65c05b80-679b-2ccb-1bd1-a9a6887c9c51@suse.de>
2020-01-13 12:44     ` undo make-bcache (was: Re: Can't mount an encrypted backing device) Jens-U. Mozdzen
2020-01-13 14:18       ` Coly Li
     [not found]         ` <CA+Z73LGG1pBtT=0WN5vEyqEvzxEnqMRZ26S_2x4Gd5JPSmuXmQ@mail.gmail.com>
     [not found]           ` <CA+Z73LFNxP8kDMSq74DBKDbCXpbtMA9svpc1KddkUmrk-cfnOA@mail.gmail.com>
     [not found]             ` <CA+Z73LGXJOwYEb+GmPuuDi3TcJbGG=NLv-5vCRcEvB+kgr4a+A@mail.gmail.com>
2020-01-16 21:56               ` Clodoaldo Neto
2020-01-16 23:00                 ` Eric Wheeler
2020-01-18 11:44                   ` Clodoaldo Neto
2020-01-17  0:58               ` Coly Li
2020-01-18 10:54                 ` Clodoaldo Neto
2020-01-18 12:22                   ` Clodoaldo Neto
2020-01-18 12:34                     ` Coly Li
2020-01-18 13:43                       ` Clodoaldo Neto
2020-01-18 14:16                         ` Coly Li
2020-01-18 14:31                           ` Coly Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LRH.2.11.2001162250480.23088@mx.ewheeler.net \
    --to=bcache@lists.ewheeler.net \
    --cc=clodoaldo.pinto.neto@gmail.com \
    --cc=linux-bcache@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox