* Re: Can't mount an encrypted backing device [not found] ` <alpine.LRH.2.11.2001062258320.2074@mx.ewheeler.net> @ 2020-01-11 13:42 ` Clodoaldo Neto 2020-01-16 22:55 ` Eric Wheeler 0 siblings, 1 reply; 15+ messages in thread From: Clodoaldo Neto @ 2020-01-11 13:42 UTC (permalink / raw) To: Eric Wheeler; +Cc: linux-bcache 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'. > -- > Eric Wheeler > > > > > > What am I missing? > > > > Regards, Clodoaldo > > ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Can't mount an encrypted backing device 2020-01-11 13:42 ` Can't mount an encrypted backing device Clodoaldo Neto @ 2020-01-16 22:55 ` Eric Wheeler 2020-01-18 10:44 ` Clodoaldo Neto 0 siblings, 1 reply; 15+ messages in thread From: Eric Wheeler @ 2020-01-16 22:55 UTC (permalink / raw) To: Clodoaldo Neto; +Cc: linux-bcache [-- 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 > > > > ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Can't mount an encrypted backing device 2020-01-16 22:55 ` Eric Wheeler @ 2020-01-18 10:44 ` Clodoaldo Neto 0 siblings, 0 replies; 15+ messages in thread From: Clodoaldo Neto @ 2020-01-18 10:44 UTC (permalink / raw) To: Eric Wheeler; +Cc: linux-bcache On Thu, Jan 16, 2020 at 7:55 PM Eric Wheeler <bcache@lists.ewheeler.net> wrote: > > 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 ? # mount -t ext4 /dev/mapper/backing-device /r mount: /r: wrong fs type, bad option, bad superblock on /dev/mapper/backing-device, missing codepage or helper program, or other error. > > 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 > I will reserve it for later > > > -- > > > Eric Wheeler > > > > > > > > > > > > > > What am I missing? > > > > > > > > Regards, Clodoaldo > > > > > > ^ permalink raw reply [flat|nested] 15+ messages in thread
[parent not found: <65c05b80-679b-2ccb-1bd1-a9a6887c9c51@suse.de>]
* undo make-bcache (was: Re: Can't mount an encrypted backing device) [not found] ` <65c05b80-679b-2ccb-1bd1-a9a6887c9c51@suse.de> @ 2020-01-13 12:44 ` Jens-U. Mozdzen 2020-01-13 14:18 ` Coly Li 0 siblings, 1 reply; 15+ messages in thread From: Jens-U. Mozdzen @ 2020-01-13 12:44 UTC (permalink / raw) To: Coly Li; +Cc: linux-bcache Hi Coly, jumping in here, because I was looking for a way to revert from bcache to plain device: Zitat von Coly Li <colyli@suse.de>: > The super block location of the backing disk is occupied by bcache. You > cannot mount the file system directly from the backing disk which is > formated as bcache backing device [...] (bcache offset all I/Os on > bcache device 4KB behind the requesting > LBA on backing disk). Assuming that no caching device is associated with a backing device (so the backing device is "clean" as in "containing all data blocks with the current content"), could one convert the content of a backing device to a "non-bcached device" by removing the first 4096 octets of the backing device content? Something like "dd if=backingdev of=newdev skip_bytes=4096 ..."? Regards, J ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: undo make-bcache (was: Re: Can't mount an encrypted backing device) 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> 0 siblings, 1 reply; 15+ messages in thread From: Coly Li @ 2020-01-13 14:18 UTC (permalink / raw) To: Jens-U. Mozdzen; +Cc: linux-bcache On 2020/1/13 8:44 下午, Jens-U. Mozdzen wrote: > Hi Coly, > > jumping in here, because I was looking for a way to revert from bcache > to plain device: > > Zitat von Coly Li <colyli@suse.de>: >> The super block location of the backing disk is occupied by bcache. You >> cannot mount the file system directly from the backing disk which is >> formated as bcache backing device [...] (bcache offset all I/Os on >> bcache device 4KB behind the requesting >> LBA on backing disk). > > Assuming that no caching device is associated with a backing device (so > the backing device is "clean" as in "containing all data blocks with the > current content"), could one convert the content of a backing device to > a "non-bcached device" by removing the first 4096 octets of the backing > device content? > > Something like "dd if=backingdev of=newdev skip_bytes=4096 ..."? Hi Jens-U, you may try dmsetup to setup a linear device mapper target, and the map table just skipping the first 4KB (bcache superblock area). If you are lucky, I mean the real file system is not corrupted, the created device mapper target can be mounted directly. -- Coly Li ^ permalink raw reply [flat|nested] 15+ messages in thread
[parent not found: <CA+Z73LGG1pBtT=0WN5vEyqEvzxEnqMRZ26S_2x4Gd5JPSmuXmQ@mail.gmail.com>]
[parent not found: <CA+Z73LFNxP8kDMSq74DBKDbCXpbtMA9svpc1KddkUmrk-cfnOA@mail.gmail.com>]
[parent not found: <CA+Z73LGXJOwYEb+GmPuuDi3TcJbGG=NLv-5vCRcEvB+kgr4a+A@mail.gmail.com>]
* Re: undo make-bcache (was: Re: Can't mount an encrypted backing device) [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-17 0:58 ` Coly Li 1 sibling, 1 reply; 15+ messages in thread From: Clodoaldo Neto @ 2020-01-16 21:56 UTC (permalink / raw) To: linux-bcache Em seg, 13 de jan de 2020 11:19, Coly Li <colyli@suse.de> escreveu: > > On 2020/1/13 8:44 下午, Jens-U. Mozdzen wrote: > > Hi Coly, > > > > jumping in here, because I was looking for a way to revert from bcache > > to plain device: > > > > Zitat von Coly Li <colyli@suse.de>: > >> The super block location of the backing disk is occupied by bcache. You > >> cannot mount the file system directly from the backing disk which is > >> formated as bcache backing device [...] (bcache offset all I/Os on > >> bcache device 4KB behind the requesting > >> LBA on backing disk). > > > > Assuming that no caching device is associated with a backing device (so > > the backing device is "clean" as in "containing all data blocks with the > > current content"), could one convert the content of a backing device to > > a "non-bcached device" by removing the first 4096 octets of the backing > > device content? > > > > Something like "dd if=backingdev of=newdev skip_bytes=4096 ..."? > > Hi Jens-U, > > you may try dmsetup to setup a linear device mapper target, and the map > table just skipping the first 4KB (bcache superblock area). If you are > lucky, I mean the real file system is not corrupted, the created device > mapper target can be mounted directly. I'm trying dmsetup but it does not accept anything other than 0 and 0 at the beginning and end of the table: # echo '0 3774578672 linear /dev/mapper/backing-device 8' | dmsetup create dmb device-mapper: reload ioctl on dmb failed: Invalid argument Command failed. # echo '8 3774578664 linear /dev/mapper/backing-device 0' | dmsetup create dmb device-mapper: reload ioctl on dmb failed: Invalid argument Command failed. I'm not sure about how it works. Is it not 8 sectors for 4k bytes? Clodoaldo > > -- > > Coly Li > ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: undo make-bcache (was: Re: Can't mount an encrypted backing device) 2020-01-16 21:56 ` Clodoaldo Neto @ 2020-01-16 23:00 ` Eric Wheeler 2020-01-18 11:44 ` Clodoaldo Neto 0 siblings, 1 reply; 15+ messages in thread From: Eric Wheeler @ 2020-01-16 23:00 UTC (permalink / raw) To: Clodoaldo Neto; +Cc: linux-bcache [-- Attachment #1: Type: TEXT/PLAIN, Size: 1902 bytes --] On Thu, 16 Jan 2020, Clodoaldo Neto wrote: > Em seg, 13 de jan de 2020 11:19, Coly Li <colyli@suse.de> escreveu: > > > > On 2020/1/13 8:44 下午, Jens-U. Mozdzen wrote: > > > Hi Coly, > > > > > > jumping in here, because I was looking for a way to revert from bcache > > > to plain device: > > > > > > Zitat von Coly Li <colyli@suse.de>: > > >> The super block location of the backing disk is occupied by bcache. You > > >> cannot mount the file system directly from the backing disk which is > > >> formated as bcache backing device [...] (bcache offset all I/Os on > > >> bcache device 4KB behind the requesting > > >> LBA on backing disk). > > > > > > Assuming that no caching device is associated with a backing device (so > > > the backing device is "clean" as in "containing all data blocks with the > > > current content"), could one convert the content of a backing device to > > > a "non-bcached device" by removing the first 4096 octets of the backing > > > device content? > > > > > > Something like "dd if=backingdev of=newdev skip_bytes=4096 ..."? > > > > Hi Jens-U, > > > > you may try dmsetup to setup a linear device mapper target, and the map > > table just skipping the first 4KB (bcache superblock area). If you are > > lucky, I mean the real file system is not corrupted, the created device > > mapper target can be mounted directly. > > > I'm trying dmsetup but it does not accept anything other than 0 and 0 > at the beginning and end of the table: > > # echo '0 3774578672 linear /dev/mapper/backing-device 8' | dmsetup create dmb > device-mapper: reload ioctl on dmb failed: Invalid argument > Command failed. > > # echo '8 3774578664 linear /dev/mapper/backing-device 0' | dmsetup create dmb > device-mapper: reload ioctl on dmb failed: Invalid argument > Command failed. > > I'm not sure about how it works. Is it not 8 sectors for 4k bytes? Does dmesg give a hint? ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: undo make-bcache (was: Re: Can't mount an encrypted backing device) 2020-01-16 23:00 ` Eric Wheeler @ 2020-01-18 11:44 ` Clodoaldo Neto 0 siblings, 0 replies; 15+ messages in thread From: Clodoaldo Neto @ 2020-01-18 11:44 UTC (permalink / raw) To: Eric Wheeler; +Cc: linux-bcache On Thu, Jan 16, 2020 at 8:01 PM Eric Wheeler <bcache@lists.ewheeler.net> wrote: > > On Thu, 16 Jan 2020, Clodoaldo Neto wrote: > > > Em seg, 13 de jan de 2020 11:19, Coly Li <colyli@suse.de> escreveu: > > > > > > On 2020/1/13 8:44 下午, Jens-U. Mozdzen wrote: > > > > Hi Coly, > > > > > > > > jumping in here, because I was looking for a way to revert from bcache > > > > to plain device: > > > > > > > > Zitat von Coly Li <colyli@suse.de>: > > > >> The super block location of the backing disk is occupied by bcache. You > > > >> cannot mount the file system directly from the backing disk which is > > > >> formated as bcache backing device [...] (bcache offset all I/Os on > > > >> bcache device 4KB behind the requesting > > > >> LBA on backing disk). > > > > > > > > Assuming that no caching device is associated with a backing device (so > > > > the backing device is "clean" as in "containing all data blocks with the > > > > current content"), could one convert the content of a backing device to > > > > a "non-bcached device" by removing the first 4096 octets of the backing > > > > device content? > > > > > > > > Something like "dd if=backingdev of=newdev skip_bytes=4096 ..."? > > > > > > Hi Jens-U, > > > > > > you may try dmsetup to setup a linear device mapper target, and the map > > > table just skipping the first 4KB (bcache superblock area). If you are > > > lucky, I mean the real file system is not corrupted, the created device > > > mapper target can be mounted directly. > > > > > > I'm trying dmsetup but it does not accept anything other than 0 and 0 > > at the beginning and end of the table: > > > > # echo '0 3774578672 linear /dev/mapper/backing-device 8' | dmsetup create dmb > > device-mapper: reload ioctl on dmb failed: Invalid argument > > Command failed. > > > > # echo '8 3774578664 linear /dev/mapper/backing-device 0' | dmsetup create dmb > > device-mapper: reload ioctl on dmb failed: Invalid argument > > Command failed. > > > > I'm not sure about how it works. Is it not 8 sectors for 4k bytes? > > Does dmesg give a hint? > # echo '0 3774578672 linear /dev/mapper/backing-device 8' | dmsetup create dmb device-mapper: reload ioctl on dmb failed: Invalid argument Command failed. # dmesg | grep -E "bcache|device-mapper" [ 0.854520] device-mapper: uevent: version 1.0.3 [ 0.854586] device-mapper: ioctl: 4.41.0-ioctl (2019-09-16) initialised: dm-devel@redhat.com [ 52.719925] bcache: bch_journal_replay() journal replay done, 0 keys in 1 entries, seq 1 [ 52.722965] bcache: register_cache() registered cache device sdb1 [ 52.934796] bcache: register_bdev() registered backing device md127 [ 55.628944] bcache: bch_journal_replay() journal replay done, 0 keys in 1 entries, seq 31 [ 55.629200] bcache: register_cache() registered cache device dm-2 [ 851.024624] device-mapper: table: 253:3: linear: Gap in table [ 851.024626] device-mapper: ioctl: error adding target to table > > -- > Eric Wheeler > > > > > > > > > Clodoaldo > > > > > > > > -- > > > > > > Coly Li > > > > > ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: undo make-bcache (was: Re: Can't mount an encrypted backing device) [not found] ` <CA+Z73LGXJOwYEb+GmPuuDi3TcJbGG=NLv-5vCRcEvB+kgr4a+A@mail.gmail.com> 2020-01-16 21:56 ` Clodoaldo Neto @ 2020-01-17 0:58 ` Coly Li 2020-01-18 10:54 ` Clodoaldo Neto 1 sibling, 1 reply; 15+ messages in thread From: Coly Li @ 2020-01-17 0:58 UTC (permalink / raw) To: clodoaldo.pinto.neto; +Cc: Jens-U. Mozdzen, linux-bcache On 2020/1/17 5:52 上午, Clodoaldo Neto wrote: > > Em seg, 13 de jan de 2020 11:19, Coly Li <colyli@suse.de > <mailto:colyli@suse.de>> escreveu: >> >> On 2020/1/13 8:44 下午, Jens-U. Mozdzen wrote: >> > Hi Coly, >> > >> > jumping in here, because I was looking for a way to revert from bcache >> > to plain device: >> > >> > Zitat von Coly Li <colyli@suse.de <mailto:colyli@suse.de>>: >> >> The super block location of the backing disk is occupied by bcache. You >> >> cannot mount the file system directly from the backing disk which is >> >> formated as bcache backing device [...] (bcache offset all I/Os on >> >> bcache device 4KB behind the requesting >> >> LBA on backing disk). >> > >> > Assuming that no caching device is associated with a backing device (so >> > the backing device is "clean" as in "containing all data blocks with the >> > current content"), could one convert the content of a backing device to >> > a "non-bcached device" by removing the first 4096 octets of the backing >> > device content? >> > >> > Something like "dd if=backingdev of=newdev skip_bytes=4096 ..."? >> >> Hi Jens-U, >> >> you may try dmsetup to setup a linear device mapper target, and the map >> table just skipping the first 4KB (bcache superblock area). If you are >> lucky, I mean the real file system is not corrupted, the created device >> mapper target can be mounted directly. > > > I'm trying dmsetup but it does not accept anything other than 0 and 0 > at the beginning and end of the table: > > # echo '0 3774578672 linear /dev/mapper/backing-device 8' | dmsetup > create dmb > device-mapper: reload ioctl on dmb failed: Invalid argument > Command failed. The above line should work, if 3774578672 is a correct size number in sectors. > > # echo '8 3774578664 linear /dev/mapper/backing-device 0' | dmsetup > create dmb > device-mapper: reload ioctl on dmb failed: Invalid argument > Command failed. > > I'm not sure about how it works. Is it not 8 sectors for 4k bytes? > It works on my side, my kernel is Linux v5.5-rc2, lvm2 version is 2.02.180, dmsetup version is 1.02.149. The difference is the device size, my disk size is much less. -- Coly Li ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: undo make-bcache (was: Re: Can't mount an encrypted backing device) 2020-01-17 0:58 ` Coly Li @ 2020-01-18 10:54 ` Clodoaldo Neto 2020-01-18 12:22 ` Clodoaldo Neto 0 siblings, 1 reply; 15+ messages in thread From: Clodoaldo Neto @ 2020-01-18 10:54 UTC (permalink / raw) To: Coly Li; +Cc: Jens-U. Mozdzen, linux-bcache On Thu, Jan 16, 2020 at 9:59 PM Coly Li <colyli@suse.de> wrote: > > On 2020/1/17 5:52 上午, Clodoaldo Neto wrote: > > > > Em seg, 13 de jan de 2020 11:19, Coly Li <colyli@suse.de > > <mailto:colyli@suse.de>> escreveu: > >> > >> On 2020/1/13 8:44 下午, Jens-U. Mozdzen wrote: > >> > Hi Coly, > >> > > >> > jumping in here, because I was looking for a way to revert from bcache > >> > to plain device: > >> > > >> > Zitat von Coly Li <colyli@suse.de <mailto:colyli@suse.de>>: > >> >> The super block location of the backing disk is occupied by bcache. You > >> >> cannot mount the file system directly from the backing disk which is > >> >> formated as bcache backing device [...] (bcache offset all I/Os on > >> >> bcache device 4KB behind the requesting > >> >> LBA on backing disk). > >> > > >> > Assuming that no caching device is associated with a backing device (so > >> > the backing device is "clean" as in "containing all data blocks with the > >> > current content"), could one convert the content of a backing device to > >> > a "non-bcached device" by removing the first 4096 octets of the backing > >> > device content? > >> > > >> > Something like "dd if=backingdev of=newdev skip_bytes=4096 ..."? > >> > >> Hi Jens-U, > >> > >> you may try dmsetup to setup a linear device mapper target, and the map > >> table just skipping the first 4KB (bcache superblock area). If you are > >> lucky, I mean the real file system is not corrupted, the created device > >> mapper target can be mounted directly. > > > > > > I'm trying dmsetup but it does not accept anything other than 0 and 0 > > at the beginning and end of the table: > > > > # echo '0 3774578672 linear /dev/mapper/backing-device 8' | dmsetup > > create dmb > > device-mapper: reload ioctl on dmb failed: Invalid argument > > Command failed. > > The above line should work, if 3774578672 is a correct size number in > sectors. I took it from the original map: # dmsetup table /dev/mapper/backing-device 0 3774578672 crypt aes-xts-plain64 :64:logon:cryptsetup:7e2c0b40-8dec-4b13-8d00-b53b55160775-d0 0 251:0 32768 > > > > > # echo '8 3774578664 linear /dev/mapper/backing-device 0' | dmsetup > > create dmb > > device-mapper: reload ioctl on dmb failed: Invalid argument > > Command failed. > > > > I'm not sure about how it works. Is it not 8 sectors for 4k bytes? > > > > It works on my side, my kernel is Linux v5.5-rc2, lvm2 version is > 2.02.180, dmsetup version is 1.02.149. The difference is the device > size, my disk size is much less. > > -- > > Coly Li ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: undo make-bcache (was: Re: Can't mount an encrypted backing device) 2020-01-18 10:54 ` Clodoaldo Neto @ 2020-01-18 12:22 ` Clodoaldo Neto 2020-01-18 12:34 ` Coly Li 0 siblings, 1 reply; 15+ messages in thread From: Clodoaldo Neto @ 2020-01-18 12:22 UTC (permalink / raw) To: Coly Li; +Cc: Jens-U. Mozdzen, linux-bcache On Sat, Jan 18, 2020 at 7:54 AM Clodoaldo Neto <clodoaldo.pinto.neto@gmail.com> wrote: > > On Thu, Jan 16, 2020 at 9:59 PM Coly Li <colyli@suse.de> wrote: > > > > On 2020/1/17 5:52 上午, Clodoaldo Neto wrote: > > > > > > Em seg, 13 de jan de 2020 11:19, Coly Li <colyli@suse.de > > > <mailto:colyli@suse.de>> escreveu: > > >> > > >> On 2020/1/13 8:44 下午, Jens-U. Mozdzen wrote: > > >> > Hi Coly, > > >> > > > >> > jumping in here, because I was looking for a way to revert from bcache > > >> > to plain device: > > >> > > > >> > Zitat von Coly Li <colyli@suse.de <mailto:colyli@suse.de>>: > > >> >> The super block location of the backing disk is occupied by bcache. You > > >> >> cannot mount the file system directly from the backing disk which is > > >> >> formated as bcache backing device [...] (bcache offset all I/Os on > > >> >> bcache device 4KB behind the requesting > > >> >> LBA on backing disk). > > >> > > > >> > Assuming that no caching device is associated with a backing device (so > > >> > the backing device is "clean" as in "containing all data blocks with the > > >> > current content"), could one convert the content of a backing device to > > >> > a "non-bcached device" by removing the first 4096 octets of the backing > > >> > device content? > > >> > > > >> > Something like "dd if=backingdev of=newdev skip_bytes=4096 ..."? > > >> > > >> Hi Jens-U, > > >> > > >> you may try dmsetup to setup a linear device mapper target, and the map > > >> table just skipping the first 4KB (bcache superblock area). If you are > > >> lucky, I mean the real file system is not corrupted, the created device > > >> mapper target can be mounted directly. > > > > > > > > > I'm trying dmsetup but it does not accept anything other than 0 and 0 > > > at the beginning and end of the table: > > > > > > # echo '0 3774578672 linear /dev/mapper/backing-device 8' | dmsetup > > > create dmb > > > device-mapper: reload ioctl on dmb failed: Invalid argument > > > Command failed. > > > > The above line should work, if 3774578672 is a correct size number in > > sectors. > > I took it from the original map: > > # dmsetup table /dev/mapper/backing-device > 0 3774578672 crypt aes-xts-plain64 > :64:logon:cryptsetup:7e2c0b40-8dec-4b13-8d00-b53b55160775-d0 0 251:0 > 32768 It works like this: # echo '0 3774578664 linear /dev/mapper/backing-device 8' | dmsetup create dmb But then I can't mount it: # mount /dev/mapper/dmb /r mount: /r: wrong fs type, bad option, bad superblock on /dev/mapper/dmb, missing codepage or helper program, or other error. > > > > > > > > > # echo '8 3774578664 linear /dev/mapper/backing-device 0' | dmsetup > > > create dmb > > > device-mapper: reload ioctl on dmb failed: Invalid argument > > > Command failed. > > > > > > I'm not sure about how it works. Is it not 8 sectors for 4k bytes? > > > > > > > It works on my side, my kernel is Linux v5.5-rc2, lvm2 version is > > 2.02.180, dmsetup version is 1.02.149. The difference is the device > > size, my disk size is much less. > > > > -- > > > > Coly Li ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: undo make-bcache (was: Re: Can't mount an encrypted backing device) 2020-01-18 12:22 ` Clodoaldo Neto @ 2020-01-18 12:34 ` Coly Li 2020-01-18 13:43 ` Clodoaldo Neto 0 siblings, 1 reply; 15+ messages in thread From: Coly Li @ 2020-01-18 12:34 UTC (permalink / raw) To: clodoaldo.pinto.neto; +Cc: Jens-U. Mozdzen, linux-bcache On 2020/1/18 8:22 下午, Clodoaldo Neto wrote: > On Sat, Jan 18, 2020 at 7:54 AM Clodoaldo Neto > <clodoaldo.pinto.neto@gmail.com> wrote: >> >> On Thu, Jan 16, 2020 at 9:59 PM Coly Li <colyli@suse.de> wrote: >>> >>> On 2020/1/17 5:52 上午, Clodoaldo Neto wrote: >>>> >>>> Em seg, 13 de jan de 2020 11:19, Coly Li <colyli@suse.de >>>> <mailto:colyli@suse.de>> escreveu: >>>>> >>>>> On 2020/1/13 8:44 下午, Jens-U. Mozdzen wrote: >>>>>> Hi Coly, >>>>>> >>>>>> jumping in here, because I was looking for a way to revert from bcache >>>>>> to plain device: >>>>>> >>>>>> Zitat von Coly Li <colyli@suse.de <mailto:colyli@suse.de>>: >>>>>>> The super block location of the backing disk is occupied by bcache. You >>>>>>> cannot mount the file system directly from the backing disk which is >>>>>>> formated as bcache backing device [...] (bcache offset all I/Os on >>>>>>> bcache device 4KB behind the requesting >>>>>>> LBA on backing disk). >>>>>> >>>>>> Assuming that no caching device is associated with a backing device (so >>>>>> the backing device is "clean" as in "containing all data blocks with the >>>>>> current content"), could one convert the content of a backing device to >>>>>> a "non-bcached device" by removing the first 4096 octets of the backing >>>>>> device content? >>>>>> >>>>>> Something like "dd if=backingdev of=newdev skip_bytes=4096 ..."? >>>>> >>>>> Hi Jens-U, >>>>> >>>>> you may try dmsetup to setup a linear device mapper target, and the map >>>>> table just skipping the first 4KB (bcache superblock area). If you are >>>>> lucky, I mean the real file system is not corrupted, the created device >>>>> mapper target can be mounted directly. >>>> >>>> >>>> I'm trying dmsetup but it does not accept anything other than 0 and 0 >>>> at the beginning and end of the table: >>>> >>>> # echo '0 3774578672 linear /dev/mapper/backing-device 8' | dmsetup >>>> create dmb >>>> device-mapper: reload ioctl on dmb failed: Invalid argument >>>> Command failed. >>> >>> The above line should work, if 3774578672 is a correct size number in >>> sectors. >> >> I took it from the original map: >> >> # dmsetup table /dev/mapper/backing-device >> 0 3774578672 crypt aes-xts-plain64 >> :64:logon:cryptsetup:7e2c0b40-8dec-4b13-8d00-b53b55160775-d0 0 251:0 >> 32768 > > It works like this: > > # echo '0 3774578664 linear /dev/mapper/backing-device 8' | dmsetup create dmb > > But then I can't mount it: > > # mount /dev/mapper/dmb /r > mount: /r: wrong fs type, bad option, bad superblock on > /dev/mapper/dmb, missing codepage or helper program, or other error. It might be my fault, from bcache-tools, it seems the offset is BDEV_DATA_START_DEFAULT (16 sectors). How about: # echo '0 3774578656 linear /dev/mapper/backing-device 16' | dmsetup create dmb -- Coly Li ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: undo make-bcache (was: Re: Can't mount an encrypted backing device) 2020-01-18 12:34 ` Coly Li @ 2020-01-18 13:43 ` Clodoaldo Neto 2020-01-18 14:16 ` Coly Li 0 siblings, 1 reply; 15+ messages in thread From: Clodoaldo Neto @ 2020-01-18 13:43 UTC (permalink / raw) To: Coly Li; +Cc: Jens-U. Mozdzen, linux-bcache On Sat, Jan 18, 2020 at 9:35 AM Coly Li <colyli@suse.de> wrote: > > On 2020/1/18 8:22 下午, Clodoaldo Neto wrote: > > On Sat, Jan 18, 2020 at 7:54 AM Clodoaldo Neto > > <clodoaldo.pinto.neto@gmail.com> wrote: > >> > >> On Thu, Jan 16, 2020 at 9:59 PM Coly Li <colyli@suse.de> wrote: > >>> > >>> On 2020/1/17 5:52 上午, Clodoaldo Neto wrote: > >>>> > >>>> Em seg, 13 de jan de 2020 11:19, Coly Li <colyli@suse.de > >>>> <mailto:colyli@suse.de>> escreveu: > >>>>> > >>>>> On 2020/1/13 8:44 下午, Jens-U. Mozdzen wrote: > >>>>>> Hi Coly, > >>>>>> > >>>>>> jumping in here, because I was looking for a way to revert from bcache > >>>>>> to plain device: > >>>>>> > >>>>>> Zitat von Coly Li <colyli@suse.de <mailto:colyli@suse.de>>: > >>>>>>> The super block location of the backing disk is occupied by bcache. You > >>>>>>> cannot mount the file system directly from the backing disk which is > >>>>>>> formated as bcache backing device [...] (bcache offset all I/Os on > >>>>>>> bcache device 4KB behind the requesting > >>>>>>> LBA on backing disk). > >>>>>> > >>>>>> Assuming that no caching device is associated with a backing device (so > >>>>>> the backing device is "clean" as in "containing all data blocks with the > >>>>>> current content"), could one convert the content of a backing device to > >>>>>> a "non-bcached device" by removing the first 4096 octets of the backing > >>>>>> device content? > >>>>>> > >>>>>> Something like "dd if=backingdev of=newdev skip_bytes=4096 ..."? > >>>>> > >>>>> Hi Jens-U, > >>>>> > >>>>> you may try dmsetup to setup a linear device mapper target, and the map > >>>>> table just skipping the first 4KB (bcache superblock area). If you are > >>>>> lucky, I mean the real file system is not corrupted, the created device > >>>>> mapper target can be mounted directly. > >>>> > >>>> > >>>> I'm trying dmsetup but it does not accept anything other than 0 and 0 > >>>> at the beginning and end of the table: > >>>> > >>>> # echo '0 3774578672 linear /dev/mapper/backing-device 8' | dmsetup > >>>> create dmb > >>>> device-mapper: reload ioctl on dmb failed: Invalid argument > >>>> Command failed. > >>> > >>> The above line should work, if 3774578672 is a correct size number in > >>> sectors. > >> > >> I took it from the original map: > >> > >> # dmsetup table /dev/mapper/backing-device > >> 0 3774578672 crypt aes-xts-plain64 > >> :64:logon:cryptsetup:7e2c0b40-8dec-4b13-8d00-b53b55160775-d0 0 251:0 > >> 32768 > > > > It works like this: > > > > # echo '0 3774578664 linear /dev/mapper/backing-device 8' | dmsetup create dmb > > > > But then I can't mount it: > > > > # mount /dev/mapper/dmb /r > > mount: /r: wrong fs type, bad option, bad superblock on > > /dev/mapper/dmb, missing codepage or helper program, or other error. > > It might be my fault, from bcache-tools, it seems the offset is > BDEV_DATA_START_DEFAULT (16 sectors). How about: > # echo '0 3774578656 linear /dev/mapper/backing-device 16' | dmsetup > create dmb Still no luck # echo '0 3774578656 linear /dev/mapper/backing-device 16' | dmsetup create dmb # mount /dev/mapper/dmb /r mount: /r: wrong fs type, bad option, bad superblock on /dev/mapper/dmb, missing codepage or helper program, or other error. Clodoaldo > > > -- > > Coly Li ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: undo make-bcache (was: Re: Can't mount an encrypted backing device) 2020-01-18 13:43 ` Clodoaldo Neto @ 2020-01-18 14:16 ` Coly Li 2020-01-18 14:31 ` Coly Li 0 siblings, 1 reply; 15+ messages in thread From: Coly Li @ 2020-01-18 14:16 UTC (permalink / raw) To: clodoaldo.pinto.neto; +Cc: Jens-U. Mozdzen, linux-bcache On 2020/1/18 9:43 下午, Clodoaldo Neto wrote: > On Sat, Jan 18, 2020 at 9:35 AM Coly Li <colyli@suse.de> wrote: >> >> On 2020/1/18 8:22 下午, Clodoaldo Neto wrote: >>> On Sat, Jan 18, 2020 at 7:54 AM Clodoaldo Neto >>> <clodoaldo.pinto.neto@gmail.com> wrote: >>>> >>>> On Thu, Jan 16, 2020 at 9:59 PM Coly Li <colyli@suse.de> wrote: >>>>> >>>>> On 2020/1/17 5:52 上午, Clodoaldo Neto wrote: >>>>>> >>>>>> Em seg, 13 de jan de 2020 11:19, Coly Li <colyli@suse.de >>>>>> <mailto:colyli@suse.de>> escreveu: >>>>>>> >>>>>>> On 2020/1/13 8:44 下午, Jens-U. Mozdzen wrote: >>>>>>>> Hi Coly, >>>>>>>> >>>>>>>> jumping in here, because I was looking for a way to revert from bcache >>>>>>>> to plain device: >>>>>>>> >>>>>>>> Zitat von Coly Li <colyli@suse.de <mailto:colyli@suse.de>>: >>>>>>>>> The super block location of the backing disk is occupied by bcache. You >>>>>>>>> cannot mount the file system directly from the backing disk which is >>>>>>>>> formated as bcache backing device [...] (bcache offset all I/Os on >>>>>>>>> bcache device 4KB behind the requesting >>>>>>>>> LBA on backing disk). >>>>>>>> >>>>>>>> Assuming that no caching device is associated with a backing device (so >>>>>>>> the backing device is "clean" as in "containing all data blocks with the >>>>>>>> current content"), could one convert the content of a backing device to >>>>>>>> a "non-bcached device" by removing the first 4096 octets of the backing >>>>>>>> device content? >>>>>>>> >>>>>>>> Something like "dd if=backingdev of=newdev skip_bytes=4096 ..."? >>>>>>> >>>>>>> Hi Jens-U, >>>>>>> >>>>>>> you may try dmsetup to setup a linear device mapper target, and the map >>>>>>> table just skipping the first 4KB (bcache superblock area). If you are >>>>>>> lucky, I mean the real file system is not corrupted, the created device >>>>>>> mapper target can be mounted directly. >>>>>> >>>>>> >>>>>> I'm trying dmsetup but it does not accept anything other than 0 and 0 >>>>>> at the beginning and end of the table: >>>>>> >>>>>> # echo '0 3774578672 linear /dev/mapper/backing-device 8' | dmsetup >>>>>> create dmb >>>>>> device-mapper: reload ioctl on dmb failed: Invalid argument >>>>>> Command failed. >>>>> >>>>> The above line should work, if 3774578672 is a correct size number in >>>>> sectors. >>>> >>>> I took it from the original map: >>>> >>>> # dmsetup table /dev/mapper/backing-device >>>> 0 3774578672 crypt aes-xts-plain64 >>>> :64:logon:cryptsetup:7e2c0b40-8dec-4b13-8d00-b53b55160775-d0 0 251:0 >>>> 32768 >>> >>> It works like this: >>> >>> # echo '0 3774578664 linear /dev/mapper/backing-device 8' | dmsetup create dmb >>> >>> But then I can't mount it: >>> >>> # mount /dev/mapper/dmb /r >>> mount: /r: wrong fs type, bad option, bad superblock on >>> /dev/mapper/dmb, missing codepage or helper program, or other error. >> >> It might be my fault, from bcache-tools, it seems the offset is >> BDEV_DATA_START_DEFAULT (16 sectors). How about: >> # echo '0 3774578656 linear /dev/mapper/backing-device 16' | dmsetup >> create dmb > > Still no luck > > # echo '0 3774578656 linear /dev/mapper/backing-device 16' | dmsetup create dmb > # mount /dev/mapper/dmb /r > mount: /r: wrong fs type, bad option, bad superblock on > /dev/mapper/dmb, missing codepage or helper program, or other error. The tricky part is to calculate the correct linear mapping size. For example, I have a 500G hard drive, from fdisk I see its size is 1048576000 sectors. I use it as a bcache backing device and format an Ext4 file system on it. Then I use the following mistaken command line to setup a linear target to skip the first 8 sectors, # echo '0 1048575000 linear /dev/sdc 16' | dmsetup create dmb Then mount /dev/mapper/dmb to /mnt fails, the kmesg hints me, [1884572.477316] EXT4-fs (dm-0): bad geometry: block count 131071998 exceeds size of device (131071875 blocks) So I realize Ext4 file system will check the block device size, so I need to provide an exact accurate length number for the linear target. From the kmesg I see the correct sector size should be (131071998*8=)1048575984, then I re-create the linear target by, # echo '0 1048575984 linear /dev/sdc 16' | dmsetup create dmb Then I mount /dev/mapper/dmb to /mnt, it works and I have the following line from command 'mount', /dev/mapper/dmb on /mnt type ext4 (rw,relatime) I don't use the encrpyt file system and I don't know the excact detail about it. But I guess, it might because the incorrect length number for your dm linear target as I show by the above example. -- Coly Li ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: undo make-bcache (was: Re: Can't mount an encrypted backing device) 2020-01-18 14:16 ` Coly Li @ 2020-01-18 14:31 ` Coly Li 0 siblings, 0 replies; 15+ messages in thread From: Coly Li @ 2020-01-18 14:31 UTC (permalink / raw) To: clodoaldo.pinto.neto; +Cc: Jens-U. Mozdzen, linux-bcache On 2020/1/18 10:16 下午, Coly Li wrote: >>>> It works like this: >>>> >>>> # echo '0 3774578664 linear /dev/mapper/backing-device 8' | dmsetup create dmb >>>> >>>> But then I can't mount it: >>>> >>>> # mount /dev/mapper/dmb /r >>>> mount: /r: wrong fs type, bad option, bad superblock on >>>> /dev/mapper/dmb, missing codepage or helper program, or other error. >>> >>> It might be my fault, from bcache-tools, it seems the offset is >>> BDEV_DATA_START_DEFAULT (16 sectors). How about: >>> # echo '0 3774578656 linear /dev/mapper/backing-device 16' | dmsetup >>> create dmb >> >> Still no luck >> >> # echo '0 3774578656 linear /dev/mapper/backing-device 16' | dmsetup create dmb >> # mount /dev/mapper/dmb /r >> mount: /r: wrong fs type, bad option, bad superblock on >> /dev/mapper/dmb, missing codepage or helper program, or other error. > > The tricky part is to calculate the correct linear mapping size. > > For example, I have a 500G hard drive, from fdisk I see its size is > 1048576000 sectors. I use it as a bcache backing device and format an > Ext4 file system on it. Then I use the following mistaken command line > to setup a linear target to skip the first 8 sectors, > # echo '0 1048575000 linear /dev/sdc 16' | dmsetup create dmb > Then mount /dev/mapper/dmb to /mnt fails, the kmesg hints me, > [1884572.477316] EXT4-fs (dm-0): bad geometry: block count 131071998 > exceeds size of device (131071875 blocks) > > So I realize Ext4 file system will check the block device size, so I > need to provide an exact accurate length number for the linear target. > From the kmesg I see the correct sector size should be > (131071998*8=)1048575984, then I re-create the linear target by, > # echo '0 1048575984 linear /dev/sdc 16' | dmsetup create dmb > Then I mount /dev/mapper/dmb to /mnt, it works and I have the following > line from command 'mount', > /dev/mapper/dmb on /mnt type ext4 (rw,relatime) > > I don't use the encrpyt file system and I don't know the excact detail > about it. But I guess, it might because the incorrect length number for > your dm linear target as I show by the above example. > Sorry I realize maybe I mislead you.... I re-read the first email, it seems you create the bcache backing device on top of a raid raid1, then you cryptsetup on the bcache device. So I guess the linear dm target should be created on top of the md raid1, not /dev/mapper/backing-device. Which might be, # echo '0 3774578656 linear /dev/md127 16' | dmsetup create dmb The above line assumes luks has its superblock on offset zero from its own LBA, and <0 3774578656> should be a correct pair. If all the offset numbers are correct, dmb should be the block device for your to run cryptsetup open. Then you will have a /dev/mapper/backing-device for following mount. -- Coly Li ^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2020-01-18 14:31 UTC | newest] Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [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 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
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.