user17801714
user17801714

Reputation:

How to resolve the error 'No space left on device' in Google Cloud Shell? Is there any specific cloud shell command to run?

According to this documentation:

Cloud Shell provisions 5 GB of free persistent disk storage mounted as your $HOME directory on the virtual machine instance. This storage is on a per-user basis and is available across projects. All files you store in your home directory, including installed software, scripts, and user configuration files like .bashrc and .vimrc, persist between sessions and count towards the 5 GB limit.

I understand that I ran out of disk space but the docs didn't mention how to free up space in home directory. Is there any cloud shell command to run for me to free up some space? Still a novice in GCP.

Upvotes: 1

Views: 3622

Answers (1)

John Hanley
John Hanley

Reputation: 81414

There are several Linux commands that you can use.

  • ls -la List the files in the current directory
  • ls -la DIRECTORY List the files in the specified directory
  • find DIRECTORY -type file -exec ls -la {} \; list all the files in the specified directory and subdirectores. This will display hidden files.
  • rm FILENAME delete a file

There are many more. Those commands will help you list files and determine which ones you can delete.

You can combine commands to help you determine how space is used. For example, to list the 20 largest files starting at the current directory:

du -a . | sort -n -r | head -n 20

Upvotes: 1

Related Questions