KeithG
KeithG

Reputation: 41

Error when mounting a read-only persistent disk on Google compute engine

I'm having an issue when mounting a read-only persistent disk to a running instance in Google Compute engine. The error is:

mount: wrong fs type, bad option, bad superblock on /dev/sdb,
safe_format_and_mount:        missing codepage or helper program, or other error
safe_format_and_mount:        In some cases useful info is found in syslog - try
safe_format_and_mount:        dmesg | tail  or so

If I unattached the disk, and re-attach it as read-write, it mounts perfectly fine. So it seems specific to read only disks and I can't seem to find anything in the documentation about mounting read-only disks. Any ideas?

Upvotes: 2

Views: 2929

Answers (2)

KeithG
KeithG

Reputation: 41

Found the answer here: https://askubuntu.com/questions/296331/how-to-mount-a-hard-disk-as-read-only-from-the-terminal It's a general error when mounting a read-only disk.

The mount command is

sudo mount -o ro /dev/[disk_partition] [mounting dir]

Let me emphasise that you have to mount the partition not the drive itself.

Thanks all!

Upvotes: 2

Faizan
Faizan

Reputation: 1967

You can refer to the following article to mount your disk to running instance in read_only mode. https://developers.google.com/compute/docs/disks#attach_disk

Useful commands:

gcutil attachdisk --disk=,mode=read_only

sudo mount /dev/disk/by-id/google- /

Upvotes: 1

Related Questions