→ Applies to: SynetoOS 4.x
Ensure the following parameters are verified before starting the process:
– The datastore must have at least one snapshot without errors before the first faulted snapshot
– You must run a new protection before launching the procedure
– The vm config is taken from the last available snapshot
Step 1. Connect to SynetoOS appliance via SSH as admin
ssh admin@<your_ip_address_or_hostname>
Step 2. Become Super User
sudo su
Step 3. Retrieve a list of all datastore
zfs list
EXAMPLE
NAME USED AVAIL REFER MOUNTPOINT flash 24.2G 13.6G 27.5K /flash flash/datastores 24.1G 13.6G 51.5K /flash/datastores flash/datastores/ISO 6.31G 13.6G 6.31G /flash/datastores/ISO flash/datastores/TestWin16 17.8G 13.6G 12.6G /flash/datastores/TestWin16 flash/shares 48K 13.6G 24K /flash/shares flash/shares/smb 24K 13.6G 24K /flash/shares/smb hybrid 11.2M 18.9G 26K /hybrid hybrid/backups/ 194K 18.9G 24K /hybrid/backups hybrid/backups/LinuxVM 194K 18.9G 24K /hybrid/backups/LinuxVM
Step 4. Identify the datastore with the error (datastores can be found in the path /<pool_name>/datastores/)
EXAMPLE
<pool_name>/datastores/TestWin16
Step 6. Create a new PHP file called “fixSnapshotMetaVms.php”
vi fixSnapshotMetaVms.php
Step 7. Copy and paste the following text into the newly created PHP file
#!/usr/bin/php -q<?phpuse Dataset\Snapshot\SnapshotRepository;use Dataset\SynetoMeta\SynetoMetaIO;use Dataset\SynetoMeta\SynetoMetaIOBuilder;require_once 'Lego/autoload.php';$datasetId = $argv[1] ?? null;if (!$datasetId) { echo "No dataset id provided!\n"; exit(1);}$day = $argv[2] ?? null;if (!$day) { echo "No date provided!\n"; exit(1);}$repo = new SnapshotRepository();$snapshots = $repo->getForDataset($datasetId);if (!$snapshots) { echo "Could not find snapshots for the dataset!\n"; exit(1);}$lastSnap = $snapshots[array_key_last($snapshots)];$vmConfig = $lastSnap->getVirtualMachinesAsList();var_dump($vmConfig);$metaIoBuilder = new SynetoMetaIOBuilder();foreach ($snapshots as $snap) { if ($snap->getCreationDate()->format('Y-m-d') != $day) { continue; } if ($snap->getVirtualMachinesAsList()) { continue; } var_dump($snap->getPath()); $metaIO = $metaIoBuilder->make($snap->getPath()); $metaIO->patch([["op" => "replace", "path" => "/protectedVirtualMachines", "value" => $vmConfig]]);}
Step 8. Run the newly created script (replace <dataset_path> with the path at step 4 and <date:Y-m-d> with the date of the snapshot with the error)
php fixSnapshotMetaVMs.php <dataset_path> <date:Y-m-d>