Trevo525 / btrfdeck

This repo will get you from using ext4 on your Steam Deck's microSD card, to btrfs.
123 stars 11 forks source link

Works after Converting Card to BTRFS, but SD Card icon won't go away #7

Open Crono141 opened 2 years ago

Crono141 commented 2 years ago

First, a big thanks for setting up these scripts to automate things as much as possible. Unfortunately, I had already filled up 2/3rds of a 1tb SD card before discovering this. In lieu of starting from scratch, I decided to experiment and (on a separate computer) do a brtfs-convert operation on my existing steam deck SD card. Here's the command I ran and the output:

sudo btrfs-convert --uuid copy -p -l primary /dev/sdb1                                                                                       1 ✘ 
btrfs-convert from btrfs-progs v5.17 

WARNING: non-unique UUID (copy): bc13434a-ad7d-45ee-8076-b2c6df5bfa29
Source filesystem:
  Type:           ext2
  Label:          
  Blocksize:      4096
  UUID:           bc13434a-ad7d-45ee-8076-b2c6df5bfa29
Target filesystem:
  Label:          primary
  Blocksize:      4096
  Nodesize:       16384
  UUID:           bc13434a-ad7d-45ee-8076-b2c6df5bfa29
  Checksum:       crc32c
  Features:       extref, skinny-metadata, no-holes (default)
    Data csum:    yes
    Inline data:  yes
    Copy xattr:   yes
Reported stats:
  Total space:    1023869452288
  Free space:     270688247808 (26.44%)
  Inode count:        62496768
  Free inodes:        62326062
  Block count:       249968128
Create initial btrfs filesystem
Create ext2 image file
Create btrfs metadata
Copy inodes [O] [    309269/    170706]
Set label to 'primary'
Conversion complete

I then mounted and defragged the card (on the same computer)

sudo btrfs filesystem defragment -r -czstd /home/crono141/cdrom                                                                                   ✔ 
ERROR: defrag failed on /home/crono141/cdrom/steamapps/common/20XX/BabelStoneHan.ttf: Input/output error
ERROR: defrag failed on /home/crono141/cdrom/steamapps/common/DARK SOULS III/Game/Data5.bdt: Input/output error
total 2 failures

I'm not sure if compression happened or not during the defrag. Here's the btrfs df before and after.

sudo btrfs filesystem df /home/crono141/cdrom                                                                                            1 ✘  4s  
Data, single: total=701.45GiB, used=626.68GiB
System, single: total=4.00MiB, used=144.00KiB
Metadata, single: total=920.00MiB, used=910.08MiB
GlobalReserve, single: total=512.00MiB, used=0.00B

After:

sudo btrfs filesystem df /home/crono141/cdrom                                                                                     1 ✘  1h 8m 49s  
[sudo] password for crono141: 
Data, single: total=701.45GiB, used=649.88GiB
System, single: total=4.00MiB, used=144.00KiB
Metadata, single: total=1.90GiB, used=956.97MiB
GlobalReserve, single: total=512.00MiB, used=0.00B

Anyway, I removed the SD card from my computer and put it into the steam deck. At first I though something had gone wrong, as the "Format SD Card" icon showed up in game mode. However, I went to the storage part of the game mode settings, and my library shows up, no problem, and says its the default install location (which is desired).

So it seems everything has worked, except the SD card icon is still present, and if I go into the general settings it shows the format SD card button. So I am wondering what about the format process occurs which tells game mode not to show the sdcard icon. Thought I would ask here as an issue to potentially expand our understanding and functionality (like for example, a "convert ext4 to btrfs script).

Any thoughts?

EDIT: Actually, the steam OS storage page shows the SD card, but doesn't show any of the games on it. However, I can launch any of the games I know are installed on the SD card no problem, even though game mode doesn't see them as installed. So maybe its an issue of registering the card with game mode somehow?

EDIT Again: Steam Desktop mode shows all the games on the SD Card no problem.

Crono141 commented 2 years ago

OK, New reply as I solved (part) of the weird behavior. I managed to get game mode to recognize the titles on the SD card. I had to go into the .steam/steam/config/libraryfolders.vdf file, and find the entry relevant to the SD card, and copy that into the libraryfolder.vdf file on the sd card. After that, Game mode on steam shows all my installed titles on the SD card properly. So now the only issue to work around is the Format SD card icon in the notification area.

Toastytwo commented 2 years ago

Hi, just reporting the same behaviour on my deck.

Ran every step in the guide 1:1, icon stays on...

Crono141 commented 2 years ago

Hi, just reporting the same behaviour on my deck.

Ran every step in the guide 1:1, icon stays on...

DId you do a fresh format or convert existing SDcard. I converted mine, data in place.

Toastytwo commented 2 years ago

Fresh formated w. SteamOS, copied my games over from another sd card (ext4) which does not have the icon permanently. Maybe the script isn't exiting correctly?

Toastytwo commented 2 years ago

Copy proccess was interesting though, cpu got hammered pretty constantly writing to btrfs partition. Doing some a-b testing with my two cards right now to determine the impact while gaming. Maybe I'll go with lower copression or w/o, just enjoying the dedup feature but dunno yet. Some really nice options to have, big kudos to Trevo! ^^

Crono141 commented 2 years ago

I checked the script to see if it was possible some flag wasn't getting set properly in the updated script vs the old script, but I didn't see anything. So there might be some other magic happening somewhere else in the OS that flags the SD card as processed or not.

Trevo525 commented 2 years ago

Sorry, I missed all of this convo previously. I thought the icon of an SD card at the top was just telling you that a microSD card was inserted? I believe that icon was there even before when I had an ext4 formatted microSD card. I could be wrong though.

For the other issue and maybe it's something that I am also dealing with. Sometimes, I have the icon but my library doesn't show the games on the microSD card. If this happens the solution for me is to remove the card and reinsert it. Then after a few seconds it mounts it again and adds it to the library. Once A microSD card is loaded properly and it shows the games in my library, it has always stayed working until I removed it next. So, I have kind of ignored this issue with an easy fix. But, can you confirm that your symptoms are the same or similar?

Lastly, according to this other issue the compression might not being working properly. So, I may need to drop compression from this repo. I need to do some testing when I get some free time to.

Crono141 commented 2 years ago

@Trevo525 no worries. I just put the old scripts back in place to test, and the SD card icon does indeed go away with stock scripts after a format.

EDIT: Even more interestingly: after formatting an SD to ext4 and the icon disappearing, when I swap scripts and reboot with the EXT4 card still inserted, the sd icon stays away. Putting in the BTRFS card brings the icon back. So I think there must be something in the SteamOS game mode overlay hard coded to look for EXT4 specifically and show the icon if it doesn't see it.

Trevo525 commented 2 years ago

Thanks for testing! That means that there is a script somewhere that is checking for ext4 and showing what I guess would be called the "format sd card icon". If someone could find the script, we could make the change and add it to this repo. But, I also am not sure if it's really an issue and worth having a third file being changed with this repo. I have been perfectly content thinking it was just an "sd card inserted icon".