multipass icon indicating copy to clipboard operation
multipass copied to clipboard

Additional disk device (/dev/sdb) on Multipass instance

Open javisnche opened this issue 3 years ago • 34 comments

How do I add an additional disk device on Multipass instance? Multipass already comes with /dev/sda1 which has its own partitions. What I am looking is to create another device disk like /dev/sdb and /dev/sdc.

javisnche avatar Oct 20 '21 05:10 javisnche

Hi @javisnche what would those devices be?

Saviq avatar Oct 20 '21 10:10 Saviq

Hi @javisnche what would those devices be?

@Saviq when I do lsblk, this is what I get: loop0 7:0 0 4K 1 loop /snap/bare/5 loop1 7:1 0 61.9M 1 loop /snap/core20/1169 loop2 7:2 0 67.3M 1 loop /snap/lxd/21545 loop3 7:3 0 1M 1 loop /snap/multipass-sshfs/145 loop4 7:4 0 32.4M 1 loop /snap/snapd/13270 sda 8:0 0 5G 0 disk ├─sda1 8:1 0 4.9G 0 part / ├─sda14 8:14 0 4M 0 part └─sda15 8:15 0 106M 0 part /boot/efi sr0 11:0 1 52K 0 rom

Now I want to add additional devices like sdb and sdc where I can partition to sdb1 and sdc1 respectively.

javisnche avatar Oct 20 '21 11:10 javisnche

@javisnche why do you want those extra disks? They would just end up as extra files on the host file system.

You can use launch --disk to choose the size of the default disk, if you're lacking space.

I would like to understand what can't you achieve with just one disk.

Saviq avatar Oct 20 '21 12:10 Saviq

@Saviq I want to be able to do a block back up and restore from /dev/sda to /dev/sdb. It is very important for us to have more than one disk device with its corresponding partitions on our working environment.

javisnche avatar Oct 21 '21 16:10 javisnche

I have a similar requirement. I want to do some development and want to setup the disk as ceph osd disks.

tuxfux-hlp avatar Oct 26 '21 10:10 tuxfux-hlp

What I think we could do is accept multiple values of --disk, the first one would still refer to the main drive, the extra ones could create additional disks.

It's not something near the top of our roadmap, though, so contributions welcome.

We're working on instance modification now, allowing to modify the size of the main disk, but I don't think we'd be implementing that for any extra disks.

Saviq avatar Oct 26 '21 10:10 Saviq

If the extra disk capability will be implemented, then that will be a big plus. It is a requirement from my job side of things to have at least a backup of my environment. And I can only back up on an additional disk. A few days ago, my multipass environment was corrupted and I lost all my data. This happened because of lack of back up.

javisnche avatar Nov 10 '21 16:11 javisnche

this feature would be great as in many cases you want more than 1 disk attached to a VM

cryptosven76 avatar Nov 11 '21 00:11 cryptosven76

Accepting multiple values of --disk with the first one remaining as the main drive would be excellent. That will be the ultimate solution as I will be able to create multiple disks. I hope this will be implemented asap.

javisnche avatar Nov 11 '21 02:11 javisnche

If I launch a multipass instance say with 50G disk space,

multipass launch --cpus 2 --disk 50G --mem 6G --name secondary

Does this take away 50G immediately from your Mac's volume available storage space?

Does it also immediately take away the cpus (s) and/or the mem.

javisnche avatar Dec 15 '21 09:12 javisnche

@javisnche no, disk is sparse - it will grow up (and slightly beyond, until it cleans up) to the requested size. CPUs are also dynamic (you don't "give" CPUs to instances, but just run "up to" that many tasks on your host's CPU). Memory will also only be allocated as the instance needs it (although that differs between hypervisors), but other than through restarting the instance it won't get freed up again.

Saviq avatar Dec 15 '21 11:12 Saviq

@javisnche no, disk is sparse - it will grow up (and slightly beyond, until it cleans up) to the requested size. CPUs are also dynamic (you don't "give" CPUs to instances, but just run "up to" that many tasks on your host's CPU). Memory will also only be allocated as the instance needs it (although that differs between hypervisors), but other than through restarting the instance it won't get freed up again.

Thanks Saviq

javisnche avatar Dec 15 '21 11:12 javisnche

I noticed that Multipass instances location on Mac is /var/root/Library/Application Support/multipassd/vault/instances Can you please clarify my doubts with the following questions? a. Is there a way to not run multipass as root? c. There is some image there in the above path - How can I locate this image, and and is it possible to open this image on Virtual Box? d. If I am able to open the image on Virtual Box, does it also come with the data lets say data within /home/ubuntu. Say I write files on my multipass /home/ubuntu/a.txt - does this a.txt also comes when I import the image in VirtualBox?

javisnche avatar Dec 15 '21 11:12 javisnche

a. Is there a way to not run multipass as root?

Not at the moment, no.

c. There is some image there in the above path - How can I locate this image, and and is it possible to open this image on Virtual Box?

See https://multipass.run/docs/using-virtualbox-in-multipass-macos

d. If I am able to open the image on Virtual Box, does it also come with the data lets say data within /home/ubuntu. Say I write files on my multipass /home/ubuntu/a.txt - does this a.txt also comes when I import the image in VirtualBox?

You don't import it into VirtualBox, it's there in the first place, if you use the virtualbox driver.

Saviq avatar Dec 15 '21 14:12 Saviq

a. Is there a way to not run multipass as root?

Not at the moment, no.

c. There is some image there in the above path - How can I locate this image, and and is it possible to open this image on Virtual Box?

See https://multipass.run/docs/using-virtualbox-in-multipass-macos

d. If I am able to open the image on Virtual Box, does it also come with the data lets say data within /home/ubuntu. Say I write files on my multipass /home/ubuntu/a.txt - does this a.txt also comes when I import the image in VirtualBox?

You don't import it into VirtualBox, it's there in the first place, if you use the virtualbox driver.

Thanks @Saviq

javisnche avatar Dec 15 '21 22:12 javisnche

i am also looking for this feature for development purposes, would be great to add that feature !

cryptosven76 avatar Jul 16 '22 09:07 cryptosven76

for development, simulating and testing real-world scenarios with multiple disks i'am also looking for this feature.

rolszewo avatar Jul 19 '22 08:07 rolszewo

As an example, if you want to test the operation of a MinIO distributed cluster, then it is impossible to do with a single root device. "Error: Drive http://minio-1.multipass:9091/data_2 is part of root drive, will not be used"

Please add support for multiple drives.

spTorin avatar Aug 22 '22 05:08 spTorin

Is there any update on this one ?

lucj avatar Sep 10 '22 13:09 lucj

any update on this issue? It's important to many to have the ability to define multiple hard disks (raw and attached)....

ksully-execute avatar Nov 12 '22 19:11 ksully-execute

@Saviq would. you be willing to provide guidance for somebody to add this feature ?

cryptosven76 avatar Nov 22 '22 10:11 cryptosven76

Hi @cryptosven76, I am afraid this would require a good deal of time from our side, to provide design and implementations for the different backends and platforms. I agree it would be nice to have this, but our hands are pretty full of other nice things at the moment. We'll be sure to discuss this internally for upcoming roadmap plans though.

I am removing the "help wanted" tag because I think that is misleading in this case.

ricab avatar Nov 23 '22 10:11 ricab

You can add a new disk using VirtualBox GUI app to your instance (sudo VirtualBox). I did it on mac os with VirtualBox driver, and it worked after starting the instance I had /dev/sdb.

zarinfam avatar Jan 14 '23 23:01 zarinfam

I’m also looking forward this function to be added. l don’t know how often Multipass VM runs on production, I rather want to see Multipass has all of these basic functions like this one since Multipass is more likely to be used for test purpose.

Having said that, it’s great app. Thank you so much!

daichikamata avatar Feb 16 '23 16:02 daichikamata

@Saviq @ricab any news on this requested feature. you mentioned in Nov there are no cycles but it will be added to the roadmap. anything you can share on this ?

cryptosven76 avatar Feb 26 '23 15:02 cryptosven76

Hi @cryptosven76, no news on this yet, I am afraid. We did discuss it when planning the last roadmap cycle, but we did not have space to include it quite yet.

ricab avatar Feb 27 '23 10:02 ricab

@Saviq @ricab , my quarterly checkin :-) anything we can help to move this forward ?

cryptosven76 avatar Jun 09 '23 14:06 cryptosven76

Out of curiosity, could a cloud-init file be used to specify the disks / partitions of a Multipass VM ?

lucj avatar Jun 09 '23 14:06 lucj

Hey all,

We plan in 6 month cycles that roughly align with the Ubuntu releases. This did not make our current cycle which ends in October. We will consider it again when planning for the next cycle. Part of this is the actual user experience which are very deliberate about. We strive for a simple interface and as such, we need to think about the best way to make this happen without overcomplicating the CLI. Also, we have to consider multiple platforms with multiple hypervisors and make this work in such a way that it is transparent to the user what platform and hypervisor they are using.

Regarding cloud-init, that would only help partition and initialize a filesystem on a disk that is already attached to the virtual machine. The hypervisor has to be told to pass in the extra disk when booting the OS.

townsend2010 avatar Jun 09 '23 14:06 townsend2010

I have a similar requirement. I want to do some development and want to setup the disk as ceph osd disks.

Hi there, have you solve the problem and deploy the ceph successfully?

ChaoShi036 avatar Mar 04 '24 18:03 ChaoShi036