Vmware

ESXi Expand datastore from command line

Rescan all storage adapter for changes:
1 [root@esxihost:~] esxcli storage core adapter rescan –all

Determine the disk path:
1 [root@esxihost:~] vmkfstools -P /vmfs/volumes/datastore_0
2 VMFS-5.61 file system spanning 1 partitions.
3 File system label (if any): datastore_0
4 Mode: public
5 Capacity 6596801331200 (6291200 file blocks * 1048576), 217090883584 (207034 blocks) avail, max supported file size 69201586814976
6 UUID: 5ad58cdb-c8604cf3-e8fc-a0369f990590
7 Partitions spanned (on “lvm”):
8 naa.523545670e392ba2e81404da45912d543:1
9 Is Native Snapshot Capable: YES

Depending on the output of vmkfstools the Diskpath: is /vmfs/devices/disks/naa.523545670e392ba2e81404da45912d543, :1 means datastore_0 is the first partition on the disk.


Get the Disk layout:
1 [root@esxihost:~] partedUtil get /vmfs/devices/disks/naa.523545670e392ba2e81404da45912d543
2 1336746 255 63 21474836480
3 1 2048 12884901854 0 0

Start Sector of the first partition is 2048, current end sector is 12884901854 .

Determine the last usable end sector. If an error occured like this:
1 [root@esxihost:~] partedUtil getUsableSectors /vmfs/devices/disks/naa.523545670e392ba2e81404da45912d543
2 Error: The backup GPT table is not at the end of the disk, as it should be.  This might mean that another operating system believes the disk is smaller.  Fix, by moving the backup to the end (and removing the old backup)? This will also fix the last usable sector as per the new size.

then you have to correct the GPT partition table first:
1 [root@esxihost:~] partedUtil fixGpt /vmfs/devices/disks/naa.523545670e392ba2e81404da45912d543
2
3 FixGpt tries to fix any problems detected in GPT table.
4 Please ensure that you don’t run this on any RDM (Raw Device Mapping) disk.
5 Are you sure you want to continue (Y/N): y
6 gpt
7 1336746 255 63 21474836480
8 1 2048 12884901854 AA31E02A400F11DB9590000C2911D1B8 vmfs 0
And again. Determine the last usable sector:
1 [root@esxihost:~] partedUtil getUsableSectors /vmfs/devices/disks/naa.523545670e392ba2e81404da45912d543
2 34 21474836446

Last usable sector is 21474836446.
Expand the first partition. 2048 is the start sector and 21474836446 the

new end sector:
1 [root@esxihost:~] partedUtil resize /vmfs/devices/disks/naa.523545670e392ba2e81404da45912d5431 1 2048 21474836446

and also grow the filesystem:
1 [root@esxihost:~] vmkfstools –growfs /vmfs/devices/disks/naa.523545670e392ba2e81404da45912d543:1 /vmfs/devices/disks/naa.523545670e392ba2e81404da45912d543:1

rescan all volumes:
1 [root@esxihost:~] vmkfstools -V

Başa Dön