Article: KB-032

The next section illustrates how to use StorKit to save the SSD condition in your production software.

Sample software output:

Step 1: List all drives in the system

# ./coredelegate-sample -s
All drives:

0. /dev/nvme0n1 VSFCN8CI480G-1D1_SVN17066 Virtium Device: No
1. /dev/sda StorFly VSF202CC200G-JN2 Virtium Device: Yes
2. /dev/sdb StorFly VSFB25CC120G-150 Virtium Device: Yes
3. /dev/sdc StorFly VSFB25XC240G-160 Virtium Device: Yes

Step 2: Save the current state of a selected SSD to a text file. The file name includes the part id and serial number. Save you a lot of works.

# ./coredelegate-tester -k /dev/sdb
save current state for device: /dev/sdb to ‘StorFly VSFB25CC120G-150-P1T13004810301090002.txt’

This is done with a few lines of code as shown below.

static void saveCurrentState (const string &driveName){ // Scan device SKStorageDevice *storageDevice = SKStorageDeviceUtils::scanDevice(driveName); SKCCoreDelegate* coreDelegate = SKCCoreDelegateFactory::create(storageDevice); cout << “save current state for device: ” << driveName << endl; coreDelegate->saveCurrentState(); delete coreDelegate; }