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

Diff of /cdrom.image/updates/raidconvert

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

Revision 1.5 by slords, Fri Dec 22 23:52:44 2006 UTC Revision 1.6.2.1 by slords, Sat Mar 15 18:11:42 2008 UTC
# Line 10  then Line 10  then
10      sfdisk -d /dev/$device > /tmp/oldparts      sfdisk -d /dev/$device > /tmp/oldparts
11      sed 's/Id=8[32]/Id=fd/' /tmp/oldparts > /tmp/newparts      sed 's/Id=8[32]/Id=fd/' /tmp/oldparts > /tmp/newparts
12    
13      mkdir /mnt/tmp      mkdir -p /mnt/tmp
14      for part in $(awk '/^\/dev\/.*Id=8[23]/{ print $1 }' /tmp/oldparts)      for part in $(awk '/^\/dev\/.*Id=8[23]/{ print $1 }' /tmp/oldparts)
15      do      do
16          md=/dev/md$(echo $part | sed 's|^.*[^0-9]||')          md=/dev/md$(echo $part | sed 's|^.*[^0-9]||')
# Line 23  then Line 23  then
23          fi          fi
24    
25          mdadm -C $md -l 1 -n 2 -R $part missing          mdadm -C $md -l 1 -n 2 -R $part missing
         echo "DEVICE $part" >> /tmp/mdadm.conf  
26    
27          if grep -q "^$part .*Id=83" /tmp/oldparts          if grep -q "^$part .*Id=83" /tmp/oldparts
28          then          then
# Line 31  then Line 30  then
30              resize2fs -fp $md              resize2fs -fp $md
31    
32              mount $md /mnt/tmp              mount $md /mnt/tmp
33              [ -r /mnt/tmp/etc/fstab ] && root=$md              [ -r /mnt/tmp/etc/fstab ] && sed -i "s|/dev/$device\([0-9]\+\)|/dev/md\1|" /mnt/tmp/etc/fstab
34              umount /mnt/tmp              umount /mnt/tmp
35    
36    
# Line 40  then Line 39  then
39              mkswap $md              mkswap $md
40          fi          fi
41      done      done
   
     echo >> /tmp/mdadm.conf  
     mdadm -Es -c /tmp/mdadm.conf >> /tmp/mdadm.conf  
   
     if [ -n "$root" ]  
     then  
         mount $root /mnt/tmp  
         sed -i "s|/dev/$device\([0-9]\+\)|/dev/md\1|" /mnt/tmp/etc/fstab  
         cp /tmp/mdadm.conf /mnt/tmp/etc/mdadm.conf  
         umount /mnt/tmp  
     fi  
42      rmdir /mnt/tmp      rmdir /mnt/tmp
43    
44      mdadm --stop --scan      mdadm --stop --scan
   
45      sfdisk --force /dev/$device < /tmp/newparts      sfdisk --force /dev/$device < /tmp/newparts
46  fi  fi


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

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