ALT Linux Bugzilla
– Attachment 5968 Details for
Bug 29471
Плохо работает очистка дисков при установке
New bug
|
Search
|
[?]
|
Help
Register
|
Log In
[x]
|
Forgot Password
Login:
[x]
|
EN
|
RU
src/cleaner.sh
cleaner.sh (text/plain), 2.95 KB, created by
Michael Shigorin
on 2013-10-14 17:04:01 MSK
(
hide
)
Description:
src/cleaner.sh
Filename:
MIME Type:
Creator:
Michael Shigorin
Created:
2013-10-14 17:04:01 MSK
Size:
2.95 KB
patch
obsolete
>#!/bin/sh > >for i in `ls -1 /dev/{s,h}d[a-l]`; do > fdisk -lu $i >/dev/null 2>&1 >done > >stop_arrays() >{ > dmsetup remove_all > > ARRAYLIST=`cat /proc/mdstat | grep md | sed 's/\(md.*\) :.*/\1/'` > > echo "Stopping arrays $ARRAYLIST" > > [ -z "$ARRAYLIST" ] && return > > for ARRAY in $ARRAYLIST; do > echo -en "Stopping array (/dev/$ARRAY)\t\t" > eval mdadm --manage /dev/evms/.nodes/$ARRAY --stop && echo "[ STOPPED ]" || echo "[ NOTFOUND ]" > eval mdadm --manage /dev/$ARRAY --stop && echo "[ STOPPED ]" || echo "[ NOTFOUND ]" > done >} > >zero_superblock() >{ > local DISKLIST=$* > > [ -z "$DISKLIST" ] && return > > for DISK in $DISKLIST; do > local PARTLIST=`cat /proc/partitions | grep $DISK | sed "s/.*\(\(sd\|hd\).[[:digit:]]*\).*/\1/"` > > for PART in $PARTLIST; do > echo -en "Zeroing superblock on (/dev/evms/.nodes/$PART) \t\t" > eval mdadm --misc --zero-superblock /dev/evms/.nodes/$PART >/dev/null 2>&1 && echo "[ ZEROED ]" || echo "[ NOTFOUND ]" > echo -en "Zeroing superblock on (/dev/$PART) \t\t" > eval mdadm --misc --zero-superblock /dev/$PART >/dev/null 2>&1 && echo "[ ZEROED ]" || echo "[ NOTFOUND ]" > done > done >} > > >delete_partitions() >{ > echo "commit" | evms -c --pipe -m readonly -d everything >/dev/null 2>&1 > > local list=$* > > stop_arrays > > awk -v disks="\"$list\"" ' > /^.*: LD_read: Read/ { > res = gensub(/^.*: LD_read: Read disk:([a-z]+) offset:([0-9]+) count:([0-9]+)/,"dd if=/dev/zero of=/dev/\\1 bs=512 seek=\\2 count=\\3",$0); > disk_to_clean = gensub(/^.*: LD_read: Read disk:([a-z]+) offset:([0-9]+) count:([0-9]+)/,"\\1",$0); > printf "%s\n", res; > > if (index(disks,disk_to_clean) != 0) { > print res >"/tmp/delete_partitions.log"; > cmd = sprintf("%s >/dev/null 2>&1", res); > system(cmd); > } > } > > BEGIN { > printf "\nDeleting meta info from: ( %s)\n", disks; > } > > END { > system("sync"); > print "Done"; > } > ' /var/log/evms-engine.log > > zero_superblock $list >} > > >DISKLIST="" >for i in `egrep '.* [sh]d[a-z]$' /proc/partitions | sed -re 's|.* ([sh]d[a-z])|\1|'`; do > if mount -oro "/dev/$i" /mnt 2>/dev/null && ls -1 '/mnt/cdimage.iso'; then > umount /mnt 2>/dev/null ||: > echo "Flash installation found! Partitions deleting on /dev/$i skipped" > else > umount /mnt 2>/dev/null ||: > DISKLIST="$i $DISKLIST" > fi >done > > >echo "Cleaning $DISKLIST" > >delete_partitions "$DISKLIST" > >for DISK in $DISKLIST; do > echo -en "Re-validating /dev/${DISK} \t\t" > echo -e "o\nn\np\n1\n\n\nw\n" | fdisk "/dev/$DISK" >/dev/null 2>&1 && echo "[ OK ]" || "[ FAILED ]" > > echo -en "Cleaning up partition table on /dev/$DISK\t\t" > dd if=/dev/zero of=/dev/$DISK count=1 bs=1024 >/dev/null 2>&1 && echo "[ OK ]" || "[ FAILED ]" >done > >evms_activate >/dev/null 2>&1 > >for VOL in /dev/evms/*; do > [ "$VOL" == "/dev/evms/dm" ] && continue > > echo -en "Deleting compatible volume ($VOL)\t\t" > echo -e "dr:$VOL\nquit\n" | evms -b >/dev/null 2>&1 && echo "[ OK ]" || echo "[ FAILED ]" >done > >echo "All the disks are prepared for installation."
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 29471
: 5968