mounting a root persistent disk to another instance

1,830 views
Skip to first unread message

Zhuyi Xue

unread,
May 3, 2016, 3:51:36 PM5/3/16
to gce-discussion
 I modified /etc/default/grub based on instructions from the `Adjust memory and swap accounting` section on https://docs.docker.com/engine/installation/linux/ubuntulinux/. After reboot, I cannot ssh successfully anymore. I still have data on the disk so I like to access it somehow.

I have tried, deleting the instance (e.g. name it A) while keeping its root persistent disk, then I attach the disk to another instance (B), but I cannot mound it on B successfully. Here is the error message

sudo mount -o discard,defaults /dev/disk/by-id/google-persistent-disk-1 ~/dev5/
mount
: you must specify the filesystem type

Then I specified -t ext4

sudo mount -o discard,defaults -t ext4 /dev/disk/by-id/google-persistent-disk-1 ~/dev5/
mount
: wrong fs type, bad option, bad superblock on /dev/sdb,
 missing codepage
or helper program, or other error
 
In some cases useful info is found in syslog - try
 dmesg
| tail or so

What should I do to gain access to the disk again, please? Thanks!

Zhuyi Xue

unread,
May 3, 2016, 3:55:55 PM5/3/16
to gce-discussion
BTW, I was on a Debian 7.10 (Wheezy)

Faizan (Google Cloud Support)

unread,
May 3, 2016, 7:47:28 PM5/3/16
to gce-discussion
Hello Zhuyi,

Can you post the output of the following:

1. sudo parted -l
2. dmesg | tail

Thanks

Faizan

Zhuyi Xue

unread,
May 3, 2016, 9:30:28 PM5/3/16
to gce-discussion
Here is the output

dev4[127]:sudo parted -l
Model: Google PersistentDisk (scsi)
Disk /dev/sda: 268GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos

Number  Start   End    Size   Type     File system  Flags
 
1      2097kB  268GB  268GB  primary  ext4         boot


Model: Google PersistentDisk (scsi)
Disk /dev/sdb: 268GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos

Number  Start   End    Size   Type     File system  Flags
 
1      2097kB  268GB  268GB  primary  ext4         boot


dev4
[0]:dmesg | tail
[  938.297364] aufs au_opts_verify:1570:docker[2975]: dirperm1 breaks the protection by the permission bits on the lower branch
[  938.353729] aufs au_opts_verify:1570:docker[2683]: dirperm1 breaks the protection by the permission bits on the lower branch
[  938.390473] device vethf07cd4f entered promiscuous mode
[  938.396391] IPv6: ADDRCONF(NETDEV_UP): vethf07cd4f: link is not ready
[  938.664459] IPv6: ADDRCONF(NETDEV_CHANGE): vethf07cd4f: link becomes ready
[  938.671774] docker0: port 1(vethf07cd4f) entered forwarding state
[  938.678313] docker0: port 1(vethf07cd4f) entered forwarding state
[  938.686161] IPv6: ADDRCONF(NETDEV_CHANGE): docker0: link becomes ready
[  953.692052] docker0: port 1(vethf07cd4f) entered forwarding state
[  996.184782] [sched_delayed] sched: RT throttling activated

Faizan (Google Cloud Support)

unread,
May 5, 2016, 3:42:30 PM5/5/16
to gce-discussion
Hello Zhuyi,

Can you try the following command to see if that works for you:

$ sudo mount -t ext4 /dev/disk/by-id/google-persistent-disk-1-part1 ~/dev5/

Thanks,

Faizan

Zhuyi Xue

unread,
May 6, 2016, 12:42:12 AM5/6/16
to gce-discussion
Great, it works! Thanks, Faizan!

But I wonder why -t ext4 is necessary? According to https://cloud.google.com/compute/docs/disks/add-persistent-disk, I thought the following is enough

sudo mount -o discard,defaults /dev/disk/by-id/google-[DISK_NAME] /mnt/[DISK_NAME]

Faizan (Google Cloud Support)

unread,
May 6, 2016, 11:10:25 AM5/6/16
to gce-discussion
Hello Zhuyi,

If you are trying to mount a partition with a common filesystem type, mount will auto-detect the partition type. In case, if the filesystem is not detected you need to specify it in your command.

One important information in the command that I gave you is, specifying the partition of the disk with the filesystem. Which in your case was "google-persistent-disk-1-part1" and not the disk itself "google-persistent-disk-1"

I hope that helps.

Faizan

Jingpeng Wu

unread,
Sep 22, 2016, 1:36:30 AM9/22/16
to gce-discussion
Thanks for the explaination! Unfortunately, it do not work in my case!

Here are my system output (ubuntu 14.04)

```

sudo parted -l

Model: Google PersistentDisk (scsi)

Disk /dev/sda: 161GB

Sector size (logical/physical): 512B/4096B

Partition Table: msdos


Number  Start   End    Size   Type     File system  Flags

 1      1049kB  161GB  161GB  primary  ext4         boot



Warning: Unable to open /dev/sdb read-write (Read-only file system).  /dev/sdb

has been opened read-only.

Model: Google PersistentDisk (scsi)

Disk /dev/sdb: 5369GB

Sector size (logical/physical): 512B/4096B

Partition Table: loop


Number  Start  End     Size    File system  Flags

 1      0.00B  5369GB  5369GB  ext4


```


```

 dmesg | tail

[   87.057373] cgroup: systemd-logind (1537) created nested cgroup for controller "memory" which has incomplete hierarchy support. Nested cgroups may change behavior in the future.

[   87.057377] cgroup: "memory" requires setting use_hierarchy to 1 on the root

[  134.482326] EXT4-fs (sdb): INFO: recovery required on readonly filesystem

[  134.482330] EXT4-fs (sdb): write access unavailable, cannot proceed

[  177.868501] EXT4-fs (sdb): INFO: recovery required on readonly filesystem

[  177.868505] EXT4-fs (sdb): write access unavailable, cannot proceed

[  237.470384] EXT4-fs (sdb): INFO: recovery required on readonly filesystem

[  237.470388] EXT4-fs (sdb): write access unavailable, cannot proceed

[  397.327991] EXT4-fs (sdb): INFO: recovery required on readonly filesystem

[  397.327994] EXT4-fs (sdb): write access unavailable, cannot proceed

```

Reply all
Reply to author
Forward
0 new messages