8

I've got a running instance on GCP and would like to add another persistent disk into it. But it will not show up.

It's an n1-standard-1 instance with a 10 GB storage (named s03). I created another storage disk-1 and mounted it. Then I created disk-2.

disks

Sadly the new one won't show up at ls /dev/disk/by-id like mentioned in the docs here.

shell

fdisk

I rebooted the system and checked the logs, but can't find any issues why disk-2 will not show up. Any ideas?

  • Does it show in dmesg? If not, something is wrong. – John Keates Nov 10 '16 at 1:59
  • looks like i need to restart. :( dmesg shows (Nothing has been logged yet.) – Thomas Schwärzl Nov 10 '16 at 13:48
  • 1
    I'm not sure if GCP/GCE does persistent disks via the hypervisor as a block device or maybe just as an NFS share, but if it's supposed to be a block device a VM reboot will be needed since it apparently doesn't do hotplug support. – John Keates Nov 10 '16 at 15:02
  • I created a Debian 8 VM and attached the disk. It was actually recognized without the need to reboot the system. ls -l /dev/disk/by-uuid lrwxrwxrwx 1 root xx -> ../../sda1 lrwxrwxrwx 1 root xx -> ../../sdb I would try detaching and re-attaching the disk using the CLI. If something is failing you might get more information than from the WUI. How many disks are attached to your VM? Small VMs will not support more than 4 disks and a maximum size of 3TB – Carlos Nov 10 '16 at 21:39
  • The first disk connected without any problems. The second (so there is a total of 3 with the instance-storage itself) will now show up. I deleted disk-2 and created it, rebooted the system - but nothing. – Thomas Schwärzl Nov 11 '16 at 9:09
8
+100

It's actually very simple.
Your screenshot shows that your disk-2 is not attached to your VM instance.
It should look like this

enter image description here

And now compare to what you posted.

So what you need to do is this:

  1. Head to "VM Instances"
  2. Click on your Instance
  3. In the top click on Edit

enter image description here

  1. Scroll down to "Additional disks" section and click Add

enter image description here

  1. Select your disk from the drop down menu

enter image description here

  1. Scroll down to the bottom and click Save.

It should now show up as sdc in the dmesg output

enter image description here

or in the fdisk -l

enter image description here

3

After some testing, I believe your issue is related to the use of a blank disk. In my case, I attached to the VM one blank disk and one formatted disk. The formatted disk got recognized as ¨/dev/sdc1¨ but the blank disk was not showing.

i.e

ls -altr /dev/disk/by-uuid/
total 0
lrwxrwxrwx 1 root root  10 Nov 11 16:50 40206d63-43a8-4d1c-8588-581cefb022a3 -> ../../sda1
lrwxrwxrwx 1 root root  10 Nov 11 17:34 7f63bd57-6ccd-4cea-b0f0-9544870bf67a -> ../../sdc1

¨fdisk -l¨ showed the disk was not partitioned but confirmed it was attached to the VM as /dev/sdb

sudo fdisk -l
Disk /dev/sda: 10 GiB, 10737418240 bytes, 20971520 sectors
.....
/dev/sda1  *     4096 20971519 20967424  10G 83 Linux
Disk /dev/sdb: 10 GiB, 10737418240 bytes, 20971520 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk /dev/sdc: 10 GiB, 10737418240 bytes, 20971520 sectors
.....
/dev/sdc1  *     2048 20971519 20969472  10G 83 Linux

I used ¨fdisk /dev/sdb¨ to create a partition table, then ¨fdisk -l¨ displayed

Disk /dev/sdb: 10 GiB, 10737418240 bytes, 20971520 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x5808f242

Device     Boot Start      End  Sectors Size Id Type
/dev/sdb1        2048 20971519 20969472  10G 83 Linux

As per the document I formatted the disk

sudo mkfs.ext4 -F -E lazy_itable_init=0,lazy_journal_init=0,discard /dev/sdb1

Finally the disk showed

ls -altr /dev/disk/by-uuid/
total 0
lrwxrwxrwx 1 root root  10 Nov 11 16:50 40206d63-43a8-4d1c-8588-581cefb022a3 -> ../../sda1
lrwxrwxrwx 1 root root  10 Nov 11 17:34 7f63bd57-6ccd-4cea-b0f0-9544870bf67a -> ../../sdc1
lrwxrwxrwx 1 root root   9 Nov 11 18:09 460a2e04-0f66-42d4-b9cc-8567aa6ee7b8 -> ../../sdb1
  • Thank you very much for your time investigating the issue. Sadly there's no sdc or anything else for me in fdisk. The 10GB drive is still missing. I updated my question with another screenshot of fdisk. – Thomas Schwärzl Nov 11 '16 at 19:07
  • It is no surprise you need to create a file system before the partition shows up in /dev/disk/by-uuid. After all the only UUID the partition has is the one generated by mkfs.ext4. – kasperd Nov 13 '16 at 9:05
  • how to create a partition of something not even showing in fdisk? – Thomas Schwärzl Nov 13 '16 at 20:03
  • If you run gcloud compute instances describe NAME --zone ZONE How many disks do you see attached? What are the details of the disks being used? i.e interface type, size, SSD, Standard?. Are these disks blank? I suggest checking the messages on your VM serial console when you attach the disk. You should see errors or something like Nov 14 16:36:07 [8965079.397764] sd 0:0:3:0: [sdc] Attached SCSI disk If you spin a new VM using a public image and new disks, does this happen? What kind of VM are you using? – Carlos Nov 14 '16 at 18:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.