/[smeserver]/cdrom.image/updates/raidconvert
ViewVC logotype

Contents of /cdrom.image/updates/raidconvert

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.7 - (show annotations) (download)
Sat Jun 6 23:51:55 2009 UTC (15 years, 6 months ago) by slords
Branch: MAIN
CVS Tags: HEAD
Changes since 1.6: +0 -0 lines
FILE REMOVED
Split trees

1 #!/bin/sh
2
3 set -x
4 exec 2>&1
5
6 device=$(sed -n 's|.*[0-9]\s\+\([^ ]\+[^0-9]\)$|\1|p;s#.*[0-9]\s\+\(\(rd\|ida\|cciss\|i2o\)/.*[^0-9p][0-9]\+\)$#\1#p' /proc/partitions | head -1)
7
8 if [ -n "$device" ]
9 then
10 sfdisk -d /dev/$device > /tmp/oldparts
11 sed 's/Id=8[32]/Id=fd/' /tmp/oldparts > /tmp/newparts
12
13 mkdir /mnt/tmp
14 for part in $(awk '/^\/dev\/.*Id=8[23]/{ print $1 }' /tmp/oldparts)
15 do
16 md=/dev/md$(echo $part | sed 's|^.*[^0-9]||')
17
18 if grep -q "^$part .*Id=83" /tmp/oldparts
19 then
20 e2fsck -f -C0 $part
21 partsize=$(resize2fs -f $part 2>&1| sed -n 's|.* \([0-9]\+\) blocks long.*|\1|p')
22 resize2fs -fp $part $(($partsize-72))
23 fi
24
25 mdadm -C $md -l 1 -n 2 -R $part missing
26
27 if grep -q "^$part .*Id=83" /tmp/oldparts
28 then
29 e2fsck -f -C0 $md
30 resize2fs -fp $md
31
32 mount $md /mnt/tmp
33 [ -r /mnt/tmp/etc/fstab ] && sed -i "s|/dev/$device\([0-9]\+\)|/dev/md\1|" /mnt/tmp/etc/fstab
34 umount /mnt/tmp
35
36
37 elif grep -q "^$part .*Id=82" /tmp/oldparts
38 then
39 mkswap $md
40 fi
41 done
42 rmdir /mnt/tmp
43
44 mdadm --stop --scan
45 sfdisk --force /dev/$device < /tmp/newparts
46 fi

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed