How to add new persistent disk without rebooting the server?
It's actually very simple.
Your screenshot shows that your disk-2 is not attached to your VM instance.
It should look like this
And now compare to what you posted.
So what you need to do is this:
- Head to "VM Instances"
- Click on your Instance
- In the top click on Edit
- Scroll down to "Additional disks" section and click Add
- Select your disk from the drop down menu
- Scroll down to the bottom and click Save.
It should now show up as sdc in the dmesg output
or in the fdisk -l
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