Browse Source

Improved README and added INSTALL

root 5 years ago
parent
commit
a40546a0d5
5 changed files with 59 additions and 5 deletions
  1. 12 0
      INSTALL
  2. 44 0
      README
  3. 0 3
      README.md
  4. 1 1
      error.sh
  5. 2 1
      parse-arguments.sh

+ 12 - 0
INSTALL

@@ -0,0 +1,12 @@
+To install this script, simply change the DIR variable in the newdisk-automator script to match the installation directory.
+
+Required software:
+	- lvm2
+	- wipefs
+	- sfdisk
+	- awk
+	- mkfs
+	- blockdev
+	- grep
+	- cat
+	- mountpoint

+ 44 - 0
README

@@ -0,0 +1,44 @@
+newdisk-automator
+A tool for automating the partitioning of new disks in lcm
+
+Overview:
+This program create a new partition table on the disk, consisting of a single partition occupying the whole space.
+It then divides the partition in up to four lvm logical volumes, whose size can be specified with the command line or calculated automatically by the program.
+This program does not mount the new partitions, nor update the fstab: these operations have to be performed afterwards.
+
+This program can be used in two mode: automatic and manual.
+
+Automatic:
+newdisk-automator [-qvf] device
+device is partitioned according to the following scheme:
+- calcolo: 100GB
+- swap: ram size + 1GB
+- free space: 10% of the total
+- condor: 40% of remaining space
+- tempdir: 60% of remaining space
+If the size of the disk is less than 102GB + ram size, this mode cannot be used.
+If the size of the disk is greater than the minimum size, but still less than (100GB + ram size) * 2, to use this mode the -f option must be passed.
+Be careful: in the automatic mode, calcolo and swap size are fixed, and forcing it with -f could result in having very small tempdir and condor partitions. 
+
+Manual:
+newdisk-automator [-qv] device temp_size condor_size swap_size vm_size
+The partitions are assigned the size passed on the command line. S, b, K, M, G can be appended to the sizes for 512-byte-sectors, bytes, kibibytes, mebibytes and gibibytes. The default is bytes.
+If the total passed with the command line is greater than the size of the disk, the program stops.
+
+Error codes:
+10 Usage error
+11 Size units error
+
+20 Device file does not exist
+21 Device is not a block file
+22 Device is mounted
+23 Device is used as swap
+24 Device is part of a used lvm volume
+25 Device is part of a lvm volume group shared with other physical volumes
+26 Device is not a regular disk (it may be a partition or another type of block file)
+
+30 Device is too small to use default mode
+31 Device does not have the reccomended size. Force with -f to use default mode
+32 Device is smaller than the manually specified size
+
+40 One of the programs called from the script returned a non 0 value. Check the stderr to get the code

+ 0 - 3
README.md

@@ -1,3 +0,0 @@
-# newdisk-automator
-
-Tool for automating the partitioning of new disks in lcm

+ 1 - 1
error.sh

@@ -21,6 +21,6 @@ PROG_E=40
 fatal()
 {
 	STRING=${2:-"generic error"}
-	printf "${PROGRAM_NAME}: error: ${STRING}\n" >&2
+	echo "${PROGRAM_NAME}: error: ${STRING}" >&2
 	exit ${1}
 }

+ 2 - 1
parse-arguments.sh

@@ -73,7 +73,7 @@ usage()
 	echo "${PROGRAM_NAME} [-qvf] device"
 	echo "${PROGRAM_NAME} [-qv] device temp_size condor_size swap_size vm_size"
 	echo "${PROGRAM_NAME} -h[v]"
-	exit USAGE_E
+	exit $USAGE_E
 }
 
 help()
@@ -82,6 +82,7 @@ help()
 		newdisk automator
 		This program can be used in two mode: automatic and manual.
 		For help, use -h. For info about error codes, use both help and verbose flags.
+		WARNING! This program does not mount the new partitions, nor update the fstab: these operations have to be performed afterwards.
 
 		Automatic:
 		newdisk-automator [-qvf] device