NE-ONE: How to Increase the Disk Size for NE-ONE on VMware
1 Purpose
We may often start on VMware systems with a relatively small hard disk and later decide that we need more space. This procedure outlines increasing the space.
2 Summary Steps
Make sure that you have flattened all the VMware snapshots if any. The procedure for this is outside the scope of this document
Increase the Disk size in VMware settings to the required size
Increase the partition size with fdisk
Increase the file system size with resize2fs
A similar procedure would apply to decreasing the disk size except steps 2-4 would be in the opposite order (and increase would become decrease)
3 Process Details
3.1 Make sure that you have flattened all the VMware snapshots if any.
You can check if there are any snapshots by using the vCenter/vSphere GUI and looking at Manage Snapshots. If there is only one - the initial disk you can proceed, otherwise you’ll need to flatten the snapshots.
The procedure for this is outsize the scope of this document - please see the VMware documentation for your version.
NOTE
If the option to increase the Disk Size in VMware settings is greyed out, then generally this is due to the flattening of the snapshots not being completely correct.
3.2 Increase the Disk size in VMware settings to the required size
Use the vSphere or vCenter GUIs to increase the size of the virtual disk, but note that this will have no effect on the actual available space for the INE/NE-ONE until the next two steps are completed.
3.3 Increase the partition size with fdisk
Login to the INE/NE-ONE console or via ssh (PuTTY) and exit the menu.
The normal disk for an INE/NE-ONE is sda, but you can check with df -h:
$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 3.9G 0 3.9G 0% /dev
tmpfs 798M 19M 780M 3% /run
/dev/sda1 99G 15G 80G 16% /
tmpfs 3.9G 8.0K 3.9G 1% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
tmpfs 798M 0 798M 0% /run/user/1000
Now we can repartition /dev/sda. Bear in mind that fdisk does nothing until you use the command w (write), so you can abandon at any time.
See the inline comments below written in [bold italic]. These should not be typed in.
NOTE fdisk is a powerful command, be careful to get the commands right and do not write the changes with w unless you are sure.
$ sudo fdisk /dev/sda
Welcome to fdisk (util-linux 2.31.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p [show partitions]
Disk /dev/sda: 100 GiB, 107374182400 bytes, 209715200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x16bb7b57
Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 209715199 209713152 100G 83 Linux
Command (m for help): d [delete partition - there is only one]
Selected partition 1
Partition 1 has been deleted.
Command (m for help): n [new partition]
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p [primary partition]
Partition number (1-4, default 1): 1 [we want sda1]
First sector (2048-209715199, default 2048): [take the default-2048]
Last sector, +sectors or +size{K,M,G,T,P} (2048-209715199, default 209715199): [take the default- the entire drive]
Created a new partition 1 of type 'Linux' and of size 100 GiB.
Partition #1 contains a ext4 signature.
Do you want to remove the signature? [Y]es/[N]o: n [n is vital!]
Command (m for help): w [write the new partitions to disk]
The new partition layout is now written to disk.
At this point the kernel is still working on the old layout so reboot the INE/NE-ONE VM
$ sudo reboot
3.4 Increase the file system size with resize2fs
This turns out to be the simplest of the steps and can be accomplished even with the INE/NE-ONE running - no reboots required.
A quick df -h shows us the file system size before we start:
$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 3.9G 0 3.9G 0% /dev
tmpfs 798M 19M 780M 3% /run
/dev/sda1 99G 15G 80G 16% /
tmpfs 3.9G 8.0K 3.9G 1% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
tmpfs 798M 0 798M 0% /run/user/1000
$ sudo resize2fs /dev/sda1
resize2fs 1.44.1 (24-Mar-2018)
The filesystem is already 26214144 (4k) blocks long. Nothing to do!
You don’t need any options - it automatically resizes the file system to fit the partition
In this example the resizing was already complete, hence the nothing to do message