Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supporting hard drive size configuration #423

Open
tolmasky opened this issue May 31, 2022 · 1 comment
Open

Supporting hard drive size configuration #423

tolmasky opened this issue May 31, 2022 · 1 comment

Comments

@tolmasky
Copy link

We've been able to get hard drive size configuration working with the following:

class VagrantPlugins::Parallels::Config
    
    # Extend the Vagrant::Parallels::Config class to have the missing size
    # setter. We use prlctl's set --size, and we have to use --no-fs-resize
    # because prlctl doesn't support ext4. Not to worry though, we'll handle
    # that in the shell script below...
    def size=(size)
        customize('pre-boot',
            ['set', :id, '--size', size.to_s + 'M', '--no-fs-resize'])

        customize('post-comm',
        [
            'exec', :id,
            <<-SHELL
                printf "resizepart\n3\nYes\n100%%\nquit" | \
                    sudo parted /dev/sda ---pretend-input-tty && \
                resize2fs /dev/sda3
            SHELL
        ])

    end
end

However, this also requires us to first modify the Parallels box available on vagrant cloud:

$ tar xf parallels-ubuntu-box.box -C ./tmp
$ prlctl --merge `$(find ./tmp -name *pvm)/harddisk1.hdd`
$ tar cvzf parallels-ubuntu-box-resizable.box -C ./tmp ./tmp/*

After this, you can finally treat size just like memory, and you can resize it freely across reboots as well:

  config.vm.provider "parallels" do |box, override|
    box.size = 100000
  end

We've wrapped up that unfortunate prlctl merge stuff in a function that lets you call it directly from Vagrant and caches it:

config.vm.box = resizable_box "generic/[email protected]"

Anyways, is this something worth putting into the main parallels plugin? It was certainly hard to put all this information together, but I don't know enough about all this to know if this will work for everything or just happens to work on our installation. We've only tried it with ubuntu 18.04 and 20.04.

@zarinfam
Copy link

zarinfam commented Mar 4, 2023

This is an essential feature, and I wonder why the parallels vagrant plugin does not support this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants