Hey Gabriel,
Gabriel Santos <[email protected]> writes: > Greetings, > > * The Question > > How do I define a custom storage capacity for a Guix image, to be used by > nom-Guix > users? First of all, I would recommend to use --image-size argument of the guix system image to generate the image with the size you want instead of doing this manually after creation of the image. This size is then used for the size of the root partition. > > * The Context > > I have a repository[0] for setting up Guix virtual machines for setting up > environments > I can use for reproducing issues. > > It works fine, though, I'm having an issue with the storage available for the > virtual machines: > > <https://0x0.st/PimL.png> > > They don't use the disk size I gave them (in the case of this screenshot, > /dev/sda). Now, > I have to admit that my experience with VMs was mostly just chucking Linux > ISOs at > VirtualBox on Windows, so the solution must be really simple. This is expected based on what you did - you resized only the disk itself. But apart from the disk there is the root partition. And on that partition is a file system. What `df` shows is the size of the file system. To see what you did, you would see the effect in `fdisk -l` for example. There you would see the disk is resized to your desired size. To properly resize image with all of that, you need to also resize the partition and grow the file system. There are multiple ways to do that. I think the easiest is this: 1. growpart from cloud-utils 2. resize2fs from e2fsprogs (prior to that forced e2fsck) For this you need the disk to be available in your /dev though. To do that in the host system you can use `qemu-nbd`, sudo modprobe nbd max_part=8 sudo qemu-nbd --connect=/dev/nbd0 ./image.qcow2 If these steps were done, then the rest of the steps would be sudo growpart /dev/nbd0 1 sudo e2fsck -fy /dev/nbd0p1 sudo resize2fs /dev/nbd0p1 Another alternative would be doing this in QEMU - boot into a 'bootstrap' system and add this disk you are resizing as second disk, executing these commands in this bootstrap system. That way you wouldn't have to use sudo in your host system. Rutherther > > I tried to define a file-system for /dev/sda in the file-systems field but > had no > success. I generate and run the VMs with the make-iso[1] script. > > [0] <https://github.com/gs-101/guix-vm> > [1] <https://github.com/gs-101/guix-vm/blob/main/make-iso> > > Regards, > > -- > Gabriel Santos
