When you're stuck with limited storage space, there's always the option of purchasing more storage, but what if you can't. Devices like Chromebooks and some laptops are fairly limited. Thankfully, Linux has a few tricks to help to make your Linux system administration job easier. Because Unix-like systems treat everything as a file, you can easily use symbolic links and mounted partitions to maximize space.In this tutorial you will learn:
- How to Use Symbolic Links at /home
- How to Use Symlinks Elsewhere
- How to Extend Your Storage with Mount Points
- How to Make Effective Use of Networked Drives
Software Requirements and Conventions Used
|Category||Requirements, Conventions or Software Version Used|
|System||Any Linux Distribution|
|Other||Privileged access to your Linux system as root or via the
# - requires given linux commands to be executed with root privileges either directly as a root user or by use of
Use Symbolic Links at /home
/home directory probably contains some major storage hogs. Sure, there are the obvious cuplrits like multimeda and games, but there are other massive folders that tend to reside here, like browser configurations, cache directories, and email.
Many of these files and folders are hidden. Your
.cache directory and Thunderbird's
.thunderbird are great examples. Steam's game directory is buried under
.local/share. These hidden directories can drain your whole drive without you being able to readily see it.
Home directories, by their very nature, aren't essential to the system, so you can put any file or folder from your home directory anywhere else on your system without any negative impact. Say you have a massive folder that's becoming a problem, say
~/Games, you can put it somewhere else on your system, and link it back to it's regular place in
Start by copying the problem directory to someplace with more available space. If you're on a desktop with multiple drives, you can always throw your directory on a completely different drive with a larger capacity.
cp -r ~/Games /media/mass-storage/
Now, just create a link back in your
/home directory where the original folder was.
ln -s /media/mass-storage/Games ~/Games
You'll see the folder in
/home, but it's actually just a link to the real location. Programs and scripts will behave the same way, and you shouldn't notice any difference, except for the free space.
Use Symlinks Elsewhere
When you're using symbolic links in system directiories, you need to be sure thet the files you're moving aren't essential to boot. Moving system files from the root filesystem to a different drive can easily create issues because the system will always mount root first.
Even still, it's not uncommon for your root partition to fill up, and one of the biggest offenders is
/usr/share. Since, that directory acts as a catch-all for program assets, it probably won't impact boot too much. It's fairly safe to link that elsewhere, if you need to.
Extend Your Storage with Mount Points
On Linux systems, you can mount just about any partition just about anywhere. Because of that flexibiltiy, you're free to carve up your drives into all sorts of partitions, and mount them wherever you need the space.
There are two fairly obvious directories that commonly make their way onto other partitions or drives,
/var. Both directories have a tendency to get out of hand, and they're both easily relocated.
It's always easiest to set this up when you're first installing your system, but you can easily do it at any point. Begin by actaully creating the new partition. Then, copy everything from the original directory to the new partition. Treat the partition as it it was the folder itself. Then, run
blkid on the partition to find its UUID. Create a new addition to
/etc/fstab for the drive. Afterward, you can safely remove the old files, and remount everthing with
Make Effective Use of Networked Drives
While the storage isn't exactly on our machine, using networked storage is always an option. NFS shares are easy enough to mount anywhere on your system, and they're also simple enough to set up with fstab.
Networked storage is perfect for multimedia. Network speeds, especially over LAN, are sufficient for playing media files. It's easy enough to get an absolutely massive networked storage drive set up, so there's no reason not to take advantage of it.
If you're creative, you can do a lot to rearrange your files on a Linux system to take advantage of every bit of storage space you have. You may need to play with permissions some to allow access when directories are placed in somewhat unorthodox places.