evansm7 / vftool

A simple macOS Virtualisation.framework wrapper

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to increase vm's disk space

lifubang opened this issue · comments

Hello, I create a ubuntu vm use vftool, and I find that the space of "/" is 985M, how to increase it? Thanks.

ubuntuvmdisk

you have to mount an image file via the -d option and then provide kernel parameters for persistent storage when using vftool.

This page describes a method for Ubuntu image, other image has different parameters.

https://iphonesdkdev.blogspot.com/2020/12/20201202.html

Great, it's working now. Thank you very much @javacom .

I am following the instructions in the article at https://iphonesdkdev.blogspot.com/2020/12/20201202.html

It says:

(6) # Attach the vm and create 3 partitions for the created image
sudo fdisk /dev/vda
# Press (n)(p)(1) to create new partition 1
# Press (enter) to accept starting sector and set size to say +25G
# Press (n)(p)(2) to create new partition 2
# Press (enter) to accept starting sector and set size to say +15G
# Press (n)(p)(3) to create new partition 3
# Accept the default options and starting block and ending block
# Press (w) to write to partition

But at step 6 I get:

ubuntu@ubuntu:~$ sudo fdisk /dev/vda

Welcome to fdisk (util-linux 2.34).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): n
All space for primary partitions is in use.

If I press p I see:

Disk /dev/vda: 2.2 GiB, 2169300992 bytes, 4236916 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device     Boot   Start     End Sectors  Size Id Type
/dev/vda1            64 4235891 4235828    2G cd unknown
/dev/vda2       4235892 4236915    1024  512K ef EFI (FAT-12/16/32)

so /dev/vda only has 2.2GiB to allocate, and two existing partitions. I can delete them but I can't make either of them bigger than 2.2 GiB.

I after a few different attempts I eventually noticed this while starting up the vm:

Starting version 245.4-4ubuntu3.3
[    0.407550] input: gpio-keys as /devices/platform/gpio-keys/input/input0
[    0.408961] virtio_blk virtio2: [vda] 4236916 512-byte logical blocks (2.17 GB/2.02 GiB)
[    0.409010] vda: detected capacity change from 0 to 2169300992
[    0.424441] virtio_net virtio0 enp0s1: renamed from eth0
[    0.429104]  vda: vda1 vda2
[    0.429433] virtio_blk virtio3: [vdb] 104857600 512-byte logical blocks (53.7 GB/50.0 GiB)
[    0.429456] vdb: detected capacity change from 0 to 53687091200
Begin: Loading essential drivers ... done.
Begin: Running /scripts/init-premount ... done.
Begin: Mounting root file system ... Begin: Running /scripts/nfs-top ... done.
Begin: Running /scripts/nfs-premount ... done.
[    1.662183] random: fast init done
[    1.662279] /dev/vda2: Can't open blockdev
[    1.754684] overlayfs: "xino" feature enabled using 2 upper inode bits.
[    1.784317] /dev/vda2: Can't open blockdev
[    1.841370] /dev/vda2: Can't open blockdev
[    1.885666] /dev/vda2: Can't open blockdev

So it looks like /dev/vda is the iso itself(?) and /dev/vdb is the 50GB zeroed file we created as data.img

Changing the command to sudo fdisk /dev/vdb I was able to proceed.

If you compile the latest vftool, which has added the ability to add more image files and the order of the mounted device will follow the parameters you passed in. The article was written using the first version of the vftool and will mount the data.img as the /dev/vda and the cdrom image as /dev/vdb. So if you use the latest version vftool compiled, you have to check the device name of your mounted data.img.

I am following the instructions in the article at https://iphonesdkdev.blogspot.com/2020/12/20201202.html

It says:

So it looks like /dev/vda is the iso itself(?) and /dev/vdb is the 50GB zeroed file we created as data.img

Changing the command to sudo fdisk /dev/vdb I was able to proceed.

If you compile the latest vftool, which has added the ability to add more image files and the order of the mounted device will follow the parameters you passed in. The article was written using the first version of the vftool and will mount the data.img as the /dev/vda and the cdrom image as /dev/vdb. So if you use the latest version vftool compiled, you have to check the device name of your mounted data.img.

I am following the instructions in the article at https://iphonesdkdev.blogspot.com/2020/12/20201202.html
It says:

So it looks like /dev/vda is the iso itself(?) and /dev/vdb is the 50GB zeroed file we created as data.img
Changing the command to sudo fdisk /dev/vdb I was able to proceed.

Sorry if I sound silly, this is all quite new to me. It sounds fine following the attached guide and using the latest vftool, but if packages are stored (apt-get) in /usr/ - wouldn't I lose all my installation files (including docker and everything else) on reboot, considering they aren't in /dev/*?

If you follow the guide you will get a docket vm solution temporary with persistence storage. But I found there is a limitation that the IP segment in the vm is fixed at 192.168.64.x and did not expose to outside world and a bridged network is required to achieve this.

The permanent solution is to use docker natively on M1 Mac. You can join the beta preview program below to see if the beta functionality for M1 is satisfactory or not. If you want to to join program preview, you have to join the Docker hub and Docker slack to get Docker ID and docker slack screen display name to fill in the preview program questionnaire.

https://www.docker.com/community/get-involved/developer-preview

I have created a new slack channel called # dockermac to discuss future building docker arm64 images for M1.

Sorry if I sound silly, this is all quite new to me. It sounds fine following the attached guide and using the latest vftool, but if packages are stored (apt-get) in /usr/ - wouldn't I lose all my installation files (including docker and everything else) on reboot, considering they aren't in /dev/*?

If you follow the guide you will get a docket vm solution temporary with persistence storage. But I found there is a limitation that the IP segment in the vm is fixed at 192.168.64.x and did not expose to outside world and a bridged network is required to achieve this.

The permanent solution is to use docker natively on M1 Mac. You can join the beta preview program below to see if the beta functionality for M1 is satisfactory or not. If you want to to join program preview, you have to join the Docker hub and Docker slack to get Docker ID and docker slack screen display name to fill in the preview program questionnaire.

https://www.docker.com/community/get-involved/developer-preview

I have created a new slack channel called # dockermac to discuss future building docker arm64 images for M1.

Sorry if I sound silly, this is all quite new to me. It sounds fine following the attached guide and using the latest vftool, but if packages are stored (apt-get) in /usr/ - wouldn't I lose all my installation files (including docker and everything else) on reboot, considering they aren't in /dev/*?

I already signed up for the beta and I'm waiting on the Slack to be added to the right channel. Hopefully not too long now 👍