ecaepp
ecaepp

Reputation: 563

VsCode Remote SSH .vscode-server taking up a lot of space

I got an alert this morning for disk space in /home on a multi user remote SSH dev environment server.

Running partition -$xdev -type f -ls | sort -k 7 -r -n | head -20 I saw that the largest directories are .vscode-server with space nearing almost 1GB.

974M    .
10:06:16 my_user@my_server .vscode-server → pwd
/home/my_user/.vscode-server
10:08:06 my_user@my_server .vscode-server →  
29459 38028 -rwxr-xr-x   1 my_user  my_user  38940504 Aug 15 11:17 ./my_user/.vscode-server/bin/some_hash/node
26270 38028 -rwxr-xr-x   1 my_user  my_user  38940504 Sep  3 16:51 ./my_user/.vscode-server/bin/some_other_hash/node
24078 38028 -rwxr-xr-x   1 my_user  my_user  38940504 Oct 15 10:34 ./my_user/.vscode-server/bin/yet_another_hash/node
2387 38028 -rwxr-xr-x   1 my_user  my_user  38940504 Oct  9 01:58 /home/my_user/.vscode-server/bin/last_hash/node

Looking through the directories it looks like this is where a lot of VsCode lives on the remote server and where remote extensions are installed to.

Does anyone know if there is any safe files that can be cleaned up in .vscode-server or is just adding more space to /home the solution.

Upvotes: 41

Views: 63217

Answers (6)

Chitranjan Sharma
Chitranjan Sharma

Reputation: 1

I was able to setup vscode Remote SSH and also avoid overloading /home by simply following these 2 steps.

  1. Cleaning up the VS Code Server on the remote server using Visual Studio documentation cleaning-up-the-vs-code-server-on-the-remote.
  2. Make changes to settings.json and install vscode on a seperate path other then /home following Praharsh's comment

Upvotes: 0

Chad Juliano
Chad Juliano

Reputation: 1225

I had an issue where vscode remote extension was hanging the editor whenever I tried to connect. In this case all VSCode windows were becoming unresponsive. I was also seeing a warning in the log about a large extension state.

WARN [mainThreadStorage] large extension state detected (extensionId: ms-vscode-remote.remote-ssh, global: true)

You can't fix this by deleting files because the data is in the Code/User/globalStorage database. I was able to resolve this by deleting the remote-ssh data from the database. To to this:

  1. Open the Developer: Remove Large Storage Database Entries... command option.
  2. Select the ms-vscode-remote.remote-ssh option from the menu.

Upvotes: 0

徐子昊
徐子昊

Reputation: 436

From my practice, you can delete the .vscode-server directory to free space. Next time you log in to this server, the system will automatically install another .vscode-server which tends to be much smaller than the original one.

Upvotes: 32

lIIlIllIIlllIIlI
lIIlIllIIlllIIlI

Reputation: 99

That's right, it really takes up a lot of space. I noticed today that it occupies 1.4TB. It was utterly contemptible. I delete the .vscode-server directory every day at 4 am using crontab

Upvotes: 5

pgoyal
pgoyal

Reputation: 111

Its better to create symlinks to the directory in to your partitions which has more space.

I generally prefer the following (/local/mnt is on a partition which has more space available).

ln -s /local/mnt/workspace/X-server /home//.vscode-server

ln -s /local/mnt/workspace/X /home//.vscode

Upvotes: 2

a1291762
a1291762

Reputation: 336

There seem to be several parts to this...

Before you start removing things, you should remove any vscode-server processes.

I used this to find them...

ps ax | grep -i code

bin/UUID - these are the actual binaries. In theory, you can remove old ones but I'm not sure how to find out which one is current. If you remove them all, VSCode will install the current version for you the next time it connects.

data/User/workspaceStorage - this is the (apparently infamous) workspace that can grow huge. You can remove all of these, and they'll be re-created as needed.

data/logs - these are safe to remove

extensions - You can't just remove these if you want to have them available! (vscode treats remove vs local extensions differently). However, I did notice at least one extension with 2 versions installed, so maybe check for that and remove old versions?

There's more files in there... but these were the only sizeable ones in my .vscode-server directory.

Upvotes: 16

Related Questions