Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F12944709
new-partition.sh
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
new-partition.sh
View Options
#!/bin/sh
# -------------------------------------------------------------
# Add a new partition to a device mapper volume group
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# License: Trivial work, not eligible to copyright
# Source file: roles/core/userland-software/files/new-partition.sh
#
# Usage:
# new-partition <device> <volume group>
# <logical volume name> [mounting point]
#
# If the mounting point is omitted, disk is mounted
# in /<logical volume name>
#
# Example:
# new-partition /dev/sdb1 centos_dwellers wharf /wharf
#
# -------------------------------------------------------------
#
# <auto-generated>
# This file is managed by our rOPS SaltStack repository.
#
# Changes to this file may cause incorrect behavior
# and will be lost if the state is redeployed.
# </auto-generated>
# Parses arguments
if
[
$#
-lt
3
]
||
[
$#
-gt
4
]
;
then
echo
'Usage: new-partition <device> <volume group>'
echo
' <logical volume name> [mounting point]'
exit
1
fi
DEVICE
=
$1
VG
=
$2
LVNAME
=
$3
if
[
$#
-eq
4
]
;
then
MOUNTING_POINT
=
$4
else
MOUNTING_POINT
=
/
$LVNAME
fi
# Creates, formats, mounts partion
pvcreate
"
$DEVICE
"
vgextend
"
$VG
"
"
$DEVICE
"
lvcreate -l
100
%FREE -n
"
$LVNAME
"
"
$VG
"
mkfs -t xfs
"/dev/
$VG
/
$LVNAME
"
echo
"/dev/mapper/
$VG
-
$LVNAME
$MOUNTING_POINT
xfs defaults 1 2"
>> /etc/ftab
mount
"
$MOUNTING_POINT
"
File Metadata
Details
Attached
Mime Type
text/x-shellscript
Expires
Tue, Nov 18, 17:20 (1 d, 13 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3154660
Default Alt Text
new-partition.sh (1 KB)
Attached To
Mode
rOPS Nasqueron Operations
Attached
Detach File
Event Timeline
Log In to Comment