Tutorial  Updated

Using a Secondary Drive For Steam On Linux

This guide is for the Linux desktop, and is going to cover how to mount a secondary storage medium on your Steam directory under your user's home directory. The benefit of this is that you don't have to do any reconfiguring under Steam, nor do you have to "move" your games using the Steam client. This guide also assumes that you have a little familiarity with Linux, and aren't afraid of cracking open a terminal. I'll try to make things as simple as possible, though.

Step one is to install and format your drive. I'm using an NVMe, but SATA drives can be used, as well. I do recommend against the use of external drives, though. They don't have enough throughput to offer a pleasant experience, so avoid using them for active data. I also recommend the EXT4 filesystem for its journaling capabilities, but you are free to use something else if you have a preference. If you're not familiar with partitioning a drive on Linux, I recommend installing and using GParted. Just use your distro's package manager to grab it.

1702338881928.png


Using the drop-down in the top-right corner, select the drive you wish to use if it wasn't already selected.

Note: NVMe drives and SATA drives follow specific naming conventions, as you can see in the screenshot above. If using a SATA drive, it will instead be displayed as "/dev/sd*x*". Just be mindful of this. Also, as a big warning, be ABSOLUTELY SURE that you have the right drive selected. You're going to be creating a new partition table on it, and this will destroy anything present on the drive.

Once you have the proper drive selected, click Device, and then click Create Partition Table. If using a drive larger than 2 TB, you'll want to use GPT. Otherwise, MBR should be fine, but it won't hurt to use GPT if you prefer to.

Once the partition table has been created, you'll be able to right-click the empty drive in the list, and choose to create a new partition on it. As mentioned, go with EXT4, and give it a label if you'd like. From here, you're going to temporarily mount the drive, and copy the contents of your Steam directory to it. To do this, you'll make use of rsync, as it will effectively make a proper 1:1 copy of the files and symlinks. If your distro doesn't come with it installed, just use your package manager to install it.

This first command will list all block devices. You can use this to find your drive and partition ID if you didn't make note of them in GParted. In the example output, you'll notice that mine is already mounted.

Code:
lsblk

NAME            MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINTS
...
nvme0n1         259:0    0   1.8T  0 disk
└─nvme0n1p1     259:1    0   1.8T  0 part  /home/joom/.steam
...

Once you have the IDs, you can mount the partition, and begin the copying phase.

Code:
sudo mount -t ext4 /dev/<drive/part> /mnt
sudo rsync -avPH /home/<user>/.steam/* /mnt/

This may take a while, depending on your drive type and how many games you have installed, so feel free to take a break here. Once it finishes, you're going to set up the drive's automount settings. To do this, drop to a root shell. Be mindful when working in this type of shell, as you can very easily break your system if you don't know what you're doing.

Code:
sudo su -

This next command will give you the UUID of the partition you created. Take a look at my example output to see what you should get.

Code:
blkid /dev/<drive/part>

/dev/nvme0n1p1                                                                                           
/dev/nvme0n1p1: LABEL="games" UUID="65713451-241a-428c-9eae-69ea413ead41" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="be2a4b0a-3456-4fdd-aa61-716679ae81ef"

Note: If using a SATA drive, your drive and partition ID will follow the "sd*x*Y*" scheme, like "/dev/sdb1".

Once you have the UUID, make note if it somewhere in a text editor, and put it to the side for the moment. From here, you're going to edit the fstab. This is the file that tells the OS how and where to mount partitions on boot. As root, you will need to make use of a terminal based text editor, and I recommend nano if you're new to this. It usually comes preinstalled, but if you don't have it, your package manager will.

Code:
nano /etc/fstab

Once you have this file open in your terminal, make a new line at the end of it, and make an entry similar to this:

Code:
/dev/disk/by-uuid/<UUID> /home/<user>/.steam ext4 rw,nosuid,nodev,nofail,user,exec 0 0

Be sure to insert the UUID, and your username, as needed. Everything else should be left alone. Once done, press Ctrl+O and Enter to save the file, and then Ctrl+X to exit nano. After that, you'll need to drop back to your user's shell, and issue a couple more commands to finish everything off. To exit from the root shell, you can either issue "exit" as a command, or press Ctrl+A+D. Once back in your normal shell, unmount the drive from the temporary location, rename your Steam directory to make a backup of it, and make a new one in its place.

Code:
cd (This command just ensures you're in your home directory)
sudo umount /mnt
mv .steam{,.bak}
mkdir .steam

Now, for the moment of truth. Reboot, and if everything is set up correctly, you should now have a dedicated drive for Steam! If not, Steam will fail to launch, and you can issue "steam" as a command to find out why. If you need help deciphering anything, just share the output here. Provided all went well, feel free to delete the backup of the old Steam directory. For good measure, I recommend having Steam verify your game files. It may not be necessary, but I did this myself for the sake of such.
 
Last edited by Joom,
  • Love
Reactions: Blauhasenpopo

Dungeonseeker

Well-Known Member
Member
Joined
Mar 28, 2016
Messages
440
Trophies
0
Age
42
XP
1,714
Country
The 'proper' way to achieve this would be to mount the drive in the place where its expected to be (/run/media/$USER) then symlink it to $USER/.steam. Having drives randomly mounted all over your FS is not a good idea and /run/media was specifically created to fix this. I won't bore anyone with the details but bad things can happen if multiple users have the same mount in different places, symlinking from a permanent mount point is safer.
 

Joom

 ❤❤❤
OP
Member
Joined
Jan 8, 2016
Messages
6,067
Trophies
1
Location
US
Website
mogbox.net
XP
6,077
Country
United States
The 'proper' way to achieve this would be to mount the drive in the place where its expected to be (/run/media/$USER) then symlink it to $USER/.steam. Having drives randomly mounted all over your FS is not a good idea and /run/media was specifically created to fix this. I won't bore anyone with the details but bad things can happen if multiple users have the same mount in different places, symlinking from a permanent mount point is safer.
Nowhere does the guide imply that anybody should be mounting a single partition all over the place. It very plainly covers a single user's home directory. What you said doesn't make much sense, either. Why wouldn't you instead create a Steam partition for each user, and mount those, rather than grant anybody and everybody access to your personal Steam data? To do what you're suggesting, you would need to create a group, add every user to said group, and then chown your entire Steam directory's group ownership. Then you're suggesting that a symlink be thrown "all over your FS". A symlink to your own data that anybody can access if they're part of this group, and we can assume everybody will be. This is beyond proper etiquette, and I sincerely hope nobody actually sets their system up like this. The practice was phased out a long time ago. An actual proper way to do this for a multiuser system would be to allot an amount of space for each user, and have that space mount with, and only with, that user's permissions. If you want to library share, just sign into your account under that user.

That all said, I could also be overthinking this. I guess you could have multiple .steam directories on a single partition all symlinked to their respective user, but that seems to be a rather dirty way to go about this. Regardless, it'd be more secure than what I ranted about, and I do apologize if that's what you were referring to.
 
Last edited by Joom,

Dungeonseeker

Well-Known Member
Member
Joined
Mar 28, 2016
Messages
440
Trophies
0
Age
42
XP
1,714
Country
Nowhere does the guide imply that anybody should be mounting a single partition all over the place. It very plainly covers a single user's home directory. What you said doesn't make much sense, either. Why wouldn't you instead create a Steam partition for each user, and mount those, rather than grant anybody and everybody access to your personal Steam data? To do what you're suggesting, you would need to create a group, add every user to said group, and then chown your entire Steam directory's group ownership. Then you're suggesting that a symlink be thrown "all over your FS". A symlink to your own data that anybody can access if they're part of this group, and we can assume everybody will be. This is beyond proper etiquette, and I sincerely hope nobody actually sets their system up like this. The practice was phased out a long time ago. An actual proper way to do this for a multiuser system would be to allot an amount of space for each user, and have that space mount with, and only with, that user's permissions. If you want to library share, just sign into your account under that user.

That all said, I could also be overthinking this. I guess you could have multiple .steam directories on a single partition all symlinked to their respective user, but that seems to be a rather dirty way to go about this. Regardless, it'd be more secure than what I ranted about, and I do apologize if that's what you were referring to.
Fun fact: When you automount any drive using any popular DE it will always mount to /run/media/$USER/UUID. You think there is a reason for this, and there is.

Also its kinda on me too, I wasn't actually referring to a multiuser setup and I probably should have made that point clearer. The only reason why I brought it up at all is because it is the aforementioned reason. As I said, having 2 or more users accessing a mount point directly CAN cause issues (TBF modern journaling helps too), its safer to symlink because the kernel has scheduling and a cache so it can store writes till later on. You absolutely can mount anywhere you like and chances are it will work absolutely fine but you 'should really' mount to a fixed location and symlink.

Also why would you need a group? If you actually were doing multiuser on one drive then you can have one folder per user owned by that user with 744 and symlink each to its respective $HOME, a symlinks destination name can be different to its source name.

EG ln -s /whatever/user1steam /$HOME/.steam
 
  • Like
Reactions: E1ite007 and Joom

Joom

 ❤❤❤
OP
Member
Joined
Jan 8, 2016
Messages
6,067
Trophies
1
Location
US
Website
mogbox.net
XP
6,077
Country
United States
Also why would you need a group? If you actually were doing multiuser on one drive then you can have one folder per user owned by that user with 744 and symlink each to its respective $HOME, a symlinks destination name can be different to its source name.
That's a good point. The "$USER" variable is what was making me immediately jump to that conclusion, and on a regular basis, I'm working in things that will flip out if you chmod to anything that's not what they expect. So, that just came from force of habit (or rather, what I've seen people do to bypass certain things). I reckon Steam isn't as big a stickler as web facing stuff, though.
 

Dungeonseeker

Well-Known Member
Member
Joined
Mar 28, 2016
Messages
440
Trophies
0
Age
42
XP
1,714
Country
That's a good point. The "$USER" variable is what was making me immediately jump to that conclusion, and on a regular basis, I'm working in things that will flip out if you chmod to anything that's not what they expect. So, that just came from force of habit (or rather, what I've seen people do to bypass certain things). I reckon Steam isn't as big a stickler as web facing stuff, though.
Would that be Apache or NGINX? :rofl: Gotta be honest, it took me way longer than I'd care to admit to work out permissions when I switched to Linux (nearly 10 years ago now), its so far removed from what Windows has (or more accurately, what it doesn't have) that it was like rewiring my brain to remember that groups exist and actually do something useful. On Windows, outside of a domain, you're either an Administrator or a User and you either have access to your own files or everything.

$USER just echos the current users login, its a way of giving written instructions that skips the step of having the user have to change things.
 

Joom

 ❤❤❤
OP
Member
Joined
Jan 8, 2016
Messages
6,067
Trophies
1
Location
US
Website
mogbox.net
XP
6,077
Country
United States
Would that be Apache or NGINX? :rofl:

And LiteSpeed...Though, thankfully, I only have to worry about NGINX if it's being used as a reverse proxy. Anybody who sets it up as a standalone is on their own. Anything outside of a sem-traditional LAMP stack isn't my problem.

$USER just echos the current users login, its a way of giving written instructions that skips the step of having the user have to change things.
Right, exactly. When explaining something, I use "$whatever" all the time to mean "replace with current", so my mind was thinking you meant the user setting up the drive. That's why I was like "why would you share a single user's Steam data across multiple accounts". It's a case of me overthinking things, as mentioned. Anyway, I plan to rewrite this guide, and update my own system to follow your suggestion. I do like the idea of keeping mounted drives out of my home directory.
 
  • Like
Reactions: Dungeonseeker

RHOPKINS13

Geek
Member
Joined
Jan 31, 2009
Messages
1,371
Trophies
2
XP
2,790
Country
United States
It's probably worth noting that most distros include some sort of partition manager GUI that may not be named GParted. KDE Partition Manager and GNOME Disks both work great, without needing to add additional software to your system if you already have one of them.

When I first got my Steam Deck, I used BTRFS to share a partition between Windows and SteamOS (Steam on Linux has issues if you try to use it with NTFS). I used a symbolic link to map my steamdata folder to a folder on the BTRFS partition. It worked, I could install a game once, and play it on either Windows or Linux. But there were all sorts of issues. Some games would load on one OS and not the other. I could use Steam to "Repair" the game and get it to run on one OS, but then it would fail on the other one. At the end of the day it wasn't worth it. So many of my games run flawlessly on SteamOS now. I now have my Windows partition down to a 256gb NTFS partition, and the rest of my 2TB SSD is for SteamOS. I might boot into Windows once a month, but for the most part it goes unused.

Anyway, I'm not sure why using a symbolic link would be preferable to managing this through Steam's UI?
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • BigOnYa @ BigOnYa:
    Good, just fired up the SeriesX and have a frozen Margarita in hand. Life is good. N U?
  • NinStar @ NinStar:
    @salazarcosplay are you into beer and guns?
  • S @ salazarcosplay:
    @BigOnYa what games on the series x?
  • S @ salazarcosplay:
    I have not seen the need to get one because Halo was on the xbox
    One
    +1
  • S @ salazarcosplay:
    @NinStar those are fun things
  • BigOnYa @ BigOnYa:
    Tons of good games on gamepass, but currently playing College football 25.
  • K3Nv2 @ K3Nv2:
    Sipping on his bud wiser jamming kid rock
    +1
  • BigOnYa @ BigOnYa:
    I'm ....An....American Jackass.
  • DexterYeen @ DexterYeen:
    Im... steve
  • BigOnYa @ BigOnYa:
    Hi steve, I'm Mike, last name Rotchburns.
  • Sicklyboy @ Sicklyboy:
    im dat boi
    +1
  • BigOnYa @ BigOnYa:
    Sometimes in bed, my wifey calls me Ken, not sure why tho...
    +1
  • The Real Jdbye @ The Real Jdbye:
    must be a different ken
    +1
  • SpookyBaker @ SpookyBaker:
    Hey did you guys see that MF DOOM Gladiator popcorn bucket?
  • Kirbydogs @ Kirbydogs:
    I feel like there's a new "Rule 34"
  • Kirbydogs @ Kirbydogs:
    where with everything that exists, it's gonna have an AI counterpart.
  • Kirbydogs @ Kirbydogs:
    It should be called "Rule AI"
  • BigOnYa @ BigOnYa:
    What is this word you use "Rule"?
    +1
  • Kirbydogs @ Kirbydogs:
    Here's a fun fact: The human brain is immensely complicated. For example, whenever you want to make a decision, I believe your unconscious mind processes it first, and makes your muscles prepare. Then, you perform the action, such as walking.
  • BigOnYa @ BigOnYa:
    Here's a fun fact: A ton of feathers weights the same as a ton of bricks, which weights the same as Kens mum.
    BigOnYa @ BigOnYa: Here's a fun fact: A ton of feathers weights the same as a ton of bricks, which weights the same...