📄 add-drive.sh
字号:
#!/bin/bash# Adding a second hard drive to system.# Software configuration. Assumes hardware already mounted.# From an article by the author of this document.# In issue #38 of "Linux Gazette", http://www.linuxgazette.com.ROOT_UID=0 # This script must be run as root.E_NOTROOT=67 # Non-root exit error.if [ "$UID" -ne "$ROOT_UID" ]then echo "Must be root to run this script." exit $E_NOTROOTfi # Use with extreme caution!# If something goes wrong, you may wipe out your current filesystem.NEWDISK=/dev/hdb # Assumes /dev/hdb vacant. Check!MOUNTPOINT=/mnt/newdisk # Or choose another mount point.fdisk $NEWDISKmke2fs -cv $NEWDISK1 # Check for bad blocks & verbose output.# Note: /dev/hdb1, *not* /dev/hdb!mkdir $MOUNTPOINTchmod 777 $MOUNTPOINT # Makes new drive accessible to all users.# Now, test...# mount -t ext2 /dev/hdb1 /mnt/newdisk# Try creating a directory.# If it works, umount it, and proceed.# Final step:# Add the following line to /etc/fstab.# /dev/hdb1 /mnt/newdisk ext2 defaults 1 1exit 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -