On Thu, Jan 16, 2020 at 8:01 PM Eric Wheeler <bcache@xxxxxxxxxxxxxxxxxx> wrote: > > On Thu, 16 Jan 2020, Clodoaldo Neto wrote: > > > Em seg, 13 de jan de 2020 11:19, Coly Li <colyli@xxxxxxx> 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@xxxxxxx>: > > > >> 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@xxxxxxxxxx [ 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 > > > > >