How do I make a mounted drive the primary storage location for downloads?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How do I make a mounted drive the primary storage location for downloads?
Hey folks!
So in a previous post, I mentioned how I was unable to boot my system past a frozen Linux Mint splash screen (also unable to login with my user credentials even if I made it that far) so after much frustration, I actually just gave up on troubleshooting and performed a fresh installation. I'm pretty sure this issue arose from the fact that I hadn't mounted or partitioned my HDD for storage so all of my downloads went straight to the local disk (sda1 120GB) and **spoiler alert** completely filled my disk space.
So now after a fresh installation (I'm running Linux Mint 19.3 Tricia - Cinnamon), I'm hoping to avoid cluttering up my disk space by directing all downloads to my 2TB HDD, which is already mounted and ready to go. So how can I make sure that when I download software or programs, from Software Manager for example, they will be downloaded to my hard drive instead of to the local disk?
If any additional system specs or terminal information is needed, let me know and I'll provide it in this thread.
1) Determine where the Software Manager stores its downloads, for example /var/cache.
2) Add an entry like
Code:
<your hdd> /var/cache <fs type> defaults 0 0
to /etc/fstab. (For more info, see 'man fstab' and 'man mount'.)
(BTW, it surprised me that programs could eat up 120G disk space...)
EDIT: Sorry. I didn't notice you've already got your hdd mounted and maybe you don't want to change its mountpoint. Create a symbolic link should work.
For example, assuming download location is /var/cache,
Code:
mv /var/cache /var/cache.bak
mkdir -p <mountpoint of your hdd>/var/cache
ln -s <mountpoint of your hdd>/var/cache /var/cache
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,505
Rep:
You should find that your browser will allow you to change where they get stored, it is usually found under the Preferences menu. I always like it to 'ask me where' to put them, as I don't always want them in the same directory folder.
For user downloads I find the less per app customization I do, the better. I just mount my new drive and or create a folder dedicated to my user in a location with plenty of space, and replace the /home/"$USER"/Downloads with a symlink to that remote location. One and done.
In the case of package manager stuff, as far as Debian based stuff make a directory on your 2tb drive, hidden if you want and symlink to /var/cache/apt/archives. As long as it's got the right permissions the system will never know the difference. This would be my way of doing it, although as mentioned above if you maintain properly it should never really get that big. My upgrade scripts usually have an apt clean at the bottom of them, my squid http proxy keeps stuff cached on the lan for me.
Code:
mkdir -p /new/drive/.aptcache
# chown and chmod if needed
chown root:root /new/drive/.aptcache
chmod 755 /new/drive/.aptcache
# copy current archives downloads to new location
rsync -auv --progress /var/cache/apt/archives/* /new/drive/.aptcache/
# remove old folder
rm -r /var/cache/apt/archives
# link new target to old location
ln -s /new/drive/.aptcache /var/cache/apt/archives
Last edited by jmgibson1981; 05-11-2020 at 03:03 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.