How to migrate old Google Compute Engine disks?

2019-07-17 16:54发布

I am using Google Compute Engine in Europe and the maintenance window just hit us. The "automatic migration" didn't work, so all of our servers are offline. During the recovery from backup, we found a few files missing.

I have a persistent boot disk created from the debian-7-wheezy-v20130617 image with data, which I am trying to access.

I came up with 2 possible solutions to access the data:

  1. Create a new VM with the old bootdisk. Sounds easy, but Google changed something and the VM won't boot.

  2. Create a new VM with a new image and attach the old bootdisk. Sounds easy, but the old disk is not recognized using good old safe_format_and_mount.

Any ideas how to access the data from the disk? The migration doc didn't really help, it seems they assume you always have the old VM with the old disk still running.

2条回答
太酷不给撩
2楼-- · 2019-07-17 17:20

As your disks were created before the migration to the current v1 API, before you can re-attach the disk to a new instance, you must upgrade the disk to use an embedded kernel.

查看更多
Deceive 欺骗
3楼-- · 2019-07-17 17:41

Finally figured out how to access the data on old disks in a new VM.

  1. Create a new VM with a current OS image.
  2. In addition attach old boot disks as read only
  3. In the VM check attached disks with ls -la /dev/sd* . "sda" is boot, the others attached.

brw-rw---T 1 root disk 8, 0 Jan 22 11:18 /dev/sda
brw-rw---T 1 root disk 8, 1 Jan 22 11:18 /dev/sda1
brw-rw---T 1 root disk 8, 16 Jan 22 11:18 /dev/sdb
brw-rw---T 1 root disk 8, 17 Jan 22 11:18 /dev/sdb1
brw-rw---T 1 root disk 8, 32 Jan 22 11:49 /dev/sdc
brw-rw---T 1 root disk 8, 33 Jan 22 11:49 /dev/sdc1

4 Create mount point mkdir /mnt/disk_b and mount disk partition mount /dev/sdb1 /mnt/disk_b.

mount: block device /dev/sdb1 is write-protected, mounting read-only

5 Check your data ls -la /mnt/disk_b

查看更多
登录 后发表回答