Debian Codegraph @

add-drive.sh

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2
3 # Adding a second hard drive to system.
4 # Software configuration. Assumes hardware already mounted.
5 # From an article by the author of the ABS Guide.
6 # In issue #38 of _Linux Gazette_, http://www.linuxgazette.com.
7
8 ROOT_UID=0 # This script must be run as root.
9 E_NOTROOT=67 # Non-root exit error.
10
11 if [scip-shell system . . `[`. "$UID" -ne "$ROOT_UID" ]
12 then
13 echoscip-shell system . . echo. "Must be root to run this script."
14 exit $E_NOTROOT
15 fi
16
17 # Use with extreme caution!
18 # If something goes wrong, you may wipe out your current filesystem.
19
20
21 NEWDISK=/dev/hdbscip-shell filesystem . . `/dev/hdb`. # Assumes /dev/hdb vacant. Check!
22 MOUNTPOINT=/mnt/newdiskscip-shell filesystem . . `/mnt/newdisk`. # Or choose another mount point.
23
24
25 fdisk $NEWDISK
26 mke2fs -cv $NEWDISK1 # Check for bad blocks (verbose output).
27 # Note: ^ /dev/hdb1, *not* /dev/hdb!
28 mkdirscip-shell system . . mkdir. $MOUNTPOINT
29 chmodscip-shell system . . chmod. 777 $MOUNTPOINT # Makes new drive accessible to all users.
30
31
32 # Now, test ...
33 # mount -t ext2 /dev/hdb1 /mnt/newdisk
34 # Try creating a directory.
35 # If it works, umount it, and proceed.
36
37 # Final step:
38 # Add the following line to /etc/fstab.
39 # /dev/hdb1 /mnt/newdisk ext2 defaults 1 1
40
41 exit