4

I use the Julia programming language on a Chromebook with only 32 GB internal storage.

The .julia directory in the home folder consumes several gigabytes of space. This directory contains all the julia packages (similar to python libraries), and it is essential for Julia to use those packages.

I have a microSD card with a lot of free space. How do I move the .julia directory to the microSD card?

I am using Kubuntu 23.04.

Archisman Panigrahi
  • 28,338
  • 18
  • 105
  • 212

1 Answers1

4

First, create ext4 partition in the microSD card (if you already didn't), and configure the partition to be mounted automatically at startup. Ensure that you have write access to the ext4 partition (without requiring sudo).

For me, that partition is mounted at /mnt/SDCard/.

Now, create a directory julia_dir in that partition.

cd /mnt/SDCard
mkdir julia_dir

Now, there are two options. Adding an environment variable, or symlinking (you can use either depending on your choice).

Method 1

Move the contents of .julia to SDCard, and set the environment variable JULIA_DEPOT_PATH=/mnt/SDCard/julia_dir

mv ~/.julia /mnt/SDCard/julia_dir
echo 'export JULIA_DEPOT_PATH=/mnt/SDCard/julia_dir' >> ~/.bashrc
source .bashrc

Method 2

Move the contents of .julia to SDCard, and symlink.

mv ~/.julia /mnt/SDCard/julia_dir
ln -s /mnt/SDCard/julia_dir/ /home/your-username/.julia

Afterwards, Julia would use /mnt/SDCard/julia_dir/ in the microSD card to store and access its packages.

Archisman Panigrahi
  • 28,338
  • 18
  • 105
  • 212