1b6cee71dSXin LI#------------------------------------------------------------------------------ 2b6cee71dSXin LI# zfs: file(1) magic for ZFS dumps 3b6cee71dSXin LI# 4b6cee71dSXin LI# From <rea-fbsd@codelabs.ru> 5b6cee71dSXin LI# ZFS dump header has the following structure (as per zfs_ioctl.h 6b6cee71dSXin LI# in FreeBSD with drr_type is set to DRR_BEGIN) 7b6cee71dSXin LI# 8b6cee71dSXin LI# enum { 9b6cee71dSXin LI# DRR_BEGIN, DRR_OBJECT, DRR_FREEOBJECTS, 10b6cee71dSXin LI# DRR_WRITE, DRR_FREE, DRR_END, 11b6cee71dSXin LI# } drr_type; 12b6cee71dSXin LI# uint32_t drr_pad; 13b6cee71dSXin LI# uint64_t drr_magic; 14b6cee71dSXin LI# uint64_t drr_version; 15b6cee71dSXin LI# uint64_t drr_creation_time; 16b6cee71dSXin LI# dmu_objset_type_t drr_type; 17b6cee71dSXin LI# uint32_t drr_pad; 18b6cee71dSXin LI# uint64_t drr_toguid; 19b6cee71dSXin LI# uint64_t drr_fromguid; 20b6cee71dSXin LI# char drr_toname[MAXNAMELEN]; 21b6cee71dSXin LI# 22b6cee71dSXin LI# Backup magic is 0x00000002f5bacbac (quad word) 23b6cee71dSXin LI# The drr_type is defined as 24b6cee71dSXin LI# typedef enum dmu_objset_type { 25b6cee71dSXin LI# DMU_OST_NONE, 26b6cee71dSXin LI# DMU_OST_META, 27b6cee71dSXin LI# DMU_OST_ZFS, 28b6cee71dSXin LI# DMU_OST_ZVOL, 29b6cee71dSXin LI# DMU_OST_OTHER, /* For testing only! */ 30b6cee71dSXin LI# DMU_OST_ANY, /* Be careful! */ 31b6cee71dSXin LI# DMU_OST_NUMTYPES 32b6cee71dSXin LI# } dmu_objset_type_t; 33b6cee71dSXin LI# 34b6cee71dSXin LI# Almost all uint64_t fields are printed as the 32-bit ones (with high 35b6cee71dSXin LI# 32 bits zeroed), because there is no simple way to print them as the 36b6cee71dSXin LI# full 64-bit values. 37b6cee71dSXin LI 38b6cee71dSXin LI# Big-endian values 39*43a5ec4eSXin LI8 string \000\000\000\002\365\272\313\254 ZFS snapshot (big-endian machine), 40b6cee71dSXin LI>20 belong x version %u, 41b6cee71dSXin LI>32 belong 0 type: NONE, 42b6cee71dSXin LI>32 belong 1 type: META, 43b6cee71dSXin LI>32 belong 2 type: ZFS, 44b6cee71dSXin LI>32 belong 3 type: ZVOL, 45b6cee71dSXin LI>32 belong 4 type: OTHER, 46b6cee71dSXin LI>32 belong 5 type: ANY, 47b6cee71dSXin LI>32 belong >5 type: UNKNOWN (%u), 48b6cee71dSXin LI>40 byte x destination GUID: %02X 49b6cee71dSXin LI>41 byte x %02X 50b6cee71dSXin LI>42 byte x %02X 51b6cee71dSXin LI>43 byte x %02X 52b6cee71dSXin LI>44 byte x %02X 53b6cee71dSXin LI>45 byte x %02X 54b6cee71dSXin LI>46 byte x %02X 55b6cee71dSXin LI>47 byte x %02X, 56b6cee71dSXin LI>48 ulong >0 57b6cee71dSXin LI>>52 ulong >0 58b6cee71dSXin LI>>>48 byte x source GUID: %02X 59b6cee71dSXin LI>>>49 byte x %02X 60b6cee71dSXin LI>>>50 byte x %02X 61b6cee71dSXin LI>>>51 byte x %02X 62b6cee71dSXin LI>>>52 byte x %02X 63b6cee71dSXin LI>>>53 byte x %02X 64b6cee71dSXin LI>>>54 byte x %02X 65b6cee71dSXin LI>>>55 byte x %02X, 66b6cee71dSXin LI>56 string >\0 name: '%s' 67b6cee71dSXin LI 68b6cee71dSXin LI# Little-endian values 69*43a5ec4eSXin LI8 string \254\313\272\365\002\000\000\000 ZFS snapshot (little-endian machine), 70b6cee71dSXin LI>16 lelong x version %u, 71b6cee71dSXin LI>32 lelong 0 type: NONE, 72b6cee71dSXin LI>32 lelong 1 type: META, 73b6cee71dSXin LI>32 lelong 2 type: ZFS, 74b6cee71dSXin LI>32 lelong 3 type: ZVOL, 75b6cee71dSXin LI>32 lelong 4 type: OTHER, 76b6cee71dSXin LI>32 lelong 5 type: ANY, 77b6cee71dSXin LI>32 lelong >5 type: UNKNOWN (%u), 78b6cee71dSXin LI>47 byte x destination GUID: %02X 79b6cee71dSXin LI>46 byte x %02X 80b6cee71dSXin LI>45 byte x %02X 81b6cee71dSXin LI>44 byte x %02X 82b6cee71dSXin LI>43 byte x %02X 83b6cee71dSXin LI>42 byte x %02X 84b6cee71dSXin LI>41 byte x %02X 85b6cee71dSXin LI>40 byte x %02X, 86b6cee71dSXin LI>48 ulong >0 87b6cee71dSXin LI>>52 ulong >0 88b6cee71dSXin LI>>>55 byte x source GUID: %02X 89b6cee71dSXin LI>>>54 byte x %02X 90b6cee71dSXin LI>>>53 byte x %02X 91b6cee71dSXin LI>>>52 byte x %02X 92b6cee71dSXin LI>>>51 byte x %02X 93b6cee71dSXin LI>>>50 byte x %02X 94b6cee71dSXin LI>>>49 byte x %02X 95b6cee71dSXin LI>>>48 byte x %02X, 96b6cee71dSXin LI>56 string >\0 name: '%s' 97