Hello,
I have created a script to automatically create two partitions on a disk and to create an ext4 filesystem on the disk sda1 and the swap disk on sda2.
The proble I have is that the tool mke2fs, used to create the filesystem on sda1, gives me a "Bad magic number in super-block error" if executed immediately after the disk partitioning.
If I put in the script a read command (see the blue commands below), asking for a enter key pressed, everything goes well and the error is not present.
This is the code showing the issue:
Code:
echo -e "Making new partitions..."
# make partitions
DEVICE="/dev/sda"
sfdisk $DEVICE < /mnt/cdrom/tbs/.sda.sfdisk
sfdisk -qV $DEVICE
RESULT=$?
if [ $RESULT -ne 0 ] ; then
echo "Error creating partitions!"
exit
fi
echo "enter return to continue"
read ANS
echo -e "Reloading partition table..."
partprobe $DEVICE
sleep 1
# create filesystems
BIG="16000"
VERYBIG="2000000000"
if [ $PLATFORM = "64bit" ]; then
mke2fs -t ext4 -L "slash" "${DEVICE}1"
tune2fs -c $BIG -i $VERYBIG "${DEVICE}1"
mkswap -L "swap" "${DEVICE}2"
else
echo "Error!!!"
exit
fi
Is there anyone that knows the reason of this strange behavior? I would like to remove the "enter key press" request
Thanks
Claudio