Re: What is the best way to move a VM to a bigger image?

2023-05-12 Thread Hannu Vuolasaho
Hello everyone,

And now the conclusion.

I indeed ran the installer to get partitioned disk easily and the
result was just the bsd and base file set installed system.
That system worked fine. Then I dumped and restored the partitions or
filesystem as FAQ instructs. Anyway I got sha256 identical systems
except /dev, /tmp and /etc/fstab

The comparison was interesting.
$ find / -type f >/tmp/files.txt
$ wc /tmp/files.txt
10 100572 5291532 /tmp/files.txt

That was weird. No-one should have exactly 100k files in their system.

I don't understand why during startup all programs just dumped core. I
would suspect  some library randomization.

After re-installing bsd and base fileset again the new disk booted
nicely. I believe relinking the kernel and other end of installation
steps would probably be enough to fix that kind of problem.

So that was my way of doing this operation.

Best regards,
Hannu Vuolasaho



Re: What is the best way to move a VM to a bigger image?

2023-05-08 Thread Matthew Weigel

On 2023-05-06 11:54 am, Hannu Vuolasaho wrote:

Hello,

I made a silly mistake when I set up my VM and my disk image is too
small for my next operation.

My plan is to give the new image to the VM, run a minimal install on
it so I get the boot loader installed. Also disklabel will be good.

...

Is this a good way to skin this cat? Or is there a better way to do it?


It's fine, but I took it a different route recently, for a VM that I've
been using for a year or two but realized I needed more space.  It
wasn't that hard to resize.  However, it is worth calling out that
recreating a VM can be a good way to find out what you need, and don't
need, on it.

If you go for the resize, you'll need the qemu-img tool from the qemu
package in order to make sure the disk image is in qcow2 format (you
can convert from a raw image if necessary), and then change its size.
From there you can do partition and filesystem manipulation from within
the VM.

If you need to do something more complicated than add filesystems or
grow the last partition, you should probably add more disk images or
consider starting from a fresh install.

Matthew



Re: What is the best way to move a VM to a bigger image?

2023-05-07 Thread Nick Holland

On 5/6/23 12:54, Hannu Vuolasaho wrote:

Hello,

I made a silly mistake when I set up my VM and my disk image is too
small for my next operation.

My plan is to give the new image to the VM, run a minimal install on
it so I get the boot loader installed. Also disklabel will be good.

After that I remove all the files and mount the old VM image to
another part of the tree.

Rest is just a dump and restore operation. And checking the /etc/fstab

Is this a good way to skin this cat? Or is there a better way to do it?


Not enough information to give an absolute answer, but on minimal thought,
I can think of a few ways to deal with a space problem on a VM:

0) Just start over
* Advantage: Disk space probably wasn't your only error in setup.  Good
time to fix those other issues, too.  Practice in config.
* Disadvantage: Opportunity to make NEW errors! :)

1) build a new VM, restore from your backup to the new VM.
* Advantage: tests your backup and restoration process.  If your routine
backup/restore process doesn't get you through this, you have a problem.
You still have your old VM untouched.
* Disadvantage: More or less end up with where you started, but more
space.

2) Add additional virtual disks to your VM.  Copy partitions to new disk,
delete partitions on old disk, growfs partitions on old disk to use space
of partitions, etc.
* Advantage: you really learn disk manipulation, can sometimes be done
with minimal downtime.
* Disadvantage: you can really screw stuff up, too, leading to option #0


2a) Enlarge the existing virtual disk, use the additional space as with
option #2 above.

3) Dang, I thought I had another option here, but I'm blanking on what
it was.
Advantage: someone else can put their thoughts in.
Disadvantage: do you really want to trust someone this forgetful?

Nick.



What is the best way to move a VM to a bigger image?

2023-05-06 Thread Hannu Vuolasaho
Hello,

I made a silly mistake when I set up my VM and my disk image is too
small for my next operation.

My plan is to give the new image to the VM, run a minimal install on
it so I get the boot loader installed. Also disklabel will be good.

After that I remove all the files and mount the old VM image to
another part of the tree.

Rest is just a dump and restore operation. And checking the /etc/fstab

Is this a good way to skin this cat? Or is there a better way to do it?

Best regards,
Hannu Vuolasaho