I have been using a guest hookscript for a few years that runs fsck on disks on the pre-start hook. It does this because the VM I am running uses a kernel boot file and so there is no opportunity to check the disk from within it.
Anyway, the script ran but didn't find the disks.
Long story short it was looking it was looking in /dev/rpool/data/vm-$vmid-* and they are now in /dev/zvol/rpool/data/vm-$vmid-* but nobody told me and I don't know how or why they moved.
I can just update my script, however, I don't like this hard coding nonsense so I want to know how I can get the disk paths from within that perl script. Also its beyond me as to how or why they would move so I thought maybe someone in this forum would know?
Anyway, the script ran but didn't find the disks.
Long story short it was looking it was looking in /dev/rpool/data/vm-$vmid-* and they are now in /dev/zvol/rpool/data/vm-$vmid-* but nobody told me and I don't know how or why they moved.
I can just update my script, however, I don't like this hard coding nonsense so I want to know how I can get the disk paths from within that perl script. Also its beyond me as to how or why they would move so I thought maybe someone in this forum would know?
Perl:
# First phase 'pre-start' will be executed before the guest
# is started. Exiting with a code != 0 will abort the start
print "$vmid is starting, doing preparations.\n";
# Loop through the disks
for my $disk (glob("/dev/rpool/data/vm-$vmid-*")) {
# Check if the disk is a swap partition
my $blkid_output = `blkid $disk`;
if ($blkid_output =~ /TYPE="swap"/) {
print "\nSkipping swap partition $disk.\n";
next;
}
print "\nRunning e2fsck on $disk...\n";
system("e2fsck -y $disk");
}
# print "preparations failed, aborting."
# exit(1);