Gitlab is now using https://gitlab.lcsb.uni.lu as it's primary address. Please update your bookmarks. FAQ.

Commit 852961ee authored by Piotr Gawron's avatar Piotr Gawron
Browse files

make sure that we don't override existing partition

parent 5b1c13a7
......@@ -6,21 +6,29 @@ db_location="/var/lib/postgresql"
#check if disk is available
if [ -e $db_disk ]
then
file_system_ok=`sudo fsck -N /dev/vdb |grep ext4 |wc -l`
if [ "$file_system_ok" = "0" ]
mounted=`mount |grep "$db_disk" |wc -l`
if [ "$mounted" = "0" ]
then
echo "Initializing file system"
sudo mkfs.ext4 $db_disk
echo "Mounting file system"
sudo mkdir -p $db_location
sudo echo "$db_disk $db_location ext4 defaults 0 0">>/etc/fstab
sudo mount $db_disk
file_system_ok=`sudo fsck -N /dev/vdb |grep ext4 |wc -l`
if [ "$file_system_ok" = "0" ]
then
echo "Initializing file system"
sudo mkfs.ext4 $db_disk
echo "Mounting file system"
sudo mkdir -p $db_location
sudo echo "$db_disk $db_location ext4 defaults 0 0">>/etc/fstab
sudo mount $db_disk
else
echo "File system alredy exists. Aborting"
exit 1
fi
else
echo "File system alredy exists. Aborting"
exit 1
echo "Partinion mounted. Skipping"
mount |grep "$db_disk"
fi
else
echo "Disk for database not found: $db_disk"
fi
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment