Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Recover bcache from previous system?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
statikregimen
Apprentice
Apprentice


Joined: 16 Jul 2011
Posts: 173
Location: USA/Michigan

PostPosted: Fri Aug 25, 2017 2:37 pm    Post subject: [SOLVED] Recover bcache from previous system? Reply with quote

EDIT: A little more google-fu has lead me here https://stackoverflow.com/questions/22820492/how-to-revert-bcache-device-to-regulare-filesystem#23295521

It looks very promising. I am reading it now and will try the suggestion(s), reporting back my findings.

[SOLVED]
Code:
# losetup -o 8192 /dev/loop0 /dev/your_bcache_backing_dev
# mount /dev/loop0 /mnt/somewhere
# cd /mntsomewhere
# ls
<your data should now be listed here>


It is up to you what to do with it next. I'm going to back it up and get rid of those gross NTFS partitions, then make a new bcache for my /home directory :D

p.s. I still can't get over how 99% of the time, right after I give up and post in forums, I find the solution on my own....

Original post:
Good day,

I recently decided to move from Ubuntu to Gentoo

The machine has two SSDs, split into two mdadm RAID0 arrays.

The first array is for the root partition. On Ubuntu, I was using the 2nd array as cache for a spinning disk.

So my question is: Is it possible to bring the cache+backing drive back online with data in-tact? I've google-fu'ed the crap out of it, but the best I can find is how to cache a device that contains existing data. It's not the end of the world if I can't, which is why I didn't bother backing anything up first. But in retrospect, it would be nice to have that data back...would save me redownloading some big files, and forgot about a couple save games that were on there.

I've tried simply mounting the backing device:
Code:
# mount /dev/sda2 /media/tmp/
mount: unknown filesystem type 'bcache'


Recreating the device:
Code:
# make-bcache -B /dev/sda2
Already a bcache device on /dev/sda2, overwrite with --wipe-bcache


It apparently doesn't get automatically detected:
Code:
# ls /dev/bcache*
ls: cannot access '/dev/bcache*': No such file or directory


I have set in my kernel config:
Code:

<*>   Block device as cache
[ ]     Bcache debugging
[ ]     Debug closures


Code:
# lsblk
NAME          MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sr0            11:0    1  1024M  0 rom   
nvme1n1       259:4    0 119.2G  0 disk 
├─nvme1n1p3   259:6    0  59.4G  0 part 
│ └─md127       9:127  0 118.7G  0 raid0
└─nvme1n1p2   259:5    0  59.4G  0 part 
  └─md126       9:126  0 118.7G  0 raid0
    ├─md126p3 259:9    0   6.9G  0 md    [SWAP]
    ├─md126p1 259:7    0  18.6G  0 md    /
    └─md126p2 259:8    0  93.1G  0 md   
sda             8:0    0 931.5G  0 disk 
├─sda2          8:2    0 931.4G  0 part 
└─sda1          8:1    0   100M  0 part 
nvme0n1       259:0    0 119.2G  0 disk 
├─nvme0n1p3   259:3    0  59.4G  0 part 
│ └─md127       9:127  0 118.7G  0 raid0
├─nvme0n1p1   259:1    0   512M  0 part  /boot
└─nvme0n1p2   259:2    0  59.4G  0 part 
  └─md126       9:126  0 118.7G  0 raid0
    ├─md126p3 259:9    0   6.9G  0 md    [SWAP]
    ├─md126p1 259:7    0  18.6G  0 md    /
    └─md126p2 259:8    0  93.1G  0 md


Code:
# fdisk -l /dev/sda
Device     Boot  Start        End    Sectors   Size Id Type
/dev/sda1  *      2048     206847     204800   100M  7 HPFS/NTFS/exFAT
/dev/sda2       206848 1953523119 1953316272 931.4G  7 HPFS/NTFS/exFAT



I'm happy to provide any further details if needed.

Thanks in advance!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum