"module and the ${LSSCSI} utility"
fi
-zconfig_partition() {
- local DEVICE=$1
- local START=$2
- local END=$3
- local TMP_FILE=`mktemp`
-
- /sbin/sfdisk -q ${DEVICE} << EOF &>${TMP_FILE} || fail 4
-${START},${END}
-;
-;
-;
-EOF
-
- rm ${TMP_FILE}
- udev_trigger
-}
-
# Validate persistent zpool.cache configuration.
test_1() {
local POOL_NAME=test1
${ZFS_SH} zfs="spa_config_path=${TMP_CACHE}" || fail 1
${ZPOOL_CREATE_SH} -p ${POOL_NAME} -c lo-raidz2 || fail 2
${ZFS} create -V 100M ${FULL_ZVOL_NAME} || fail 3
- zconfig_partition /dev/zvol/${FULL_ZVOL_NAME} 0 64 || fail 4
+ ${ZFS} set snapdev=visible ${FULL_ZVOL_NAME} || fail 3
+ label /dev/zvol/${FULL_ZVOL_NAME} msdos || fail 4
+ partition /dev/zvol/${FULL_ZVOL_NAME} primary 1% 50% || fail 4
+ partition /dev/zvol/${FULL_ZVOL_NAME} primary 51% -1 || fail 4
${ZFS} snapshot ${FULL_SNAP_NAME} || fail 5
${ZFS} clone ${FULL_SNAP_NAME} ${FULL_CLONE_NAME} || fail 6
${ZFS_SH} zfs="spa_config_path=${TMP_CACHE}" || fail 1
${ZPOOL_CREATE_SH} -p ${POOL_NAME} -c lo-raidz2 || fail 2
${ZFS} create -V 100M ${FULL_ZVOL_NAME} || fail 3
- zconfig_partition /dev/zvol/${FULL_ZVOL_NAME} 0 64 || fail 4
+ ${ZFS} set snapdev=visible ${FULL_ZVOL_NAME} || fail 3
+ label /dev/zvol/${FULL_ZVOL_NAME} msdos || fail 4
+ partition /dev/zvol/${FULL_ZVOL_NAME} primary 1% 50% || fail 4
+ partition /dev/zvol/${FULL_ZVOL_NAME} primary 51% -1 || fail 4
${ZFS} snapshot ${FULL_SNAP_NAME} || fail 5
${ZFS} clone ${FULL_SNAP_NAME} ${FULL_CLONE_NAME} || fail 6
zconfig_zvol_device_stat 0 ${POOL_NAME} ${FULL_ZVOL_NAME} \
${FULL_SNAP_NAME} ${FULL_CLONE_NAME} || fail 9
- # Load the modules, wait 1 second for udev
+ # Load the modules, list the pools to ensure they are opened
${ZFS_SH} zfs="spa_config_path=${TMP_CACHE}" || fail 10
+ ${ZPOOL} list &>/dev/null
# Verify the devices were created
zconfig_zvol_device_stat 10 ${POOL_NAME} ${FULL_ZVOL_NAME} \
local POOL_NAME=tank
local ZVOL_NAME=fish
local FULL_NAME=${POOL_NAME}/${ZVOL_NAME}
- local SRC_DIR=/bin/
local TMP_CACHE=`mktemp -p /tmp zpool.cache.XXXXXXXX`
# Create a pool and volume.
${ZFS_SH} zfs="spa_config_path=${TMP_CACHE}" || fail 1
${ZPOOL_CREATE_SH} -p ${POOL_NAME} -c lo-raid0 || fail 2
${ZFS} create -V 800M ${FULL_NAME} || fail 3
+ label /dev/zvol/${FULL_NAME} msdos || fail 4
+ partition /dev/zvol/${FULL_NAME} primary 1 -1 || fail 4
+ format /dev/zvol/${FULL_NAME}-part1 ext2 || fail 5
- # Partition the volume, for a 800M volume there will be
- # 1624 cylinders, 16 heads, and 63 sectors per track.
- zconfig_partition /dev/zvol/${FULL_NAME} 0 1624
-
- # Format the partition with ext3.
- /sbin/mkfs.ext3 -q /dev/zvol/${FULL_NAME}-part1 || fail 5
-
- # Mount the ext3 filesystem and copy some data to it.
+ # Mount the ext2 filesystem and copy some data to it.
mkdir -p /tmp/${ZVOL_NAME}-part1 || fail 6
mount /dev/zvol/${FULL_NAME}-part1 /tmp/${ZVOL_NAME}-part1 || fail 7
cp -RL ${SRC_DIR} /tmp/${ZVOL_NAME}-part1 || fail 8
sync
# Verify the copied files match the original files.
- diff -ur ${SRC_DIR} /tmp/${ZVOL_NAME}-part1${SRC_DIR} \
+ diff -ur ${SRC_DIR} /tmp/${ZVOL_NAME}-part1/${SRC_DIR##*/} \
&>/dev/null || fail 9
# Remove the files, umount, destroy the volume and pool.
- rm -Rf /tmp/${ZVOL_NAME}-part1${SRC_DIR}* || fail 10
+ rm -Rf /tmp/${ZVOL_NAME}-part1/${SRC_DIR##*/} || fail 10
umount /tmp/${ZVOL_NAME}-part1 || fail 11
rmdir /tmp/${ZVOL_NAME}-part1 || fail 12
pass
}
-run_test 5 "zvol+ext3 volume"
+run_test 5 "zvol+ext2 volume"
# ZVOL snapshot sanity check
test_6() {
local SNAP_NAME=pristine
local FULL_ZVOL_NAME=${POOL_NAME}/${ZVOL_NAME}
local FULL_SNAP_NAME=${POOL_NAME}/${ZVOL_NAME}@${SNAP_NAME}
- local SRC_DIR=/bin/
local TMP_CACHE=`mktemp -p /tmp zpool.cache.XXXXXXXX`
# Create a pool and volume.
${ZFS_SH} zfs="spa_config_path=${TMP_CACHE}" || fail 1
${ZPOOL_CREATE_SH} -p ${POOL_NAME} -c lo-raid0 || fail 2
${ZFS} create -V 800M ${FULL_ZVOL_NAME} || fail 3
+ ${ZFS} set snapdev=visible ${FULL_ZVOL_NAME} || fail 3
+ label /dev/zvol/${FULL_ZVOL_NAME} msdos || fail 4
+ partition /dev/zvol/${FULL_ZVOL_NAME} primary 1 -1 || fail 4
+ format /dev/zvol/${FULL_ZVOL_NAME}-part1 ext2 || fail 5
- # Partition the volume, for a 800M volume there will be
- # 1624 cylinders, 16 heads, and 63 sectors per track.
- zconfig_partition /dev/zvol/${FULL_ZVOL_NAME} 0 1624
-
- # Format the partition with ext2 (no journal).
- /sbin/mkfs.ext2 -q /dev/zvol/${FULL_ZVOL_NAME}-part1 || fail 5
-
- # Mount the ext3 filesystem and copy some data to it.
+ # Mount the ext2 filesystem and copy some data to it.
mkdir -p /tmp/${ZVOL_NAME}-part1 || fail 6
mount /dev/zvol/${FULL_ZVOL_NAME}-part1 /tmp/${ZVOL_NAME}-part1 \
|| fail 7
# Verify the copied files match the original files,
# and the copied files do NOT appear in the snapshot.
- diff -ur ${SRC_DIR} /tmp/${ZVOL_NAME}-part1${SRC_DIR} \
+ diff -ur ${SRC_DIR} /tmp/${ZVOL_NAME}-part1/${SRC_DIR##*/} \
&>/dev/null || fail 12
- diff -ur ${SRC_DIR} /tmp/${SNAP_NAME}-part1${SRC_DIR} \
+ diff -ur ${SRC_DIR} /tmp/${SNAP_NAME}-part1/${SRC_DIR##*/} \
&>/dev/null && fail 13
# umount, destroy the snapshot, volume, and pool.
local FULL_ZVOL_NAME=${POOL_NAME}/${ZVOL_NAME}
local FULL_SNAP_NAME=${POOL_NAME}/${ZVOL_NAME}@${SNAP_NAME}
local FULL_CLONE_NAME=${POOL_NAME}/${CLONE_NAME}
- local SRC_DIR=/bin/
local TMP_CACHE=`mktemp -p /tmp zpool.cache.XXXXXXXX`
# Create a pool and volume.
${ZFS_SH} zfs="spa_config_path=${TMP_CACHE}" || fail 1
${ZPOOL_CREATE_SH} -p ${POOL_NAME} -c lo-raidz2 || fail 2
${ZFS} create -V 300M ${FULL_ZVOL_NAME} || fail 3
+ ${ZFS} set snapdev=visible ${FULL_ZVOL_NAME} || fail 3
+ label /dev/zvol/${FULL_ZVOL_NAME} msdos || fail 4
+ partition /dev/zvol/${FULL_ZVOL_NAME} primary 1 -1 || fail 4
+ format /dev/zvol/${FULL_ZVOL_NAME}-part1 ext2 || fail 5
- # Partition the volume, for a 300M volume there will be
- # 609 cylinders, 16 heads, and 63 sectors per track.
- zconfig_partition /dev/zvol/${FULL_ZVOL_NAME} 0 609
-
- # Format the partition with ext2 (no journal).
- /sbin/mkfs.ext2 -q /dev/zvol/${FULL_ZVOL_NAME}-part1 || fail 5
-
- # Mount the ext3 filesystem and copy some data to it.
+ # Mount the ext2 filesystem and copy some data to it.
mkdir -p /tmp/${ZVOL_NAME}-part1 || fail 6
mount /dev/zvol/${FULL_ZVOL_NAME}-part1 /tmp/${ZVOL_NAME}-part1 \
|| fail 7
# Verify the copied files match the original files,
# and the copied files do NOT appear in the snapshot.
- diff -ur ${SRC_DIR} /tmp/${ZVOL_NAME}-part1${SRC_DIR} \
+ diff -ur ${SRC_DIR} /tmp/${ZVOL_NAME}-part1/${SRC_DIR##*/} \
&>/dev/null || fail 12
- diff -ur ${SRC_DIR} /tmp/${SNAP_NAME}-part1${SRC_DIR} \
+ diff -ur ${SRC_DIR} /tmp/${SNAP_NAME}-part1/${SRC_DIR##*/} \
&>/dev/null && fail 13
# Clone from the original pristine snapshot
local FULL_ZVOL_NAME2=${POOL_NAME2}/${ZVOL_NAME}
local FULL_SNAP_NAME1=${POOL_NAME1}/${ZVOL_NAME}@${SNAP_NAME}
local FULL_SNAP_NAME2=${POOL_NAME2}/${ZVOL_NAME}@${SNAP_NAME}
- local SRC_DIR=/bin/
local TMP_CACHE=`mktemp -p /tmp zpool.cache.XXXXXXXX`
# Create two pools and a volume
${ZFS_SH} zfs="spa_config_path=${TMP_CACHE}" || fail 1
${ZPOOL_CREATE_SH} -p ${POOL_NAME1} -c lo-raidz2 || fail 2
- ${ZPOOL_CREATE_SH} -p ${POOL_NAME2} -c lo-raidz2 || fail 3
- ${ZFS} create -V 300M ${FULL_ZVOL_NAME1} || fail 4
-
- # Partition the volume, for a 300M volume there will be
- # 609 cylinders, 16 heads, and 63 sectors per track.
- zconfig_partition /dev/zvol/${FULL_ZVOL_NAME1} 0 609
-
- # Format the partition with ext2.
- /sbin/mkfs.ext2 -q /dev/zvol/${FULL_ZVOL_NAME1}-part1 || fail 5
-
- # Mount the ext3 filesystem and copy some data to it.
+ ${ZPOOL_CREATE_SH} -p ${POOL_NAME2} -c lo-raidz2 || fail 2
+ ${ZFS} create -V 300M ${FULL_ZVOL_NAME1} || fail 3
+ ${ZFS} set snapdev=visible ${FULL_ZVOL_NAME1} || fail 3
+ label /dev/zvol/${FULL_ZVOL_NAME1} msdos || fail 4
+ partition /dev/zvol/${FULL_ZVOL_NAME1} primary 1 -1 || fail 4
+ format /dev/zvol/${FULL_ZVOL_NAME1}-part1 ext2 || fail 5
+
+ # Mount the ext2 filesystem and copy some data to it.
mkdir -p /tmp/${FULL_ZVOL_NAME1}-part1 || fail 6
mount /dev/zvol/${FULL_ZVOL_NAME1}-part1 \
/tmp/${FULL_ZVOL_NAME1}-part1 || fail 7
cp -RL ${SRC_DIR} /tmp/${FULL_ZVOL_NAME1}-part1 || fail 8
sync || fail 9
- # Snapshot the ext3 filesystem so it may be sent.
+ # Snapshot the ext2 filesystem so it may be sent.
${ZFS} snapshot ${FULL_SNAP_NAME1} || fail 11
wait_udev /dev/zvol/${FULL_SNAP_NAME1} 30 || fail 11
${ZFS} receive ${FULL_ZVOL_NAME2}) || fail 12
wait_udev /dev/zvol/${FULL_ZVOL_NAME2}-part1 30 || fail 12
- # Mount the sent ext3 filesystem.
+ # Mount the sent ext2 filesystem.
mkdir -p /tmp/${FULL_ZVOL_NAME2}-part1 || fail 13
mount /dev/zvol/${FULL_ZVOL_NAME2}-part1 \
/tmp/${FULL_ZVOL_NAME2}-part1 || fail 14