Skip to content

Commit

Permalink
Use parted (If available) to partition disk, else fallback to sfdisk.
Browse files Browse the repository at this point in the history
Signed-off-by: Shishir Mahajan <[email protected]>

Closes: #191
Approved by: rhvgoyal
  • Loading branch information
Shishir Mahajan authored and rh-atomic-bot committed Jan 26, 2017
1 parent 948e2fa commit 5e1f47b
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions docker-storage-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -706,9 +706,8 @@ scan_disks() {
echo $new_disks
}

create_partition() {
create_partition_sfdisk(){
local dev="$1" size

# Use a single partition of a whole device
# TODO:
# * Consider gpt, or unpartitioned volumes
Expand All @@ -720,6 +719,21 @@ unit: sectors
${dev}1 : start= 2048, size= ${size}, Id=8e
EOF
}

create_partition_parted(){
local dev="$1"
parted $dev --script mklabel msdos mkpart primary 0% 100% set 1 lvm on
}

create_partition() {
local dev="$1"

if [ -x "/usr/sbin/parted" ]; then
create_partition_parted $dev
else
create_partition_sfdisk $dev
fi

# Sometimes on slow storage it takes a while for partition device to
# become available. Wait for device node to show up.
Expand Down

0 comments on commit 5e1f47b

Please sign in to comment.