[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-04。"],[[["\u003cp\u003eGoogle Cloud automatically generates symbolic links (symlinks) in \u003ccode\u003e/dev/disk/by-id\u003c/code\u003e for all disks attached to a Linux virtual machine (VM), ensuring consistent access across reboots.\u003c/p\u003e\n"],["\u003cp\u003eSymlinks for Persistent Disks use the format \u003ccode\u003egoogle-DEVICE_NAME\u003c/code\u003e, \u003ccode\u003egoogle-VM_NAME\u003c/code\u003e (boot disk), or \u003ccode\u003egoogle-DISK_NAME\u003c/code\u003e (non-boot disk), while Local SSD symlinks are named \u003ccode\u003egoogle-local-ssd-N\u003c/code\u003e (SCSI) or \u003ccode\u003egoogle-local-nvme-ssd-N\u003c/code\u003e (NVMe), where N is the disk number.\u003c/p\u003e\n"],["\u003cp\u003eAfter formatting, a \u003ccode\u003e-partN\u003c/code\u003e suffix is added to the symlink name to represent the partition number of the disk.\u003c/p\u003e\n"],["\u003cp\u003eSpecific Linux images like SLES 15 SP4/SP5 and SLES 12 SP4 on C3/C3D VMs might require extra steps to create user-friendly symlinks for Local SSD disks.\u003c/p\u003e\n"],["\u003cp\u003eYou can use device names like \u003ccode\u003e/dev/nvme0n1\u003c/code\u003e as an alternative to using symlinks to access Local SSD disks.\u003c/p\u003e\n"]]],[],null,["# Use symbolic links to access disks attached to a Linux VM\n\nLinux\n\n*** ** * ** ***\n\nWhen you attach a disk to a virtual machine (VM) that uses a Linux OS,\nGoogle Cloud automatically creates a symbolic link (symlink) for the disk. To\naccess Persistent Disk volumes or Local SSD disks in your Linux VM, use the\nsymlinks. These symlinks are predictable and remain consistent across reboots.\nGoogle Cloud creates symlinks for all disks attached to a VM in\n`/dev/disk/by-id`.\n\nThis document explains how to identify the correct symlinks for the disks\nattached to a VM.\n\nFormat of symbolic links\n------------------------\n\nSymlinks are created in `/dev/disk/by-id` when a disk is attached to the VM,\neither during or after VM creation. The symlink names are created as follows:\n\n**Persistent Disk and Google Cloud Hyperdisk**\n\nThe symlinks are created using the following rules:\n\n- If you specified a custom device name when you created the disk: `google-`\u003cvar translate=\"no\"\u003eDEVICE_NAME\u003c/var\u003e\n- If you didn't specify a custom device name when you created the disk:\n - Boot disk: `google-`\u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e\n - Non-boot disk: `google-`\u003cvar translate=\"no\"\u003eDISK_NAME\u003c/var\u003e\n\nAfter you format the disk, the symlink is appended with\n`-part`\u003cvar translate=\"no\"\u003eN\u003c/var\u003e, where \u003cvar translate=\"no\"\u003eN\u003c/var\u003e is the partition number,\nfor example `google-data-disk-part1`.\n\n**Local SSD disks**\n\nLocal SSD symlinks have different formats depending on the disk interface.\n\n- SCSI:\n - If you specified a custom device name when you created the disk: `google-`\u003cvar translate=\"no\"\u003eDEVICE_NAME\u003c/var\u003e\n - If you didn't specify a custom device name when you created the disk: `google-local-ssd-`\u003cvar translate=\"no\"\u003eN\u003c/var\u003e, where \u003cvar translate=\"no\"\u003eN\u003c/var\u003e is the Local SSD disk number, starting from 0.\n- NVMe: The symlinks are named `google-local-nvme-ssd-`\u003cvar translate=\"no\"\u003eN\u003c/var\u003e, where \u003cvar translate=\"no\"\u003eN\u003c/var\u003e is the SSD number, starting from 0.\n\nAfter you format a Local SSD disk, the symlink is appended with\n`-part`\u003cvar translate=\"no\"\u003eN\u003c/var\u003e, where \u003cvar translate=\"no\"\u003eN\u003c/var\u003e is the partition number,\nfor example, `google-local-nvme-ssd-0-part1`.\n\n**Device symlinks**\n\nCompute Engine creates additional symlinks in the directory based on the disk\ntype and interface, for example `scsi-0Google_PersistentDisk_`\u003cvar translate=\"no\"\u003eDEVICE_NAME\u003c/var\u003e.\nThese links perform the same function as the symlinks mentioned previously.\n\n**Example 1: C3 VM with attached Local SSD**\n\nAssume you created a VM with the following properties:\n\n- VM name: `instance-1`\n- Machine series: C3\n- Disk interface type: NVMe for both Persistent Disk and Local SSD\n- Additional disks: none\n- Attached Local SSD disks: 2\n- Custom device names used: none\n\nCompute Engine creates the following symlinks for that VM: \n\n ls -l /dev/disk/by-id/google-*\n\n google-instance-1 -\u003e ../../nvme2n1\n google-instance-1-part1 -\u003e ../../nvme2n1p1\n google-instance-1-part14 -\u003e ../../nvme2n1p14\n google-instance-1-part15 -\u003e ../../nvme2n1p15\n google-local-nvme-ssd-0 -\u003e ../../nvme0n1\n google-local-nvme-ssd-1 -\u003e ../../nvme1n1\n\nIn this example, the Persistent Disk boot disk symlink is `google-instance-1`, which\nis based on the VM name. The boot disk is formatted and has the operating system\ninstalled on it. The boot disk has 3 partitions: part1, part14, and part 15.\nThe attached Local SSD disks are not formatted, so\nonly a single symlink was created for each Local SSD disk.\n\n**Example 2: N2 VM with attached NVMe Local SSD and extra Persistent Disk**\n\nAssume you created a VM with the following properties:\n\n- VM name: `instance-2`\n- Machine series: N2\n- Disk interface type: SCSI for Persistent Disk and NVMe for Local SSD\n- Additional disks: 1 Persistent Disk named `extra-scsi-disk`\n- Attached Local SSD disks: 2\n- Custom device names used: none\n\nThe following symlinks are created for that VM: \n\n ls -l /dev/disk/by-id/google-*\n\n google-extra-scsi-disk -\u003e ../../sdb\n google-instance-2 -\u003e ../../sda\n google-instance-2-part1 -\u003e ../../sda1\n google-instance-2-part14 -\u003e ../../sda14\n google-instance-2-part15 -\u003e ../../sda15\n google-local-nvme-ssd-0 -\u003e ../../nvme0n1\n google-local-nvme-ssd-0-part1 -\u003e ../../nvme0n1p1\n google-local-nvme-ssd-1 -\u003e ../../nvme0n2\n\nIn this example, the Persistent Disk boot disk symlink is `google-instance-2`, which\nis based on the VM name. The boot disk is formatted and has the OS image\ninstalled on it. The boot disk has 3 partitions: part1, part14, and part 15.\nThe first Local SSD disk is also partitioned, with a single partition, so\nthere is an additional symlink created for that disk partition.\nThe additional Persistent Disk added to the VM has the\nsymlink `google-extra-scsi-disk`, which is based the disk name. The extra\nPersistent Disk and second Local SSD disk are not formatted,\nso only a single symlink is listed for those disks.\n\nWhat's next\n-----------\n\n- Learn how to [use persistent device names](/compute/docs/disks/set-persistent-device-name-in-linux-vm).\n- Format and mount your new disks on [Linux](/compute/docs/disks/format-mount-disk-linux) or [Windows](/compute/docs/disks/format-mount-disk-windows) VMs.\n- Learn how to [benchmark Persistent Disk performance](/compute/docs/disks/benchmarking-pd-performance)."]]