I'm trying to set up my Fstab file to automatically mount my NTFS drives in Cachy OS since I need to keep my dual boot with Windows. Previously, I was mounting drives manually through Dolphin, but now I want to automate the process. I've encountered a problem with drive names that have spaces. For instance, I have one drive mounted at "/run/media/XXX/Samsung 990 pro PCIE 4". While everything works fine when using Dolphin, my Fstab entry using `UUID=XXXXXXXXXX /run/media/XXX/Samsung 990 pro PCIE 4 ntfs3 defaults,nofail 0 0` isn't being recognized due to the spaces. I've tried using escape characters like `%`, but that didn't help Steam recognize the drive as it should. I would love to maintain the same mounting style as when I click in Dolphin. Anyone know how to handle spaces in the Fstab file correctly? Thanks!
4 Answers
According to the Fstab manual, when you're specifying paths with spaces, you can escape them by replacing spaces with `40` or using quotes. This means a line like this: `UUID=XXXXXXXXXX /mnt/media/XXX/Samsung4099040pro40PCIE404 ntfs3 defaults,nofail 0 0` should work perfectly!
Make sure you either put quotes around your entire mount point like this: `"/run/media/XXX/Samsung 990 pro"` or escape each space with a backslash. So, it could look something like this: `/run/media/XXX/Samsung 990 pro`. Just be careful with the syntax!
You can try escaping the spaces with backslashes like this: `UUID=XXXXXXXXXX /run/media/XXX/Samsung 990 pro PCIE 4 ntfs3 defaults,nofail 0 0`. Alternatively, you can enclose the entire path in quotes: `UUID=XXXXXXXXXX "/run/media/XXX/Samsung 990 pro PCIE 4" ntfs3 defaults,nofail 0 0`. I usually avoid spaces in my mount names, but this should work for yours! Oh, and if you haven't, check if your distro has a GUI disk utility for easier management of mount options.
Thanks for the tips! Just to let you know, I found that replacing spaces with ` 40` works perfectly: `"/run/xxx 40x"`. But I appreciate your help!
I also have a drive with spaces in the name, and it works fine using quotes in my Fstab entry like this: `UUID=0000000000 /athing/somethingelse/"large volume" defaults,nofail 0 2`. If quoting doesn't work, then the escaping method should definitely be the way to go!
Good to know! I think using quotes will definitely simplify things for some users.

Thanks! That worked perfectly! Now I can finally mount my drives automatically. I've been looking for this info for hours, so I really appreciate the guidance.