Backup a ZVol used as iSCSI extent

Status
Not open for further replies.

nephri

Dabbler
Joined
Sep 20, 2015
Messages
40
Hi,

I use a zvol to export an iScsi Disk to my PC (NTFS filesystem)

I know that i can't take a snapshot of the zvol any time since ZFS didn't know any state of the underlying filesystem and snapshots may be inconsistents.

So, i want to do a script that perform this:

- check if the extent is "online" (that mean the PC is connected to the iscsi target throw the portal)
- if yes : store somewhere the target was used at least once from the last snapshot
- if not and if the target was used at least once from the last snapshot, i do a snapshot of the zvol, store now that the target was not used from the last snapshot and ending by exporting/destroying the snapshot.

I want to execute this script every minutes that allow me to save my disk each time i will shutdown my computer (without to boring when it will be and how many often it can occur).

So my question is
- How to poll the state of an iscsi target from a os-shell (ie connected or not) ?

Best regards,
Sébastien.
 

nephri

Dabbler
Joined
Sep 20, 2015
Messages
40
It works fine for seeing if the target is connected or not.
So, do i need to force a flush or something like it to be sure the iscsi service has flushed all data inside the volume ?

i saw a synccache but i didn't understand what it's really do

I tried a things like it:

ctladm devlist
LUN Backend Size (Blocks) BS Serial Number Device ID
0 block 2147483648 512 0cc47a320ec800 iSCSI Disk 0cc47a320ec800

and a

ctladm synccache 0cc47a320ec800

i had a
(7:0:0/0): SYNCHRONIZE CACHE(10). CDB: 35 00 00 00 00 00 00 00 00 00 Tag: 0x2/1
(7:0:0/0): CTL Status: SCSI Error
(7:0:0/0): SCSI Status: Check Condition
(7:0:0/0): SCSI sense: UNIT ATTENTION asc:29,1 (Power on occurred)

When i tried a new time (any any further time) i had
Cache synchronized successfully
 

mav@

iXsystems
iXsystems
Joined
Sep 29, 2011
Messages
1,428
iSCSI target does not have own write caching, it is all done by ZFS, which provides consistency for all possible data accesses scenarios. The only case when you may want to explicitly synchronize caches is when you've just written some critical data, don't have "sync" property set to "always" on ZVOL, and want to be sure that all the written data are persistent in case of power failure or system panic.
 
Status
Not open for further replies.
Top