Mount issue in bash script?
by dr_berta from LinuxQuestions.org on (#58X36)
Hi,
I'm writing a script to save automatically data from a SSD having three primary partitions using a USB pendrive with a live distribution.
The pendrive has in its /mnt folder two subfolder: /mnt/gentoo and /mnt/key
I want to mount in the /mnt/gentoo folder the partiton /dev/sda3 of the SSD where I have the data and I want to mount in the /mnt/key the second partition of the pendrive where I want to save the data.
The script is lunched automatically from the .bashrc script of root user.
The code is the following:
Code:tput clear
echo "Detecting system..."
case "$(uname -p)" in
*G3900*)
DEVICE="/dev/sda"
PLATFORM="64bit"
;;
*N270*)
DEVICE="/dev/sda"
;;
*)
DEVICE="/dev/hda"
;;
esac
echo "$PLATFORM platform"
mount
DEV="${DEVICE}3"
mount -t ext4 $DEV /mnt/gentoo
if [ "$DEVICE" = "/dev/sda" ]; then
DISK2="/dev/sdb2"
else
DISK2="/dev/sda2"
fi
mount -t vfat $DISK2 /mnt/keyThe issue is that, when the script executes the two mount command I see a message saying that the disk is already mounted on the folder.
The mount command shows me that only the pendrive is mounted before the two commands.
Why I receive those messages?
Are they error messages or information messages saying me that the command has properly executed?
Thanks
Claudio


I'm writing a script to save automatically data from a SSD having three primary partitions using a USB pendrive with a live distribution.
The pendrive has in its /mnt folder two subfolder: /mnt/gentoo and /mnt/key
I want to mount in the /mnt/gentoo folder the partiton /dev/sda3 of the SSD where I have the data and I want to mount in the /mnt/key the second partition of the pendrive where I want to save the data.
The script is lunched automatically from the .bashrc script of root user.
The code is the following:
Code:tput clear
echo "Detecting system..."
case "$(uname -p)" in
*G3900*)
DEVICE="/dev/sda"
PLATFORM="64bit"
;;
*N270*)
DEVICE="/dev/sda"
;;
*)
DEVICE="/dev/hda"
;;
esac
echo "$PLATFORM platform"
mount
DEV="${DEVICE}3"
mount -t ext4 $DEV /mnt/gentoo
if [ "$DEVICE" = "/dev/sda" ]; then
DISK2="/dev/sdb2"
else
DISK2="/dev/sda2"
fi
mount -t vfat $DISK2 /mnt/keyThe issue is that, when the script executes the two mount command I see a message saying that the disk is already mounted on the folder.
The mount command shows me that only the pendrive is mounted before the two commands.
Why I receive those messages?
Are they error messages or information messages saying me that the command has properly executed?
Thanks
Claudio