LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How do I make a mounted drive the primary storage location for downloads? (https://www.linuxquestions.org/questions/linux-newbie-8/how-do-i-make-a-mounted-drive-the-primary-storage-location-for-downloads-4175674884/)

darthgonzo 05-08-2020 10:33 PM

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.

sxy 05-08-2020 11:15 PM

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


JeremyBoden 05-09-2020 12:38 PM

It isn't worth directing system downloads to any particular place.
My root partition including /var and numerous cache files occupies less than 10GB.

It is worth directing multi-GB downloads such as ISO's, pictures, videos etc to a your empty disk.

frankbell 05-09-2020 07:53 PM

In Firefox, at least, you can go to Edit-->Preferences-->General-->Downloads, and designate a downloads directory.

fatmac 05-10-2020 05:09 AM

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.

jmgibson1981 05-11-2020 02:55 PM

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.

Code:

ln -s /remote/download/folder /home/"$USER"/Downloads
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



All times are GMT -5. The time now is 12:56 AM.