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

Increase available storage with VMDK #169

Closed
nhorvath opened this issue Aug 21, 2018 · 31 comments
Closed

Increase available storage with VMDK #169

nhorvath opened this issue Aug 21, 2018 · 31 comments
Labels
board/ova Open Virtual Appliance (Virtual Machine) wontfix

Comments

@nhorvath
Copy link

How do I add storage to HassOS running in VMware?

@rbray89 rbray89 added the board/ova Open Virtual Appliance (Virtual Machine) label Aug 25, 2018
@B-Kramer
Copy link

I use VirtualBox and I had to increase the size as well.
@pvizeli can we make the default size larger? It requires a lot of steps to increase it later.

@nhorvath
Copy link
Author

nhorvath commented Aug 27, 2018 via email

@mihalski
Copy link

mihalski commented Aug 29, 2018

The default size is 6GB right?
With VMware my process is as follows:

  1. Download HassOS image and extract vmdk.
  2. Create new VM in Fusion/Workstation with UEFI boot and the HassOS vmdk.
  3. Edit settings (such as disk size) to my preferences and apply. Note: Disk must be IDE and not SCSI.
  4. Export OVA (NEVER START THE VM).
  5. Upload OVA to VMware ESXi server (could probably also upload via Fusion/Worstation)
  6. Start VM.

If you intend to run in the desktop version of VMware (Fusion/Workstation) then just skip steps 4 and 5.

To move everything to the new install you will need to hassio snapshot your old system setup, download it and restore it on the new instance.

@nhorvath
Copy link
Author

nhorvath commented Aug 29, 2018 via email

@mihalski
Copy link

mihalski commented Aug 29, 2018

You lose nothing from starting again but potentially days of messing around without success if you try resizing an existing install.

@mihalski
Copy link

mihalski commented Aug 29, 2018

FYI. When you restore a snapshot the add-ons will need to download from their repositories, therefore if you have added a repository and installed an add-on from it, you will first need to re-add the repository to the new install. And don't forget to give the add-ons time to download and re-install.

@nhorvath
Copy link
Author

nhorvath commented Aug 29, 2018 via email

@mihalski
Copy link

mihalski commented Aug 29, 2018

Before you restore the snapshot, add any repo that you have installed an add-on from. If you are using the included repos then all you have to do is wait for the add-ons to redownload and install. The configs will be preserved. I learnt all this today when following my own instructions.

Now my hassio install is 30GB instead of 6GB.

@nhorvath
Copy link
Author

nhorvath commented Aug 29, 2018 via email

@mihalski
Copy link

I've done it before (not in hassos though) and it's always been a major PITA. You need to resize the drive in VMware, then boot off an iso image such as parted-live and shift around partitions.. I don't think it's worth the effort as even if it was supported it would take LONGER than a snapshot and reinstall.

@nhorvath
Copy link
Author

nhorvath commented Aug 29, 2018 via email

@mihalski
Copy link

mihalski commented Aug 29, 2018

I think there at LEAST 8 partitions, and I doubt the one we want to resize is last. Therefore it's a matter of resizing the extended, moving a lot of partitions and THEN resizing the one we want to enlarge.

@nhorvath
Copy link
Author

nhorvath commented Aug 29, 2018 via email

@nhorvath
Copy link
Author

nhorvath commented Aug 29, 2018 via email

@mihalski
Copy link

That MAY be something that's in the works as using a USB stick on the rpi for data is something that has been hinted at. Could translate just as easily to a virtual machine.

@nhorvath
Copy link
Author

nhorvath commented Aug 29, 2018 via email

@mihalski
Copy link

Or just base it on volume name.

@nhorvath
Copy link
Author

nhorvath commented Apr 1, 2019

I put this off because I didn't want to risk screwing up addons. I finally did it by resizing following these steps with no issues (instructions for virtualbox, but should translate to other vm hosts):

  1. Go to Hass.io System Tab in web interface and update Hass.io Host System (2.11 at this writing)
  2. After it comes back up, click shutdown.
  3. Resize the virtual disk
cd /opt/virtualbox/HassOS
vboxmanage clonemedium hassos_ova-1.9.vmdk hassos.vdi --format vdi
vboxmanage modifymedium hassos.vdi --resize 51200
vboxmanage clonemedium hassos.vdi hassos.vmdk --format vmdk

Note: change 51200 to some other number if you don't want a 50GB disk. Paths and original filename will vary with your setup.
4. In virtualbox change the hard disk from the original vmdk to the new one.
5. Download gparted live cd from here: https://gparted.org/download.php and mount the iso.
6. Turn on the VM and boot into the gparted live cd.
7. If/When asked at startup if you want to fix the GPT table to use the entire disk say "Fix".
8. Resize partition /dev/sda8 to fill the disk and click apply.
9. Reboot and verify you now see all the storage!
10. Clean up by deleting the old vmdk and intermediate vdi file.

I'd still like to keep this issue open as a feature request to be able to just add another VMDK that gets used as storage, or automatic resizing at boot by just expanding the size of the original VMDK.

@stratplayer
Copy link

@nhorvath thanks for the above, worked a treat. I had the same problem and followed this guide above to fix the issue :-)

@ryanupp
Copy link

ryanupp commented Apr 9, 2019

Thanks @nhorvath, this worked for me as well, expanded to 40gb without any problems.

For anyone else who ends up here I'm running Hass.io as a VM in ESXi 5.5, and in my case there was no need to go to the intermediate vdi format. I just cloned the vmdk, expanded it, then modified my VM's config to use the new disk and continued with the steps above using gparted.

SSH into ESXi
#cd into your VM's directory
cd /vmfs/volumes/datastore/hassio/
#clone existing vmdk
vmkfstools -i hassio.vmdk hassio_clone.vmdk
#resize cloned vmdk to 40GB
vmkfstools -X 40g hassio_clone.vmdk
#rename vmdk's if desired
vmkfstools -E "originalname.vmdk" "newname.vmdk"

@carloscae
Copy link

carloscae commented Apr 15, 2019

For anyone who's is struggling with step 5 and 6 of @nhorvath instructions above, on how to attach and boot Gparted:

  • After downloading the ISO, go to Virtual Media Manager and load it on the Optical Disk section.
  • Then attach into your Hassio VM in Settings/Storage under Sata Controller.
  • When you boot the Hassio VM it should boot the Partition Manager now.

There will be a couple of straight forward dialogs until you get to the GUI where is pretty simple to resize the partition mentioned above.

Maybe this might seem unnecessary explanation, but since it took me a while to figure out, maybe some people also have the same issue.

Thanks for the solution, @nhorvath :)

PS: Only thing I might add is that is not necessary to convert back and forth VDMK and VDI. If you're using Virtualbox, just use VDI. (I get that the issue here is about resizing VDMK).

@stale
Copy link

stale bot commented Jun 14, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jun 14, 2019
@stale stale bot closed this as completed Jun 21, 2019
@fluppie
Copy link

fluppie commented Mar 6, 2020

I think the default size should be at least 20-25 GB. New installation with some add-ons and I already have a full disk, which gives issues with the log files and unifi controller.

@zeljko-ciric
Copy link

I have same problem. Initial disk was 6GB. Increasing disk size in Hyper V and reboot system solve issue.

@pvizeli
Copy link
Member

pvizeli commented Mar 25, 2020

Yep, it resize only on reboot

@kbruurs
Copy link

kbruurs commented Oct 24, 2020

Thanks @nhorvath, this worked for me as well, expanded to 40gb without any problems.

For anyone else who ends up here I'm running Hass.io as a VM in ESXi 5.5, and in my case there was no need to go to the intermediate vdi format. I just cloned the vmdk, expanded it, then modified my VM's config to use the new disk and continued with the steps above using gparted.

SSH into ESXi
#cd into your VM's directory
cd /vmfs/volumes/datastore/hassio/
#clone existing vmdk
vmkfstools -i hassio.vmdk hassio_clone.vmdk
#resize cloned vmdk to 40GB
vmkfstools -X 40g hassio_clone.vmdk
#rename vmdk's if desired
vmkfstools -E "originalname.vmdk" "newname.vmdk"

I used this method using HassOS 4.14 and Home Assistant 0.116.4 and it worked well.

I didn't use gparted as I read that hassos should automatically use the max harddisk size and this worked for me (at least it reports my new harddrive size now, so I guess it works).

@loopy321
Copy link

loopy321 commented Oct 29, 2020

Thanks for documenting this!

You can also do step 3 with Virtualbox's "Virtual media manager" to first "clone" and then "increase" before resizing the partition with Gparted. Also, no need to change formats from VDI to VMDK (confirmed, I just did it this way). HOWEVER, make sure to start with the latest snapshot! Probably slightly easier for noobs :)

I put this off because I didn't want to risk screwing up addons. I finally did it by resizing following these steps with no issues (instructions for virtualbox, but should translate to other vm hosts):

  1. Go to Hass.io System Tab in web interface and update Hass.io Host System (2.11 at this writing)
  2. After it comes back up, click shutdown.
  3. Resize the virtual disk
cd /opt/virtualbox/HassOS
vboxmanage clonemedium hassos_ova-1.9.vmdk hassos.vdi --format vdi
vboxmanage modifymedium hassos.vdi --resize 51200
vboxmanage clonemedium hassos.vdi hassos.vmdk --format vmdk

Note: change 51200 to some other number if you don't want a 50GB disk. Paths and original filename will vary with your setup.
4. In virtualbox change the hard disk from the original vmdk to the new one.
5. Download gparted live cd from here: https://gparted.org/download.php and mount the iso.
6. Turn on the VM and boot into the gparted live cd.
7. If/When asked at startup if you want to fix the GPT table to use the entire disk say "Fix".
8. Resize partition /dev/sda8 to fill the disk and click apply.
9. Reboot and verify you now see all the storage!
10. Clean up by deleting the old vmdk and intermediate vdi file.

I'd still like to keep this issue open as a feature request to be able to just add another VMDK that gets used as storage, or automatic resizing at boot by just expanding the size of the original VMDK.

@Megachip
Copy link

Megachip commented Nov 25, 2020

I have same problem. Initial disk was 6GB. Increasing disk size in Hyper V and reboot system solve issue.

so not necessary anymore to go into the system? Just increase vmdk and reboot?

Getting the following message ATM
image
Not sure why 1.7 < 1 ^^

@ScottG489
Copy link

It seems like these solutions assume you have VBox GUI access. I'm running it on a headless server. So I don't believe the gparted solution will work for me.

Does anyone have any suggestions for how to do a resize purely via the command line?

@nhorvath
Copy link
Author

nhorvath commented Jan 14, 2022 via email

@ScottG489
Copy link

Another option seems to be that you can just create a new VM and attach the storage to that.

Using a new VM may not be an option for all, but the only issue I ran into was that the IP was different so I had to update my mqtt devices to point at the new IP (broker is installed via the add-on) and then change port forwarding on my router.

That ended up being much less work for me and more importantly may be automated and as a HA user I think we can all appreciate that :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
board/ova Open Virtual Appliance (Virtual Machine) wontfix
Projects
None yet
Development

No branches or pull requests