3

I have just set up my first Google Cloud Compute Engine instance so I can run some Python scripts on large files. As part of the setup I added a 1TB persistent disk:

Screenshot of GCE showing persistent disk 1TB

When I SSH into the the virtual machine I don't see the storage added. This means I can't download my dataset.

Screenshot of SSH into vm and running <code>df</code> command

How do I access the persistent disk?

Thanks.

Maxim
  • 4,075
  • 1
  • 14
  • 23
ChrisTDick
  • 33
  • 4

1 Answers1

4

When you add an additional persistent disk that makes the disk available to your compute engine but you must then format it and mount it before use. This is similar to the notion of adding an additional physical disk to your desktop. Just adding a disk means it is there from a hardware perspective but it must still be defined to the operating system.

There is documentation on the recipe here (Adding or resizing zonal persistent disks)

In summary:

  1. Use sudo lslbk to find the device id.
  2. Format the disk using sudo mkfs.ext4.
  3. Use sudo mkdir to create a mount point.
  4. Use sudo mount to mount the file system.

You can also edit /etc/fstab to mount the file system at boot time.

Kolban
  • 13,794
  • 3
  • 38
  • 60
  • 1
    Thanks! To me it seems unfriendly that GC wouldn't do this for me, but I guess some users must like the flexibility – ChrisTDick Jan 19 '20 at 07:59
  • Usually if you buy a disk or flashdrive in a store, they come pre-formatted, so when you plug it into your computed it's recognized. When you create a new PD (not from a snapshot or image), it's initially completely empty (that is, there's no filesystem), so it can't be recognized/mounted. It'd be dangerous (and not always correct) to auto-format and attach a disk. – atomictom Feb 28 '20 at 20:54