bcache for Intel Optane on ubuntu












1















I would like to use the Intel Optane memory (16GB) with ubuntu 18.10. My Laptop has an HDD for the OS and i thought i can use bcache for this purpose to speed up the experience. Can someone help me how to set it up? The computer has only ubuntu 18.10 on it so there should be no conflict with other os.
If my idea is wrong anyone has any better idea on how to use Intel Optane with ubuntu?
Thank you very much for the answer!



Bests










share|improve this question



























    1















    I would like to use the Intel Optane memory (16GB) with ubuntu 18.10. My Laptop has an HDD for the OS and i thought i can use bcache for this purpose to speed up the experience. Can someone help me how to set it up? The computer has only ubuntu 18.10 on it so there should be no conflict with other os.
    If my idea is wrong anyone has any better idea on how to use Intel Optane with ubuntu?
    Thank you very much for the answer!



    Bests










    share|improve this question

























      1












      1








      1








      I would like to use the Intel Optane memory (16GB) with ubuntu 18.10. My Laptop has an HDD for the OS and i thought i can use bcache for this purpose to speed up the experience. Can someone help me how to set it up? The computer has only ubuntu 18.10 on it so there should be no conflict with other os.
      If my idea is wrong anyone has any better idea on how to use Intel Optane with ubuntu?
      Thank you very much for the answer!



      Bests










      share|improve this question














      I would like to use the Intel Optane memory (16GB) with ubuntu 18.10. My Laptop has an HDD for the OS and i thought i can use bcache for this purpose to speed up the experience. Can someone help me how to set it up? The computer has only ubuntu 18.10 on it so there should be no conflict with other os.
      If my idea is wrong anyone has any better idea on how to use Intel Optane with ubuntu?
      Thank you very much for the answer!



      Bests







      dell intel bcache






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 10 at 10:46









      EnjamEnjam

      63




      63






















          1 Answer
          1






          active

          oldest

          votes


















          0














          I made it work as follows:



          setting AHCI mode in BIOS then i followed the instructions in the following link:



          https://www.kloppenborg.net/blog/2017/11/05/installing-ubuntu-17-10-with-bcache



          If the link is not working, here are the details:



          Overview
          Before we get going, not that this is only valid for a new installation of Linux as we delete all file system information. If this isn’t what you want to do, I suggest you check out flashcache or EnhanceIO which will let you migrate a live system.



          Here are the major steps:



          Boot the Ubuntu installer
          Create a partitions for /boot, the backing, and cache devices.
          Create the bcache device
          Install Ubuntu onto /dev/bcache0
          While still in the live CD, chroot into the new installation
          Install bcache-tools and re-generate initramfs
          Reboot into a fully functional system.
          Properly acknowledging my sources, there are two critical posts on StackOverflow that made me think I could get away with this scheme: alex’s answer on how to setup bcache and Lekensteyn’s answer on how to restore kernels Lastly, be aware that Grub (and Grub2) do not support bcache, so you will need a separate /boot partition.



          Partitioning
          First, if you have used this system for anything important, back up your data. We’ll be erasing everything shortly.



          Now, boot into the Ubuntu installer and remove any unnecessary partitions. You can use fdisk on the command line or the gparted GUI for this. Now, lets assume that your SSD is /dev/sda and your hard disk is /dev/sdb. Create the following partitioning scheme:



          /dev/sda1 - 1024 MB, EXT4, used for /boot
          /dev/sda2 - any format, for cache
          /dev/sdb1 - EFI partition (if your machine needs it)
          /dev/sdb2 - swap
          /dev/sdb3 - any format, backing partition



          Don’t worry about doing a deep format of the caching and backing partitions as we’ll wipe these shortly. If you made any major changes to the partition tables, you might need to reboot before you can proceed. gparted, in particular, will let you know if this is the case.



          Loading bcache, creating device
          First, connect to the Internet. Make sure the connection is working. Next open up a terminal and wipe the cache and backing partition file systems:



          sudo wipefs -a /dev/sda2
          sudo wipefs -a /dev/sdb3



          Next we will install bcache-tools and create the bcache device.



          sudo apt-get update
          sudo apt-get install bcache-tools
          sudo make-bcache -B /dev/sdb3 -C /dev/sda2
          sudo mkfs.ext4 /dev/bcache0



          Notice the command to make-bcache used the HDD partition, /dev/sdb3, as the backing (-B) device and the SDD partition, /dev/sda2, as the cache (-C) device.



          Installing Ubuntu
          WITHOUT rebooting, run the Ubuntu installer from the desktop. When you get to the installation type screen which lets you pick how to install the OS (e.g. the page that says “Erase disk and install Ubuntu” or “Something else”) choose to do custom partitioning.



          In the partitioning dialog configure the following:



          /dev/bcache0 - format EXT4, use as /
          /dev/sda1 - format EXT4, use as /boot
          /dev/sdb1 - EFI partition (if your machine needs it)
          /dev/sdb2 - swap



          Proceed with the installation as normal. When it completes DO NOT REBOOT as the initramfs installed by the live CD does not have the bcache kernel module. If you accidentally rebooted, simply go back in to the live image, install the bcache-tools package as described above and continue with the instructions below.



          Installing bcache on the new installation
          Here is where things get tricky. What we’re going to do is switch to the new operating system without booting and install some software to get bcache-tools installed and a new initramfs generated so the computer will boot.



          First we are going to create a valid chroot environment. We start by mounting several directories from the new installation into specific subdirectories in order to create the directory structure Ubuntu Linux expects:



          sudo mount /dev/bcache0 /mnt
          sudo mount /dev/sda1 /mnt/boot
          sudo mount --bind /dev /mnt/dev
          sudo mount --bind /proc /mnt/proc
          sudo mount --bind /sys /mnt/sys



          Because we will need Internet access, we need to copy the DNS configuration from the live CD into the chroot environment:



          sudo cp /etc/resolv.conf /mnt/etc/resolv.conf



          Next we put ourselves into the chroot:



          sudo chroot /mnt



          Now we are effectively within the new installation’s file system. So all we need to do is install bcache-tools



          sudo apt-get update
          sudo apt-get install bcache-tools



          After the package is installed, you should notice that the initramfs is re-generated and installed. You can check the timestamps on the files in /boot against date to confirm this is the case.



          Now we clean up. Exit the chroot, cleanly dismount the file system, and reboot:



          exit
          sudo umount /mnt/sys
          sudo umount /mnt/proc
          sudo umount /mnt/dev
          sudo umount /mnt/boot
          sudo umount /mnt
          sudo reboot



          Post-install
          Restore the default resolv.conf configuration



          sudo ln -s /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf



          With any luck, your machine will reboot normally and you will have a fully functional Ubuntu installation with bcache out of the box without all the work of previous methods.






          share|improve this answer

























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "89"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1108547%2fbcache-for-intel-optane-on-ubuntu%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            I made it work as follows:



            setting AHCI mode in BIOS then i followed the instructions in the following link:



            https://www.kloppenborg.net/blog/2017/11/05/installing-ubuntu-17-10-with-bcache



            If the link is not working, here are the details:



            Overview
            Before we get going, not that this is only valid for a new installation of Linux as we delete all file system information. If this isn’t what you want to do, I suggest you check out flashcache or EnhanceIO which will let you migrate a live system.



            Here are the major steps:



            Boot the Ubuntu installer
            Create a partitions for /boot, the backing, and cache devices.
            Create the bcache device
            Install Ubuntu onto /dev/bcache0
            While still in the live CD, chroot into the new installation
            Install bcache-tools and re-generate initramfs
            Reboot into a fully functional system.
            Properly acknowledging my sources, there are two critical posts on StackOverflow that made me think I could get away with this scheme: alex’s answer on how to setup bcache and Lekensteyn’s answer on how to restore kernels Lastly, be aware that Grub (and Grub2) do not support bcache, so you will need a separate /boot partition.



            Partitioning
            First, if you have used this system for anything important, back up your data. We’ll be erasing everything shortly.



            Now, boot into the Ubuntu installer and remove any unnecessary partitions. You can use fdisk on the command line or the gparted GUI for this. Now, lets assume that your SSD is /dev/sda and your hard disk is /dev/sdb. Create the following partitioning scheme:



            /dev/sda1 - 1024 MB, EXT4, used for /boot
            /dev/sda2 - any format, for cache
            /dev/sdb1 - EFI partition (if your machine needs it)
            /dev/sdb2 - swap
            /dev/sdb3 - any format, backing partition



            Don’t worry about doing a deep format of the caching and backing partitions as we’ll wipe these shortly. If you made any major changes to the partition tables, you might need to reboot before you can proceed. gparted, in particular, will let you know if this is the case.



            Loading bcache, creating device
            First, connect to the Internet. Make sure the connection is working. Next open up a terminal and wipe the cache and backing partition file systems:



            sudo wipefs -a /dev/sda2
            sudo wipefs -a /dev/sdb3



            Next we will install bcache-tools and create the bcache device.



            sudo apt-get update
            sudo apt-get install bcache-tools
            sudo make-bcache -B /dev/sdb3 -C /dev/sda2
            sudo mkfs.ext4 /dev/bcache0



            Notice the command to make-bcache used the HDD partition, /dev/sdb3, as the backing (-B) device and the SDD partition, /dev/sda2, as the cache (-C) device.



            Installing Ubuntu
            WITHOUT rebooting, run the Ubuntu installer from the desktop. When you get to the installation type screen which lets you pick how to install the OS (e.g. the page that says “Erase disk and install Ubuntu” or “Something else”) choose to do custom partitioning.



            In the partitioning dialog configure the following:



            /dev/bcache0 - format EXT4, use as /
            /dev/sda1 - format EXT4, use as /boot
            /dev/sdb1 - EFI partition (if your machine needs it)
            /dev/sdb2 - swap



            Proceed with the installation as normal. When it completes DO NOT REBOOT as the initramfs installed by the live CD does not have the bcache kernel module. If you accidentally rebooted, simply go back in to the live image, install the bcache-tools package as described above and continue with the instructions below.



            Installing bcache on the new installation
            Here is where things get tricky. What we’re going to do is switch to the new operating system without booting and install some software to get bcache-tools installed and a new initramfs generated so the computer will boot.



            First we are going to create a valid chroot environment. We start by mounting several directories from the new installation into specific subdirectories in order to create the directory structure Ubuntu Linux expects:



            sudo mount /dev/bcache0 /mnt
            sudo mount /dev/sda1 /mnt/boot
            sudo mount --bind /dev /mnt/dev
            sudo mount --bind /proc /mnt/proc
            sudo mount --bind /sys /mnt/sys



            Because we will need Internet access, we need to copy the DNS configuration from the live CD into the chroot environment:



            sudo cp /etc/resolv.conf /mnt/etc/resolv.conf



            Next we put ourselves into the chroot:



            sudo chroot /mnt



            Now we are effectively within the new installation’s file system. So all we need to do is install bcache-tools



            sudo apt-get update
            sudo apt-get install bcache-tools



            After the package is installed, you should notice that the initramfs is re-generated and installed. You can check the timestamps on the files in /boot against date to confirm this is the case.



            Now we clean up. Exit the chroot, cleanly dismount the file system, and reboot:



            exit
            sudo umount /mnt/sys
            sudo umount /mnt/proc
            sudo umount /mnt/dev
            sudo umount /mnt/boot
            sudo umount /mnt
            sudo reboot



            Post-install
            Restore the default resolv.conf configuration



            sudo ln -s /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf



            With any luck, your machine will reboot normally and you will have a fully functional Ubuntu installation with bcache out of the box without all the work of previous methods.






            share|improve this answer






























              0














              I made it work as follows:



              setting AHCI mode in BIOS then i followed the instructions in the following link:



              https://www.kloppenborg.net/blog/2017/11/05/installing-ubuntu-17-10-with-bcache



              If the link is not working, here are the details:



              Overview
              Before we get going, not that this is only valid for a new installation of Linux as we delete all file system information. If this isn’t what you want to do, I suggest you check out flashcache or EnhanceIO which will let you migrate a live system.



              Here are the major steps:



              Boot the Ubuntu installer
              Create a partitions for /boot, the backing, and cache devices.
              Create the bcache device
              Install Ubuntu onto /dev/bcache0
              While still in the live CD, chroot into the new installation
              Install bcache-tools and re-generate initramfs
              Reboot into a fully functional system.
              Properly acknowledging my sources, there are two critical posts on StackOverflow that made me think I could get away with this scheme: alex’s answer on how to setup bcache and Lekensteyn’s answer on how to restore kernels Lastly, be aware that Grub (and Grub2) do not support bcache, so you will need a separate /boot partition.



              Partitioning
              First, if you have used this system for anything important, back up your data. We’ll be erasing everything shortly.



              Now, boot into the Ubuntu installer and remove any unnecessary partitions. You can use fdisk on the command line or the gparted GUI for this. Now, lets assume that your SSD is /dev/sda and your hard disk is /dev/sdb. Create the following partitioning scheme:



              /dev/sda1 - 1024 MB, EXT4, used for /boot
              /dev/sda2 - any format, for cache
              /dev/sdb1 - EFI partition (if your machine needs it)
              /dev/sdb2 - swap
              /dev/sdb3 - any format, backing partition



              Don’t worry about doing a deep format of the caching and backing partitions as we’ll wipe these shortly. If you made any major changes to the partition tables, you might need to reboot before you can proceed. gparted, in particular, will let you know if this is the case.



              Loading bcache, creating device
              First, connect to the Internet. Make sure the connection is working. Next open up a terminal and wipe the cache and backing partition file systems:



              sudo wipefs -a /dev/sda2
              sudo wipefs -a /dev/sdb3



              Next we will install bcache-tools and create the bcache device.



              sudo apt-get update
              sudo apt-get install bcache-tools
              sudo make-bcache -B /dev/sdb3 -C /dev/sda2
              sudo mkfs.ext4 /dev/bcache0



              Notice the command to make-bcache used the HDD partition, /dev/sdb3, as the backing (-B) device and the SDD partition, /dev/sda2, as the cache (-C) device.



              Installing Ubuntu
              WITHOUT rebooting, run the Ubuntu installer from the desktop. When you get to the installation type screen which lets you pick how to install the OS (e.g. the page that says “Erase disk and install Ubuntu” or “Something else”) choose to do custom partitioning.



              In the partitioning dialog configure the following:



              /dev/bcache0 - format EXT4, use as /
              /dev/sda1 - format EXT4, use as /boot
              /dev/sdb1 - EFI partition (if your machine needs it)
              /dev/sdb2 - swap



              Proceed with the installation as normal. When it completes DO NOT REBOOT as the initramfs installed by the live CD does not have the bcache kernel module. If you accidentally rebooted, simply go back in to the live image, install the bcache-tools package as described above and continue with the instructions below.



              Installing bcache on the new installation
              Here is where things get tricky. What we’re going to do is switch to the new operating system without booting and install some software to get bcache-tools installed and a new initramfs generated so the computer will boot.



              First we are going to create a valid chroot environment. We start by mounting several directories from the new installation into specific subdirectories in order to create the directory structure Ubuntu Linux expects:



              sudo mount /dev/bcache0 /mnt
              sudo mount /dev/sda1 /mnt/boot
              sudo mount --bind /dev /mnt/dev
              sudo mount --bind /proc /mnt/proc
              sudo mount --bind /sys /mnt/sys



              Because we will need Internet access, we need to copy the DNS configuration from the live CD into the chroot environment:



              sudo cp /etc/resolv.conf /mnt/etc/resolv.conf



              Next we put ourselves into the chroot:



              sudo chroot /mnt



              Now we are effectively within the new installation’s file system. So all we need to do is install bcache-tools



              sudo apt-get update
              sudo apt-get install bcache-tools



              After the package is installed, you should notice that the initramfs is re-generated and installed. You can check the timestamps on the files in /boot against date to confirm this is the case.



              Now we clean up. Exit the chroot, cleanly dismount the file system, and reboot:



              exit
              sudo umount /mnt/sys
              sudo umount /mnt/proc
              sudo umount /mnt/dev
              sudo umount /mnt/boot
              sudo umount /mnt
              sudo reboot



              Post-install
              Restore the default resolv.conf configuration



              sudo ln -s /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf



              With any luck, your machine will reboot normally and you will have a fully functional Ubuntu installation with bcache out of the box without all the work of previous methods.






              share|improve this answer




























                0












                0








                0







                I made it work as follows:



                setting AHCI mode in BIOS then i followed the instructions in the following link:



                https://www.kloppenborg.net/blog/2017/11/05/installing-ubuntu-17-10-with-bcache



                If the link is not working, here are the details:



                Overview
                Before we get going, not that this is only valid for a new installation of Linux as we delete all file system information. If this isn’t what you want to do, I suggest you check out flashcache or EnhanceIO which will let you migrate a live system.



                Here are the major steps:



                Boot the Ubuntu installer
                Create a partitions for /boot, the backing, and cache devices.
                Create the bcache device
                Install Ubuntu onto /dev/bcache0
                While still in the live CD, chroot into the new installation
                Install bcache-tools and re-generate initramfs
                Reboot into a fully functional system.
                Properly acknowledging my sources, there are two critical posts on StackOverflow that made me think I could get away with this scheme: alex’s answer on how to setup bcache and Lekensteyn’s answer on how to restore kernels Lastly, be aware that Grub (and Grub2) do not support bcache, so you will need a separate /boot partition.



                Partitioning
                First, if you have used this system for anything important, back up your data. We’ll be erasing everything shortly.



                Now, boot into the Ubuntu installer and remove any unnecessary partitions. You can use fdisk on the command line or the gparted GUI for this. Now, lets assume that your SSD is /dev/sda and your hard disk is /dev/sdb. Create the following partitioning scheme:



                /dev/sda1 - 1024 MB, EXT4, used for /boot
                /dev/sda2 - any format, for cache
                /dev/sdb1 - EFI partition (if your machine needs it)
                /dev/sdb2 - swap
                /dev/sdb3 - any format, backing partition



                Don’t worry about doing a deep format of the caching and backing partitions as we’ll wipe these shortly. If you made any major changes to the partition tables, you might need to reboot before you can proceed. gparted, in particular, will let you know if this is the case.



                Loading bcache, creating device
                First, connect to the Internet. Make sure the connection is working. Next open up a terminal and wipe the cache and backing partition file systems:



                sudo wipefs -a /dev/sda2
                sudo wipefs -a /dev/sdb3



                Next we will install bcache-tools and create the bcache device.



                sudo apt-get update
                sudo apt-get install bcache-tools
                sudo make-bcache -B /dev/sdb3 -C /dev/sda2
                sudo mkfs.ext4 /dev/bcache0



                Notice the command to make-bcache used the HDD partition, /dev/sdb3, as the backing (-B) device and the SDD partition, /dev/sda2, as the cache (-C) device.



                Installing Ubuntu
                WITHOUT rebooting, run the Ubuntu installer from the desktop. When you get to the installation type screen which lets you pick how to install the OS (e.g. the page that says “Erase disk and install Ubuntu” or “Something else”) choose to do custom partitioning.



                In the partitioning dialog configure the following:



                /dev/bcache0 - format EXT4, use as /
                /dev/sda1 - format EXT4, use as /boot
                /dev/sdb1 - EFI partition (if your machine needs it)
                /dev/sdb2 - swap



                Proceed with the installation as normal. When it completes DO NOT REBOOT as the initramfs installed by the live CD does not have the bcache kernel module. If you accidentally rebooted, simply go back in to the live image, install the bcache-tools package as described above and continue with the instructions below.



                Installing bcache on the new installation
                Here is where things get tricky. What we’re going to do is switch to the new operating system without booting and install some software to get bcache-tools installed and a new initramfs generated so the computer will boot.



                First we are going to create a valid chroot environment. We start by mounting several directories from the new installation into specific subdirectories in order to create the directory structure Ubuntu Linux expects:



                sudo mount /dev/bcache0 /mnt
                sudo mount /dev/sda1 /mnt/boot
                sudo mount --bind /dev /mnt/dev
                sudo mount --bind /proc /mnt/proc
                sudo mount --bind /sys /mnt/sys



                Because we will need Internet access, we need to copy the DNS configuration from the live CD into the chroot environment:



                sudo cp /etc/resolv.conf /mnt/etc/resolv.conf



                Next we put ourselves into the chroot:



                sudo chroot /mnt



                Now we are effectively within the new installation’s file system. So all we need to do is install bcache-tools



                sudo apt-get update
                sudo apt-get install bcache-tools



                After the package is installed, you should notice that the initramfs is re-generated and installed. You can check the timestamps on the files in /boot against date to confirm this is the case.



                Now we clean up. Exit the chroot, cleanly dismount the file system, and reboot:



                exit
                sudo umount /mnt/sys
                sudo umount /mnt/proc
                sudo umount /mnt/dev
                sudo umount /mnt/boot
                sudo umount /mnt
                sudo reboot



                Post-install
                Restore the default resolv.conf configuration



                sudo ln -s /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf



                With any luck, your machine will reboot normally and you will have a fully functional Ubuntu installation with bcache out of the box without all the work of previous methods.






                share|improve this answer















                I made it work as follows:



                setting AHCI mode in BIOS then i followed the instructions in the following link:



                https://www.kloppenborg.net/blog/2017/11/05/installing-ubuntu-17-10-with-bcache



                If the link is not working, here are the details:



                Overview
                Before we get going, not that this is only valid for a new installation of Linux as we delete all file system information. If this isn’t what you want to do, I suggest you check out flashcache or EnhanceIO which will let you migrate a live system.



                Here are the major steps:



                Boot the Ubuntu installer
                Create a partitions for /boot, the backing, and cache devices.
                Create the bcache device
                Install Ubuntu onto /dev/bcache0
                While still in the live CD, chroot into the new installation
                Install bcache-tools and re-generate initramfs
                Reboot into a fully functional system.
                Properly acknowledging my sources, there are two critical posts on StackOverflow that made me think I could get away with this scheme: alex’s answer on how to setup bcache and Lekensteyn’s answer on how to restore kernels Lastly, be aware that Grub (and Grub2) do not support bcache, so you will need a separate /boot partition.



                Partitioning
                First, if you have used this system for anything important, back up your data. We’ll be erasing everything shortly.



                Now, boot into the Ubuntu installer and remove any unnecessary partitions. You can use fdisk on the command line or the gparted GUI for this. Now, lets assume that your SSD is /dev/sda and your hard disk is /dev/sdb. Create the following partitioning scheme:



                /dev/sda1 - 1024 MB, EXT4, used for /boot
                /dev/sda2 - any format, for cache
                /dev/sdb1 - EFI partition (if your machine needs it)
                /dev/sdb2 - swap
                /dev/sdb3 - any format, backing partition



                Don’t worry about doing a deep format of the caching and backing partitions as we’ll wipe these shortly. If you made any major changes to the partition tables, you might need to reboot before you can proceed. gparted, in particular, will let you know if this is the case.



                Loading bcache, creating device
                First, connect to the Internet. Make sure the connection is working. Next open up a terminal and wipe the cache and backing partition file systems:



                sudo wipefs -a /dev/sda2
                sudo wipefs -a /dev/sdb3



                Next we will install bcache-tools and create the bcache device.



                sudo apt-get update
                sudo apt-get install bcache-tools
                sudo make-bcache -B /dev/sdb3 -C /dev/sda2
                sudo mkfs.ext4 /dev/bcache0



                Notice the command to make-bcache used the HDD partition, /dev/sdb3, as the backing (-B) device and the SDD partition, /dev/sda2, as the cache (-C) device.



                Installing Ubuntu
                WITHOUT rebooting, run the Ubuntu installer from the desktop. When you get to the installation type screen which lets you pick how to install the OS (e.g. the page that says “Erase disk and install Ubuntu” or “Something else”) choose to do custom partitioning.



                In the partitioning dialog configure the following:



                /dev/bcache0 - format EXT4, use as /
                /dev/sda1 - format EXT4, use as /boot
                /dev/sdb1 - EFI partition (if your machine needs it)
                /dev/sdb2 - swap



                Proceed with the installation as normal. When it completes DO NOT REBOOT as the initramfs installed by the live CD does not have the bcache kernel module. If you accidentally rebooted, simply go back in to the live image, install the bcache-tools package as described above and continue with the instructions below.



                Installing bcache on the new installation
                Here is where things get tricky. What we’re going to do is switch to the new operating system without booting and install some software to get bcache-tools installed and a new initramfs generated so the computer will boot.



                First we are going to create a valid chroot environment. We start by mounting several directories from the new installation into specific subdirectories in order to create the directory structure Ubuntu Linux expects:



                sudo mount /dev/bcache0 /mnt
                sudo mount /dev/sda1 /mnt/boot
                sudo mount --bind /dev /mnt/dev
                sudo mount --bind /proc /mnt/proc
                sudo mount --bind /sys /mnt/sys



                Because we will need Internet access, we need to copy the DNS configuration from the live CD into the chroot environment:



                sudo cp /etc/resolv.conf /mnt/etc/resolv.conf



                Next we put ourselves into the chroot:



                sudo chroot /mnt



                Now we are effectively within the new installation’s file system. So all we need to do is install bcache-tools



                sudo apt-get update
                sudo apt-get install bcache-tools



                After the package is installed, you should notice that the initramfs is re-generated and installed. You can check the timestamps on the files in /boot against date to confirm this is the case.



                Now we clean up. Exit the chroot, cleanly dismount the file system, and reboot:



                exit
                sudo umount /mnt/sys
                sudo umount /mnt/proc
                sudo umount /mnt/dev
                sudo umount /mnt/boot
                sudo umount /mnt
                sudo reboot



                Post-install
                Restore the default resolv.conf configuration



                sudo ln -s /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf



                With any luck, your machine will reboot normally and you will have a fully functional Ubuntu installation with bcache out of the box without all the work of previous methods.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Jan 16 at 9:02

























                answered Jan 15 at 20:16









                EnjamEnjam

                63




                63






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Ask Ubuntu!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1108547%2fbcache-for-intel-optane-on-ubuntu%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

                    Mangá

                     ⁒  ․,‪⁊‑⁙ ⁖, ⁇‒※‌, †,⁖‗‌⁝    ‾‸⁘,‖⁔⁣,⁂‾
”‑,‥–,‬ ,⁀‹⁋‴⁑ ‒ ,‴⁋”‼ ⁨,‷⁔„ ‰′,‐‚ ‥‡‎“‷⁃⁨⁅⁣,⁔
⁇‘⁔⁡⁏⁌⁡‿‶‏⁨ ⁣⁕⁖⁨⁩⁥‽⁀  ‴‬⁜‟ ⁃‣‧⁕‮ …‍⁨‴ ⁩,⁚⁖‫ ,‵ ⁀,‮⁝‣‣ ⁑  ⁂– ․, ‾‽ ‏⁁“⁗‸ ‾… ‹‡⁌⁎‸‘ ‡⁏⁌‪ ‵⁛ ‎⁨ ―⁦⁤⁄⁕