28

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.

Gama11
  • 31,714
  • 9
  • 78
  • 100
ecaepp
  • 423
  • 1
  • 4
  • 9
  • 1
    Found this documentation that might be relevant, but looks like it is for a single user: https://code.visualstudio.com/docs/remote/troubleshooting#_cleaning-up-the-vs-code-server-on-the-remote – Holistic Developer Jan 27 '22 at 16:25

4 Answers4

19

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.

Mr_Joe
  • 19
  • 5
徐子昊
  • 306
  • 3
  • 4
13

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.

William Prigol Lopes
  • 1,803
  • 14
  • 31
a1291762
  • 196
  • 1
  • 5
  • There is a file 'package.json' in all of the bin/UUID folders, so you can use `grep -H version */package.json` to find out – Amfasis Aug 24 '23 at 06:29
0

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

pgoyal
  • 91
  • 1
  • 3
0

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