How To Add A USB Disk As VMFS Datastore In ESXi 6.7
After some time using VMWare Workstation as a playground for my VM home lab environment, and after learning and testing with VM ESXi Hosts, I decided that is time to move to a hardware lab.
So I achieved, for the start, 2 servers for the ESXi hosts, and because there is no HDD on the servers, I have installed the ESXi software on an USB Stick. For the storage I would like to use a dedicated shared server, but I am still looking what server and drives should I get. I need more time to check and see what would be the best solution for me.
But in the same time, I am not having enough patience to wait till I build my storage server, I would like to start testing the ESXi hosts right away. I know that this is a compromise solution, but I thought to attach a USB Disk as VMFS Datastore.
So in today’s post I would like to show you how can we add and configure a USB Disk as VMFS Datastore.
Note
Please note that in the ESXi 6.7 version, USB devices larger than 2TB are not supported.
Step One – Enable SSH Access To ESXi Host
Connect to ESXi IP address, go to Actions and then select Services and Enable Secure Shell (SSH).
Step Two – Connect To ESXi Host Using SSH
With your preferred SSH client, mine is Putty, start a connection to the ESXi host.
Step Three – Stop USB Arbitrator
You have to stop USB Arbitrator Service. The service is used to passthrough the USB devices from hosts to a virtual machine. Once stopped, you will not be able anymore to passthrough USB devices to VMs.
# /etc/init.d/usbarbitrator stop
To maintain the stopped status of the service after reboot, insert the command:
# chkconfig usbarbitrator off
Step Four – Plug In The USB Device To The ESXi Host And Get The Device Identifier
Connect USB device to the ESXi host. Then get the device identifier by issuing the following command in Putty:
# ls /dev/disks/
First USB device is the stick which is booting the ESXi software, so the second device is the USB Disk that we’d like to use for the datastore – mpx.vmhba33:C0:T0:L0
Step Five – Write A Label To The Device
Write a gpt label to the USB device using its ID
# partedUtil mklabel /dev/disks/<deviceID> gpt
Step Six – Create Partition
In order to create the partition, we need to have a few info:
1. The start sector: 2048
2. The GUID for VMFS: AA31E02A400F11DB9590000C2911D1B8
3. The end sector. This one should be calculated.
To calculate the end sector, we’ll issue the following command first:
# partedUtil getptbl /dev/disks/<deviceID>
Use this formula to get the end Sector:
243201 * 255 * 63 – 1 = 3907024064
Or you can use this formula:
# eval expr $(partedUtil getptbl /dev/disks/<deviceID> | tail -1 | awk '{print $1 " \\* " $2 " \\* " $3}') - 1
Now we have all the info and we can create the partition using the command:
# partedUtil setptbl /dev/disks/<deviceID> gpt "1 2048 <endSector> AA31E02A400F11DB9590000C2911D1B8 0"
Step Seven – Format Partition With VMFS6
We’ll format the partition now with VMFS6. Please be aware that we have “:1” after the deviceID.
# vmkfstools -C vmfs6 -S USB-Storage /dev/disks/<deviceID>:1
Step Eight – Check Datastore In ESXi
Return to ESXi and check the Storage tab. You should see here the new Datastore.
We have managed to add the USB-Disk as VMFS Datstore and we can now deploy VMs on it. I will proceed with the installation of vCenter Appliance.
=======================================
dbsa@dbsa-X406UA:~$ ssh root@172.17.44.4
(root@172.17.44.4) Password:
The time and date of this login have been sent to the system logs.
VMware offers supported, powerful system administration tools. Please
see www.vmware.com/go/sysadmintools for details.
The ESXi Shell can be disabled by an administrative user. See the
vSphere Security documentation for more information.
[root@localhost:~] history
-sh: history: not found
[root@localhost:~] ls -lah /dev/disks/
total 4289446432
drwxr-xr-x 2 root root 512 Jul 7 11:04 .
drwxr-xr-x 15 root root 512 Jul 7 11:04 ..
-rw------- 1 root root 931.5G Jul 7 11:04 mpx.vmhba46:C0:T0:L0
-rw------- 1 root root 931.5G Jul 7 11:04 mpx.vmhba46:C0:T0:L0:1
-rw------- 1 root root 1.1T Jul 7 11:04 naa.600605b00d4fd2702271c2293181efce
-rw------- 1 root root 4.0M Jul 7 11:04 naa.600605b00d4fd2702271c2293181efce:1
-rw------- 1 root root 4.0G Jul 7 11:04 naa.600605b00d4fd2702271c2293181efce:2
-rw------- 1 root root 1.1T Jul 7 11:04 naa.600605b00d4fd2702271c2293181efce:3
-rw------- 1 root root 250.0M Jul 7 11:04 naa.600605b00d4fd2702271c2293181efce:5
-rw------- 1 root root 250.0M Jul 7 11:04 naa.600605b00d4fd2702271c2293181efce:6
-rw------- 1 root root 110.0M Jul 7 11:04 naa.600605b00d4fd2702271c2293181efce:7
-rw------- 1 root root 286.0M Jul 7 11:04 naa.600605b00d4fd2702271c2293181efce:8
-rw------- 1 root root 2.5G Jul 7 11:04 naa.600605b00d4fd2702271c2293181efce:9
lrwxrwxrwx 1 root root 20 Jul 7 11:04 vml.0000000000766d68626134363a303a30 -> mpx.vmhba46:C0:T0:L0
lrwxrwxrwx 1 root root 22 Jul 7 11:04 vml.0000000000766d68626134363a303a30:1 -> mpx.vmhba46:C0:T0:L0:1
lrwxrwxrwx 1 root root 36 Jul 7 11:04 vml.0200000000600605b00d4fd2702271c2293181efce524149442035 -> naa.600605b00d4fd2702271c2293181efce
lrwxrwxrwx 1 root root 38 Jul 7 11:04 vml.0200000000600605b00d4fd2702271c2293181efce524149442035:1 -> naa.600605b00d4fd2702271c2293181efce:1
lrwxrwxrwx 1 root root 38 Jul 7 11:04 vml.0200000000600605b00d4fd2702271c2293181efce524149442035:2 -> naa.600605b00d4fd2702271c2293181efce:2
lrwxrwxrwx 1 root root 38 Jul 7 11:04 vml.0200000000600605b00d4fd2702271c2293181efce524149442035:3 -> naa.600605b00d4fd2702271c2293181efce:3
lrwxrwxrwx 1 root root 38 Jul 7 11:04 vml.0200000000600605b00d4fd2702271c2293181efce524149442035:5 -> naa.600605b00d4fd2702271c2293181efce:5
lrwxrwxrwx 1 root root 38 Jul 7 11:04 vml.0200000000600605b00d4fd2702271c2293181efce524149442035:6 -> naa.600605b00d4fd2702271c2293181efce:6
lrwxrwxrwx 1 root root 38 Jul 7 11:04 vml.0200000000600605b00d4fd2702271c2293181efce524149442035:7 -> naa.600605b00d4fd2702271c2293181efce:7
lrwxrwxrwx 1 root root 38 Jul 7 11:04 vml.0200000000600605b00d4fd2702271c2293181efce524149442035:8 -> naa.600605b00d4fd2702271c2293181efce:8
lrwxrwxrwx 1 root root 38 Jul 7 11:04 vml.0200000000600605b00d4fd2702271c2293181efce524149442035:9 -> naa.600605b00d4fd2702271c2293181efce:9
[root@localhost:~] partedUtil mklabel /dev/disks/mpx.vmhba46:C0:T0:L0 gpt
[root@localhost:~] partedUtil getptbl /dev/disks/mpx.vmhba46:C0:T0:L0
gpt
121601 255 63 1953525168
[root@localhost:~] eval expr $(partedUtil getptbl /dev/disks/mpx.vmhba46:C0:T0:L0 | tail -1 | awk '{print $1 " \\* " $2 " \\* " $3}') - 1
1953520064
[root@localhost:~] partedUtil setptbl /dev/disks/mpx.vmhba46:C0:T0:L0 gpt "1 2048 1953520064 AA31E02A400F11DB9590000C2911D1B8 0"
gpt
0 0 0 0
1 2048 1953520064 AA31E02A400F11DB9590000C2911D1B8 0
[root@localhost:~] vmkfstools -C vmfs5 -S USB-Storage /dev/disks/mpx.vmhba46:C0:T0:L0:1
create fs deviceName:'/dev/disks/mpx.vmhba46:C0:T0:L0:1', fsShortName:'vmfs5', fsName:'USB-Storage'
deviceFullPath:/dev/disks/mpx.vmhba46:C0:T0:L0:1 deviceFile:mpx.vmhba46:C0:T0:L0:1
ATS on device /dev/disks/mpx.vmhba46:C0:T0:L0:1: not supported
.
Checking if remote hosts are using this device as a valid file system. This may take a few seconds...
Creating vmfs5 file system on "mpx.vmhba46:C0:T0:L0:1" with blockSize 1048576 and volume label "USB-Storage".
Successfully created new volume: 64a7f464-50498de0-ac0b-fc4596f2e384
[root@localhost:~]
Tidak ada komentar:
Posting Komentar