Fix zconfig.sh non-optimal alignment

The recent zvol improvements have changed default suggested alignment
for zvols from 512b (default) to 8k (zvol blocksize).  Because of this
the zconfig.sh tests which create paritions are now generating a
warning about non-optimal alignments.

This change updates the need zconfig.sh tests such that a partition
will be properly aligned.  In the process, it shifts from using the
sfdisk utility to the parted utility to create partitions.  It also
moves the creation of labels, partitions, and filesystems in to
generic functions in common.sh.in.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
This commit is contained in:
Brian Behlendorf
2012-02-09 10:38:03 -08:00
parent dde9380a1b
commit 93648f314c
2 changed files with 67 additions and 56 deletions
+40
View File
@@ -307,6 +307,46 @@ destroy_loop_devices() {
return 0
}
#
# Create a device label.
#
label() {
local DEVICE=$1
local LABEL=$2
${PARTED} ${DEVICE} --script -- mklabel ${LABEL} || return 1
return 0
}
#
# Create a primary partition on a block device.
#
partition() {
local DEVICE=$1
local TYPE=$2
local START=$3
local END=$4
${PARTED} --align optimal ${DEVICE} --script -- \
mkpart ${TYPE} ${START} ${END} || return 1
udev_trigger
return 0
}
#
# Create a filesystem on the block device
#
format() {
local DEVICE=$1
local FSTYPE=$2
/sbin/mkfs.${FSTYPE} -q ${DEVICE} || return 1
return 0
}
#
# Check that the mdadm utilities are installed.
#