3 CRYPTSETUP="../src/cryptsetup"
8 DEV=/dev/$(grep scsi_debug /sys/block/*/device/model | cut -f4 -d /)
10 [ -b $DEV ] || exit 100
15 rmmod scsi_debug 2>/dev/null
19 format() # key_bits expected [forced]
22 echo -n "Formatting using topology info ($1 bits key)...."
23 echo xxx| $CRYPTSETUP luksFormat $DEV -q -s $1
25 echo -n "Formatting using forced offset $3 ($1 bits key)..."
26 echo xxx| $CRYPTSETUP luksFormat $DEV -q -s $1 --align-payload=$2
29 ALIGN=$($CRYPTSETUP luksDump $DEV |grep "Payload offset" | sed -e s/.*\\t//)
30 #echo "ALIGN = $ALIGN"
32 if [ $ALIGN -ne $2 ] ; then
34 echo "Expected alignment differs: expected $2 != detected $ALIGN"
40 modprobe --dry-run scsi_debug || exit 0
43 echo "# Create desktop-class 4K drive"
44 echo "# (logical_block_size=512, physical_block_size=4096, alignment_offset=0)"
45 add_device dev_size_mb=16 sector_size=512 physblk_exp=3 num_tgts=1
52 echo "# Create desktop-class 4K drive w/ 63-sector DOS partition compensation"
53 echo "# (logical_block_size=512, physical_block_size=4096, alignment_offset=3584)"
54 add_device dev_size_mb=16 sector_size=512 physblk_exp=3 lowest_aligned=7 num_tgts=1
59 echo "# Create enterprise-class 4K drive"
60 echo "# (logical_block_size=4096, physical_block_size=4096, alignment_offset=0)"
61 add_device dev_size_mb=16 sector_size=4096 num_tgts=1
66 echo "# Create classic 512b drive and stack dm-linear"
67 echo "# (logical_block_size=512, physical_block_size=512, alignment_offset=0)"
68 add_device dev_size_mb=16 sector_size=512 num_tgts=1
70 DEV=/dev/mapper/luks0xbabe
71 dmsetup create luks0xbabe --table "0 32768 linear $DEV2 0"
75 dmsetup remove luks0xbabe