summaryrefslogtreecommitdiff
path: root/old-school
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2016-04-25 20:46:11 -0400
committerAndrew Cady <d@jerkface.net>2016-04-25 20:46:11 -0400
commit14a1ea75b89f56dacf55d865c810530f58ab3fca (patch)
treee663e92bc7a8830bd1be40e753230f6c7f181f95 /old-school
parentd0f8d023e06d4d25e85ee0ceff96955cbe8a24d3 (diff)
fixup! Cdrom duplication
Diffstat (limited to 'old-school')
-rw-r--r--old-school/mdadm-dup.sh30
1 files changed, 15 insertions, 15 deletions
diff --git a/old-school/mdadm-dup.sh b/old-school/mdadm-dup.sh
index b1bcd33..fa38b51 100644
--- a/old-school/mdadm-dup.sh
+++ b/old-school/mdadm-dup.sh
@@ -1,3 +1,13 @@
1LoSetup()
2{
3 local losetup_binary="$(which LoSetup)"
4 if [ "$losetup_binary" ]; then
5 "$losetup_binary" "$@"
6 else
7 losetup "$@"
8 fi
9}
10
1dm_snapshot() 11dm_snapshot()
2{ 12{
3 # TODO: eliminate duplication; this function exists elsewhere in a less generalized form 13 # TODO: eliminate duplication; this function exists elsewhere in a less generalized form
@@ -28,7 +38,7 @@ dm_snapshot()
28 persist=p 38 persist=p
29 chunksize=16 39 chunksize=16
30 dmsetup create "$new_dev_name" --table "0 $size snapshot $ro_dev $rw_dev $persist $chunksize" || return 40 dmsetup create "$new_dev_name" --table "0 $size snapshot $ro_dev $rw_dev $persist $chunksize" || return
31 wait_for_dm_device /dev/mapper/"$new_dev_name"; 41 wait_for_dm_device /dev/mapper/"$new_dev_name";
32 echo /dev/mapper/"$new_dev_name" 42 echo /dev/mapper/"$new_dev_name"
33} 43}
34 44
@@ -100,20 +110,10 @@ mdadm_dup()
100 --level=1 --raid-devices=1 --force --write-mostly "$input_dev" || return 110 --level=1 --raid-devices=1 --force --write-mostly "$input_dev" || return
101} 111}
102 112
103
104mdadm_subdevices() 113mdadm_subdevices()
105{ 114{
106 local md_dev="$1" 115 local md_dev="$1"
107 mdadm -D "$md_dev" -Y | sed -ne 's/MD_DEVICE_.*_DEV=//p' 116 mdadm -D "$md_dev" -Y | sed -ne 's/^MD_DEVICE_.*_DEV=//p'
108}
109
110Mdadm()
111{
112 mdadm "$@"
113 # r=$?
114 # mdadm -D "$1"
115 # sleep 2
116 # return $r
117} 117}
118 118
119mdadm_copy_eject() # NOT INITRD; uses non-busybox "losetup" 119mdadm_copy_eject() # NOT INITRD; uses non-busybox "losetup"
@@ -132,12 +132,12 @@ mdadm_copy_eject() # NOT INITRD; uses non-busybox "losetup"
132 truncate -s $((sectors * 512)) "$output_file" || return 132 truncate -s $((sectors * 512)) "$output_file" || return
133 output_dev=$(losetup -f --show "$output_file") || return 133 output_dev=$(losetup -f --show "$output_file") || return
134 134
135 Mdadm "$md_dev" --add "$output_dev" || return 135 mdadm "$md_dev" --add "$output_dev" || return
136 Mdadm "$md_dev" --grow -n2 || return 136 mdadm "$md_dev" --grow -n2 || return
137 137
138 mdadm_wait_remove "$md_dev" "$old_subdev" || return 138 mdadm_wait_remove "$md_dev" "$old_subdev" || return
139 139
140 Mdadm "$md_dev" --grow -n1 --force || return 140 mdadm "$md_dev" --grow -n1 --force || return
141 dm_snapshot_teardown "$old_subdev" 141 dm_snapshot_teardown "$old_subdev"
142} 142}
143 143