1
edit
Changes
→Pidora 2014 Reformating Boot Partition Script
<pre>
#!/bin/bash
#
# partition
loopdev=$(kpartx -av "$1" | awk 'NR==1 {print $3}') echo -e "$loopdev"
# You
#create temp dirs
mkdir /media./tempmkdir -p ./tmp/boot
## mount boot partition
mount -o rw /dev/mapper/loop0p1 /media$loopdev ./temp/
## copy boot data to temp dir
cp -r /media./temp/* ./tmp/boot
#rename kernel.img work around for boot
cp ./tmp/boot/kernel-3.* ./tmp/boot/kernel.img
#unmount temp boot dir
umount /media./temp
#reformat boot parttions to vfat
mkfs -t vfat -n boot /dev/mapper/loop0p1$loopdev
sleep 3
3
w
" | fdisk /dev/loop0${loopdev::5}
sleep 3
## re-mount boot partition
mount -o rw /dev/mapper/loop0p1 /media$loopdev ./temp
#cp orginal boot data to new vfat partition
cp -r ./tmp/boot/* /media./temp/
sleep 10
# umount tmp boot again
umount /media./temp
sync
# cleanup
dmsetup remove loop0p3$loopdev
sleep 2
rm -rf /media./temprm -rf ./tmp/boot</pre>