To prevent losing files in temporary storage when your Cloud Shell instance is released, mount a File Storage NAS instance to store your scripts and files persistently.
Prerequisites
-
Cloud Shell uses File Storage NAS for persistent storage. For more information about File Storage NAS, see What is File Storage NAS?.
-
You must create a pay-as-you-go, Performance-type File Storage NAS instance, which incurs minor usage fees. For more information, see NAS billing overview.
-
Use a RAM identity (a RAM user or RAM role) to access Cloud Shell. To create a NAS instance, you must grant the RAM identity the required permissions for File Storage NAS. For more information, see Use RAM for access control.
Procedure
Mount a File Storage NAS file system as the $HOME directory in your Cloud Shell instance. This provides persistent storage and prevents data loss when the instance is released.
Mount file storage
-
In the toolbar, click the storage icon > Mount File Storage.
-
In the dialog box, click Create Now. The system creates a NAS instance and binds it to Cloud Shell. This initial setup may take a few minutes.
-
After the NAS instance is bound, Cloud Shell automatically recreates the virtual machine. This automatic process takes less than 30 seconds.
-
After the virtual machine is recreated, you can use the instance. In the toolbar, click the storage icon > Mount File Storage to view the file system ID of the bound instance.
-
Click the file system ID to view the basic parameters of the instance.
The Basic Information page includes parameters such as file system ID, file system name, storage specification, file system type, file system status, mount target status, protocol type (for example, NFS), region, availability zone, billing method, encryption method, and creation time.
Unmount file storage
-
In the toolbar, click the storage icon > Unmount File Storage.
-
In the dialog box, click Unmount Now. Cloud Shell unbinds the NAS instance.
Note-
If you no longer need the NAS service, manually release the file system instance. After the instance is released, all files stored in it are permanently deleted. For more information, see Release a file system instance.
-
If you do not release the NAS instance, Cloud Shell rebinds to it the next time you mount storage, instead of creating a new one.
-
-
After the NAS instance is unbound, Cloud Shell automatically recreates the virtual machine. This automatic process takes less than 30 seconds.
-
After the virtual machine is recreated, it reverts to using temporary storage for the
$HOMEdirectory. When the Cloud Shell instance is released, you lose all custom settings, installed third-party software, and files in the$HOMEdirectory.