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

How to set the size of root disk vm when using container root fs #104

Open
sharadregoti opened this issue Jun 27, 2024 · 1 comment
Open

Comments

@sharadregoti
Copy link

This is my virtlink yaml. Even though I have set the size as 10Gi it does not have any effect.

apiVersion: virt.virtink.smartx.com/v1alpha1
kind: VirtualMachine
metadata:
  labels:
    virtlink.io/os: linux
    virtlink.io/vm: "{{ .Values.virtualMachine.name }}"
  name: "{{ .Values.virtualMachine.name }}"
spec:
  instance:
    # TODO: Set up cpu
    # https://github.com/smartxworks/virtink/blob/main/docs/dedicated_cpu_placement.md
    memory:
      size: "{{ .Values.memory }}"
    interfaces:
      - name: pod
    disks:
      - name: image
      - name: cloud-init
  volumes:
    - name: image
      containerRootfs:
        image: "{{ .Values.image }}"
        size: 10Gi
    - name: cloud-init
      cloudInit:
        userData: |-
          #cloud-config
          system_info:
            default_user:
              name: ubuntu
              home: /home/ubuntu

          password: ubuntu
          chpasswd: { expire: False }
          hostname: ubuntu

          runcmd:
            - chown ubuntu:ubuntu /home/ubuntu -R

          # configure sshd to allow users logging in using password
          # rather than just keys
          ssh_pwauth: True
          ssh_authorized_keys:
            - {{ .Values.virtualMachine.sshKey }}
  networks:
    - name: pod
      pod: {}

I am running a ubuntu cloud disk image. (The default size that I get is 2GB)

ubuntu@ubuntu:~$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 2.0G 1.9G 85M 96% /
tmpfs 996M 0 996M 0% /dev/shm
tmpfs 399M 508K 398M 1% /run
tmpfs 5.0M 0 5.0M 0% /run/lock
/dev/vda15 105M 6.1M 99M 6% /boot/efi
tmpfs 200M 4.0K 200M 1% /run/user/1000

@fengye87
Copy link
Contributor

It should work. See code here.

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