我正在尝试在现有系统上设置 Bcache(有风险,但我们不担心丢失任何数据)。所以我的 make 和 make install 工作正常,但是当我运行命令 make-bcache 时,我收到以下错误。当我尝试设置 dm-cache 时收到同样的错误。有人可以建议任何解决方案吗?我们是否犯了任何错误这里
[root@x130-65-157-206 bcache-tools]# make-bcache -B /dev/sda2
Can't open dev /dev/sda2: Device or resource busy
[root@x130-65-157-206 bcache-tools]# make-bcache -B /dev/sda
Can't open dev /dev/sda: Device or resource busy
以下是我的磁盘配置
[root@x130-65-157-206 bcache-tools]# fdisk -l
Disk /dev/sda: 498.8 GB, 498753077248 bytes, 974127104 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x00036dc2
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 974127103 486550528 8e Linux LVM
Disk /dev/mapper/centos-root: 53.7 GB, 53687091200 bytes, 104857600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/centos-swap: 8455 MB, 8455716864 bytes, 16515072 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/centos-home: 436.0 GB, 436014678016 bytes, 851591168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sdb: 31.4 GB, 31376707072 bytes, 61282631 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
我的 SSD 位于 /dev/sdb 。
答案1
您已在 上设置了 LVM /dev/sda2
,因此您需要make-bcache
在逻辑卷 (LV) 而不是原始分区上运行。如果您想使用centos-root
和centos-home
LV 作为后备设备,并将整个 SSD 作为缓存设备,您可以使用以下命令进行设置
make-bcache --bdev /dev/mapper/centos-root /dev/mapper/centos-home --cache /dev/sdb
请参阅 参考资料 了解make-bcache --help
更多选项。
您需要更新 initramfs 和 fstab 才能成功启动。
我强烈建议阅读bcache 的内核文档。