I tested a different version of this script. Though it may not have as cool of a name, it is easier to use, more actively developed, and offers a /home
conversion as well! So, after testing on my own Deck, I have decided to archive my repo with a link to theirs. If you like this version better, feel free to fork it. If you just want to use btrfs, use this: SteamOS Btrfs
Improve your Steam Deck with eight simple steps!
The instructions and files on this page are designed to help you format microSD cards for your Steam Deck with BTRFS. This can lead to tremendous storage space savings and even faster loading performance.
This process involves changing two files in the protected SteamOS partition, which will allow you to format your card more easily and then enable the Deck to automatically mount the card with compression-on-write on insert!
Great question. There are three reasons why you would want to do this.
The are two arguments that might suggest that this isn't a good idea.
There are two files from the Steam Deck that handle mounting and formatting a microSD card formatted with btrfs. Both of these files are located in the /usr/lib/hwsupport/
directory. I copied them to ./unmodified
and ./modified
here in this repository and edited in the modified folder.
This script is called when a microSD card is inserted in the slot on the Deck. You can compare the version in /modified
to /unmodified
to see exact what I changed but I will summarize the two changes to this file below.
if [[ ${ID_FS_TYPE} != "ext4" && ${ID_FS_TYPE} != "btrfs" ]]; then
exit 1
fi
This was already in the file but I added && ${ID_FS_TYPE} != "btrfs"
. The if statement without this addition says to not automatically mount anything that is not the filesystem type ext4
. The addition adds btrfs to the list, simply not closing this script if the drive is formatted with btrfs.
if [[ ${ID_FS_TYPE} == "btrfs" ]]; then
OPTS+=",compress-force=zstd:15"
fi
The block above was added and not just changed like the previous one. This section means that if filesystem is btrfs add the zstd compression with a level of 15 to the mounting options. I selected 15 as the compression level but I am open to change that if someone provides a good reason to. :-)
When you press the "Format SD Card" button in the Steam Deck UI it calls this script. Below is the change I made.
# mkfs.ext4 -m 0 -O casefold -E "$EXTENDED_OPTIONS" -F "$SDCARD_PARTITION"
mkfs.btrfs -f "$SDCARD_PARTITION"
The top line is commented out, that's what the '#' symbol means. The second line is my replacement that formats with btrfs.
cd ~
git clone https://github.com/Trevo525/btrfdeck
cd btrfdeck
deck
user with a password so that you can run things that need sudo.passwd deck
mkdir ./backup/
cp /usr/lib/hwsupport/sdcard-mount.sh ./backup/sdcard-mount.sh
cp /usr/lib/hwsupport/format-sdcard.sh ./backup/format-sdcard.sh
sudo steamos-readonly disable
sudo rm /usr/lib/hwsupport/sdcard-mount.sh && sudo rm /usr/lib/hwsupport/format-sdcard.sh
sudo cp ./modified/sdcard-mount.sh /usr/lib/hwsupport/sdcard-mount.sh
sudo cp ./modified/format-sdcard.sh /usr/lib/hwsupport/format-sdcard.sh
sudo chmod 755 /usr/lib/hwsupport/sdcard-mount.sh /usr/lib/hwsupport/format-sdcard.sh
sudo steamos-readonly enable
sudo passwd -d deck
Press the "Format SD Card" button in the Steam Deck UI.
At this point it should automatically mount the drive because both files were changed. If it does not here is how I would troubleshoot:
deck
user with a password.passwd deck
sudo steamos-readonly disable
sudo rm /usr/lib/hwsupport/sdcard-mount.sh && sudo rm /usr/lib/hwsupport/format-sdcard.sh
cp ./backup/sdcard-mount.sh /usr/lib/hwsupport/sdcard-mount.sh
cp ./backup/format-sdcard.sh /usr/lib/hwsupport/format-sdcard.sh
sudo steamos-readonly enable
sudo passwd -d deck
I don't know how to quantify some of the weird issues I am having so just know this isn't perfect but after I've tested it for a little while longer I'll leave some more notes here. If you try this and you have any issues feel free to leave an issue here.
Thanks to u/ClinicallyInPain on reddit for compiling some of the resources and to u/Hanntac and u/leo_vir for their contributions! Both of the last two credits helped me through PM so I am incredibly thankful for the both of them. Also to u/sporkyuncle for helping me make it more user-friendly.
The following Github users:
Sources: