108ff44c4SLionel Sambuc#------------------------------------------------------------------------------ 208ff44c4SLionel Sambuc# zfs: file(1) magic for ZFS dumps 308ff44c4SLionel Sambuc# 408ff44c4SLionel Sambuc# From <rea-fbsd@codelabs.ru> 508ff44c4SLionel Sambuc# ZFS dump header has the following structure (as per zfs_ioctl.h 608ff44c4SLionel Sambuc# in FreeBSD with drr_type is set to DRR_BEGIN) 708ff44c4SLionel Sambuc# 808ff44c4SLionel Sambuc# enum { 908ff44c4SLionel Sambuc# DRR_BEGIN, DRR_OBJECT, DRR_FREEOBJECTS, 1008ff44c4SLionel Sambuc# DRR_WRITE, DRR_FREE, DRR_END, 1108ff44c4SLionel Sambuc# } drr_type; 1208ff44c4SLionel Sambuc# uint32_t drr_pad; 1308ff44c4SLionel Sambuc# uint64_t drr_magic; 1408ff44c4SLionel Sambuc# uint64_t drr_version; 1508ff44c4SLionel Sambuc# uint64_t drr_creation_time; 1608ff44c4SLionel Sambuc# dmu_objset_type_t drr_type; 1708ff44c4SLionel Sambuc# uint32_t drr_pad; 1808ff44c4SLionel Sambuc# uint64_t drr_toguid; 1908ff44c4SLionel Sambuc# uint64_t drr_fromguid; 2008ff44c4SLionel Sambuc# char drr_toname[MAXNAMELEN]; 2108ff44c4SLionel Sambuc# 2208ff44c4SLionel Sambuc# Backup magic is 0x00000002f5bacbac (quad word) 2308ff44c4SLionel Sambuc# The drr_type is defined as 2408ff44c4SLionel Sambuc# typedef enum dmu_objset_type { 2508ff44c4SLionel Sambuc# DMU_OST_NONE, 2608ff44c4SLionel Sambuc# DMU_OST_META, 2708ff44c4SLionel Sambuc# DMU_OST_ZFS, 2808ff44c4SLionel Sambuc# DMU_OST_ZVOL, 2908ff44c4SLionel Sambuc# DMU_OST_OTHER, /* For testing only! */ 3008ff44c4SLionel Sambuc# DMU_OST_ANY, /* Be careful! */ 3108ff44c4SLionel Sambuc# DMU_OST_NUMTYPES 3208ff44c4SLionel Sambuc# } dmu_objset_type_t; 3308ff44c4SLionel Sambuc# 3408ff44c4SLionel Sambuc# Almost all uint64_t fields are printed as the 32-bit ones (with high 3508ff44c4SLionel Sambuc# 32 bits zeroed), because there is no simple way to print them as the 3608ff44c4SLionel Sambuc# full 64-bit values. 3708ff44c4SLionel Sambuc 3808ff44c4SLionel Sambuc# Big-endian values 3908ff44c4SLionel Sambuc8 string \000\000\000\002\365\272\313\254 ZFS shapshot (big-endian machine), 40*0a6a1f1dSLionel Sambuc>20 belong x version %u, 4108ff44c4SLionel Sambuc>32 belong 0 type: NONE, 4208ff44c4SLionel Sambuc>32 belong 1 type: META, 4308ff44c4SLionel Sambuc>32 belong 2 type: ZFS, 4408ff44c4SLionel Sambuc>32 belong 3 type: ZVOL, 4508ff44c4SLionel Sambuc>32 belong 4 type: OTHER, 4608ff44c4SLionel Sambuc>32 belong 5 type: ANY, 47*0a6a1f1dSLionel Sambuc>32 belong >5 type: UNKNOWN (%u), 4808ff44c4SLionel Sambuc>40 byte x destination GUID: %02X 4908ff44c4SLionel Sambuc>41 byte x %02X 5008ff44c4SLionel Sambuc>42 byte x %02X 5108ff44c4SLionel Sambuc>43 byte x %02X 5208ff44c4SLionel Sambuc>44 byte x %02X 5308ff44c4SLionel Sambuc>45 byte x %02X 5408ff44c4SLionel Sambuc>46 byte x %02X 5508ff44c4SLionel Sambuc>47 byte x %02X, 5608ff44c4SLionel Sambuc>48 ulong >0 5708ff44c4SLionel Sambuc>>52 ulong >0 5808ff44c4SLionel Sambuc>>>48 byte x source GUID: %02X 5908ff44c4SLionel Sambuc>>>49 byte x %02X 6008ff44c4SLionel Sambuc>>>50 byte x %02X 6108ff44c4SLionel Sambuc>>>51 byte x %02X 6208ff44c4SLionel Sambuc>>>52 byte x %02X 6308ff44c4SLionel Sambuc>>>53 byte x %02X 6408ff44c4SLionel Sambuc>>>54 byte x %02X 6508ff44c4SLionel Sambuc>>>55 byte x %02X, 6608ff44c4SLionel Sambuc>56 string >\0 name: '%s' 6708ff44c4SLionel Sambuc 6808ff44c4SLionel Sambuc# Little-endian values 6908ff44c4SLionel Sambuc8 string \254\313\272\365\002\000\000\000 ZFS shapshot (little-endian machine), 70*0a6a1f1dSLionel Sambuc>16 lelong x version %u, 7108ff44c4SLionel Sambuc>32 lelong 0 type: NONE, 7208ff44c4SLionel Sambuc>32 lelong 1 type: META, 7308ff44c4SLionel Sambuc>32 lelong 2 type: ZFS, 7408ff44c4SLionel Sambuc>32 lelong 3 type: ZVOL, 7508ff44c4SLionel Sambuc>32 lelong 4 type: OTHER, 7608ff44c4SLionel Sambuc>32 lelong 5 type: ANY, 77*0a6a1f1dSLionel Sambuc>32 lelong >5 type: UNKNOWN (%u), 7808ff44c4SLionel Sambuc>47 byte x destination GUID: %02X 7908ff44c4SLionel Sambuc>46 byte x %02X 8008ff44c4SLionel Sambuc>45 byte x %02X 8108ff44c4SLionel Sambuc>44 byte x %02X 8208ff44c4SLionel Sambuc>43 byte x %02X 8308ff44c4SLionel Sambuc>42 byte x %02X 8408ff44c4SLionel Sambuc>41 byte x %02X 8508ff44c4SLionel Sambuc>40 byte x %02X, 8608ff44c4SLionel Sambuc>48 ulong >0 8708ff44c4SLionel Sambuc>>52 ulong >0 8808ff44c4SLionel Sambuc>>>55 byte x source GUID: %02X 8908ff44c4SLionel Sambuc>>>54 byte x %02X 9008ff44c4SLionel Sambuc>>>53 byte x %02X 9108ff44c4SLionel Sambuc>>>52 byte x %02X 9208ff44c4SLionel Sambuc>>>51 byte x %02X 9308ff44c4SLionel Sambuc>>>50 byte x %02X 9408ff44c4SLionel Sambuc>>>49 byte x %02X 9508ff44c4SLionel Sambuc>>>48 byte x %02X, 9608ff44c4SLionel Sambuc>56 string >\0 name: '%s' 97