diff options
author | Brian Behlendorf <[email protected]> | 2012-02-09 10:38:03 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2012-02-09 13:23:28 -0800 |
commit | 93648f314c258897a0fa72b0d0b164e1937a5b63 (patch) | |
tree | d734eebd42ba4bb3092b6adb84796b111d3ca2ab /scripts/common.sh.in | |
parent | dde9380a1bf9084d0c8a3e073cdd65bb81db1a23 (diff) |
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 <[email protected]>
Diffstat (limited to 'scripts/common.sh.in')
-rw-r--r-- | scripts/common.sh.in | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/scripts/common.sh.in b/scripts/common.sh.in index 56706194c..71a6b18a0 100644 --- a/scripts/common.sh.in +++ b/scripts/common.sh.in @@ -308,6 +308,46 @@ destroy_loop_devices() { } # +# 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. # check_md_utils() { |