gpt4 book ai didi

google-cloud-platform - 如何从 GCP 虚拟机获取文件?

转载 作者:行者123 更新时间:2023-12-02 03:25:36 26 4
gpt4 key购买 nike

我目前有一个 GCP 虚拟机,我尝试在其中安装某些内容,但 Ubuntu 上出现“无内存剩余”错误。我尝试再次打开 SSH,但不起作用。

P.S 防火墙/连接没有问题。

我只是想要一种下载我存储在虚拟机中的文件的方法。有没有办法在不访问终端的情况下执行此操作?

最佳答案

如果您无法通过串行控制台登录,那么剩下的唯一选择就是通过创建新虚拟机从旧虚拟机中检索数据。

您可以按照以下步骤从受影响的(旧)虚拟机磁盘复制数据。

1 Create a snapshot from the boot disk of the OLD VM

2 Create a new VM. As a boot disk, you should use a Google public image (important- do not use the snapshot you created).

3 Once that instance is created, try to SSH into it just to test if you are able to access it. There should be no issue at this point with this VM instance, as this is a new instance using a fresh operating system.

4 In the newly created instance, click on the instance name (in the Console), and then click ‘Edit’ at the top of the page to edit the machine.

5 In the ‘Additional Disks’ section, click ‘Add item’.

6 In the ‘Name’ drop-down select ‘Create disk’. In the window that opens add a name for the disk, and in the ‘Source snapshot’ drop-down select the snapshot you created in Step 1. Now Click ‘Create’

7 Click ‘Save’ to save the instances new configuration.

8 Please SSH into the new instance, and run command $lsblk . You will be able to see the new disk and partition added (It will most probably be named sdb1 but you should check this and take note).

9) Please run the following command which will create a mount point at /mnt/newdisk and then mounts the additional disk partition to that mount point. Note- substitute /dev/sdb1 in the below command with the name of the partition if it is different.

$ sudo mkdir /mnt/newdisk | sudo mount -o discard,defaults /dev/sdb1 /mnt/newdisk

快照文件系统现在将安装在/mnt/newdisk。

您现在应该能够导航目录并检索任何数据。

希望这对您有帮助。

关于google-cloud-platform - 如何从 GCP 虚拟机获取文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53527063/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com