Deactivate bcache backend diskīefore disabling the back-end disk, please ensure that the current disk is not used with an additional cache disk. If the directory does not exist, it indicates that the logout is successful. Through the CSET of the cache disk UUID, in / sys / FS / bcache / / unregister write 1 to log off, as follows: ~]# echo ~]#Īfter the operation is completed, check / sys/fs/bcache/d0079bae-b749-468b-ad0c-6fedbbc742f4 through ls. If the current disk is in use and logging off operation is carried out, the data of the cache disk may not be written to the back-end disk in time, resulting in data loss. Unregister cache diskīefore logging off the cache, please make sure that the current cache disk is not used as a cache, that is, the bcahe device under the cache disk cannot be seen through lsblk. The command is as follows: ~]# echo "d0079bae-b749-468b-ad0c-6fedbbc742f4" ~]#Īt this time, you can see that the bcache0 device under sdc is missing, which means that the cache is deleted successfully. To delete the cache disk from the current back-end disk, simply delete the CSET of the cache disk UUID detach to bcache disk. The command is as follows: ~]# echo "d0079bae-b749-468b-ad0c-6fedbbc742f4" ~]#Īfter the operation is completed, you can view the results through the lsblk command: ~]# lsblk /dev/sdb /dev/sdcĪt this time, you can see that bcache0 device also appears under sdc, which means that the cache is added successfully. To add a cache disk to the bcache back-end disk, after successfully creating the cache disk, you first need to obtain the CSET of the cache disk UUID, view through bcache super show command: ~]# bcache-super-show /dev/sdcĭev.uuid 000771bd-5c58-4713-9fba-23312efb01a8Īs shown in the command result above, the last line is the CSET of the cache disk UUID, just put the CSET UUID attach to bcache disk to add cache. Writing superblocks and filesystem accounting information: ~]#Īt this point, you can mount as follows: ~]# mount /dev/bcache0 ~]# Add cache disk You can use mkfs Ext4 format the bcache disk into ext4. To use bcache disk, you need to format the disk first. View Bcache disk: Bcache disk configuration Format the Bcache disk and mount it Therefore, please ensure that the data in the disk has been backed up before using this command.Įrase the superblock information in the disk: If there is a file system on the disk, the following error will occur: ~]# make-bcache -C /dev/sdcĭevice /dev/sdc already has a non-bcache superblock, remove it using wipefs and wipefs ~]#Īt this time, you need to use the wipefs command to erase the data in the super block in the disk, which will make the data in the original disk unable to continue to be used or restored. Use of bcache toolsīefore using disk as Bcache disk, please make sure that the disk is empty or the data in the disk is irrelevant. After the devel kid package is compiled, you need to download the following command:Īfter the libblkid devel package is successfully installed, you can directly compile bcache tools and install it. Since there is no Bcache tools in the source of CentOS 7, you need to manually download the source package for compilation. To use Bcache, you must install the Bcache tools toolkit. Installation and use of bcache tools Installation of bcache tools Write around: if this policy is selected, the data will be written directly to the back-end disk.In this mode, the data will be written to the cache disk and the back-end data disk at the same time. writethrough write through policy: the default is the write through policy.If this policy is enabled, all data will be written to the cache disk first, and then wait for the system to write data back to the back-end data disk. Writeback writeback policy: the writeback policy is off by default. Writethrough is used by default, and the caching strategy can be modified dynamically. Bcache cache policyīcache supports three caching strategies: writeback, writethrough and writearound. Therefore, to use Bcache, you need to upgrade the kernel to version 3.10 or above. Note: Bcache is officially incorporated into the kernel mainline from Linux-3.10. Because SSD is expensive and the storage space is small, while HDD is cheap and the storage space is large, SSD is used as cache and HDD is used as data storage disk, which not only solves the problem of too small SSD capacity, but also solves the problem of too slow running speed of HDD. It makes it possible for SSDs to act as HDD caches. Bcache is a Linux kernel block device layer cache that supports multiple HDDs and uses the same SSD as the cache disk.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |