(Note: though I'm asking a different question here, this is essentially to diagnose the same problem I reported in this question on StackOverflow).
I have a Google Cloud Compute Engine virtual machine. The image uses Google Container-Optimized OS (if that gets in the way of debugging I'm thinking of switching to Ubuntu instead). I followed the instructions in their documentation to format a newly mounted volume on the machine. Specifically, I ran:
sudo mkfs.ext4 -m 0 -F -E lazy_itable_init=0,lazy_journal_init=0,discard /dev/[DEVICE_ID] sudo mkdir -p /mnt/disks/[MNT_DIR] sudo mount -o discard,defaults /dev/[DEVICE_ID] /mnt/disks/[MNT_DIR] sudo chmod a+w /mnt/disks/[MNT_DIR]
MNT_DIR is the directory I was mounting on the device, and
DEVICE_ID is the name of the device, as per
sudo lsblk (automatically
sdb, it seems, not that it matters).
ls -l /mnt/ shows that the volume seems to have mounted correctly, and that there are world read-write-modify permissions to the directory:
drwxrwxrwx 3 root root 4096 Mar 8 00:00 subway-explorer-datastore
OK, now I'd like to transfer some data over to this machine. GCE includes a
google compute scp command (documented here), which seems like just a thin wrapper on the UNIX
scp command. So I can use that to write some data off of my local dev machine and onto this cloud disk, right?
So I run:
gcloud compute scp ~/Desktop/subway-explorer-api/logbooks.sqlite gke-webapp-default-pool-49338587-d78l:/mnt/subway-explorer-datastore --zone us-central1-a
And I get fiddly squat out of it.
scp: /mnt/subway-explorer-datastore: Read-only file system ERROR: (gcloud.compute.scp) [/usr/bin/scp] exited with return code .
The rest of the file system is fine. For example, the following succeeeds:
gcloud compute scp ~/Desktop/subway-explorer-api/logbooks.sqlite gke-subway-explorer-default-pool-2bef4d1d-f7dn:/dev/null
This is an error raised by
scp, not by the thin
gcloud wrapper. To my inexperienced eyes, the permissions on the root folder seem fine. So what are some reasons why
scp might be throwing this error? How do I debug it?