Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Piotr Gawron
minerva-scripts
Commits
852961ee
Commit
852961ee
authored
Mar 19, 2021
by
Piotr Gawron
Browse files
make sure that we don't override existing partition
parent
5b1c13a7
Changes
1
Hide whitespace changes
Inline
Side-by-side
server/create-partition.sh
View file @
852961ee
...
@@ -6,21 +6,29 @@ db_location="/var/lib/postgresql"
...
@@ -6,21 +6,29 @@ db_location="/var/lib/postgresql"
#check if disk is available
#check if disk is available
if
[
-e
$db_disk
]
if
[
-e
$db_disk
]
then
then
file_system_ok
=
`
sudo
fsck
-N
/dev/vdb |grep ext4 |wc
-l
`
mounted
=
`
mount |grep
"
$db_disk
"
|wc
-l
`
if
[
"
$mounted
"
=
"0"
]
if
[
"
$file_system_ok
"
=
"0"
]
then
then
echo
"Initializing file system"
file_system_ok
=
`
sudo
fsck
-N
/dev/vdb |grep ext4 |wc
-l
`
sudo
mkfs.ext4
$db_disk
echo
"Mounting file system"
if
[
"
$file_system_ok
"
=
"0"
]
sudo mkdir
-p
$db_location
then
sudo echo
"
$db_disk
$db_location
ext4 defaults 0 0"
>>
/etc/fstab
echo
"Initializing file system"
sudo
mount
$db_disk
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
else
echo
"
File system alredy exists. Abort
ing"
echo
"
Partinion mounted. Skipp
ing"
exit
1
mount |grep
"
$db_disk
"
fi
fi
else
else
echo
"Disk for database not found:
$db_disk
"
echo
"Disk for database not found:
$db_disk
"
fi
fi
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment