Expand disk for FreeBSD in VMware ESXi

Expand disk for FreeBSD in VMware ESXi

This article assume you have a valid dump of the disk you want to expand, see http://www.wonkity.com/~wblock/docs/html/backup.html and that you cannot increase drive size in VMware due to snapshots.

Steps:

  • Add a drive
  • Restore an existing dump file
  • Update fstab to use new drive

Add new virtual disk

Shut down guest
#shutdown -h now

Add new disk in ESXi

Start host and verify it sees the new disk
#more /var/log/messages

Taken from https://www.freebsd.org/doc/handbook/disks-adding.html

The partition scheme is created, and then a single partition is added. To improve performance on newer disks with larger hardware block sizes, the partition is aligned to one megabyte boundaries:

# gpart create -s GPT da4
# gpart add -t freebsd-ufs -a 1M da4

Depending on use, several smaller partitions may be desired. See gpart(8) for options to create partitions smaller than a whole disk.

The disk partition information can be viewed with gpart show:

% gpart show da4
=>        34  1465146988  da4  GPT  (699G)
          34        2014        - free -  (1.0M)
        2048  1465143296     1  freebsd-ufs  (699G)
  1465145344        1678        - free -  (839K)

A file system is created in the new partition on the new disk:

# newfs -U /dev/da4p1

An empty directory is created as a mountpoint, a location for mounting the new disk in the original disk’s file system:

# mkdir /usr_new

Finally, an entry is added to /etc/fstab so the new disk will be mounted automatically at startup:

/dev/da4p1	/usr_new	ufs	rw	2	2

The new disk can be mounted manually, without restarting the system:

# mount /usr_new

Restore from dump file

# cd /usr_new
# restore -ruf /mnt/usr.dump

Final steps

Boot into single-mode
#shutdown -r now

Mount file systems
#mount -a

Update fstab with new drive
#/usr/local/bin/vim /etc/fstab

Reboot

Leave a Reply

Your email address will not be published. Required fields are marked *