Linux加掛第二顆硬碟
出自 Itsmw
流程簡介檢查硬碟代號→ fdisk → mkfs.ext3格式化 → 永久掛載
檢查第二顆硬碟的代號
Kernel command line: root=/dev/hda2 ro vga=788 splash=silent
:
:
hda: cache flushes supported
hda: hda1 hda2 ← 第一顆硬碟,內含兩個分割區
Adding 2931820k swap on /dev/hda1. Priority:-1 extents:1 across:2931820k
EXT3 FS on hda2, internal journal
ide-scsi is deprecated for cd burning! Use ide-cd and give dev=/dev/hdX as device
hda: selected mode 0x46
由以上知,只有一顆硬碟時,會叫 hda, 分成兩個分割區。若有第二顆會出現 hdb, 第三顆 hdc ...依此類推
hdc: LITE-ON DVD SOHD-16P9S, ATAPI CD/DVD-ROM drive
SCSI device sda: 312581808 512-byte hdwr sectors (160042 MB) ← 第一顆 sata 硬碟
SCSI device sdb: 312581808 512-byte hdwr sectors (160042 MB) ← 第二顆 sata 硬碟
hdc: ATAPI 48X DVD-ROM drive, 254kB Cache ← 光碟機
由以上知,第一顆是 sda, 第二顆 sdb ...依此類推
SCSI device sda: 312581808 512-byte hdwr sectors (160042 MB) ← 第一顆 sata 硬碟
SCSI device sdb: 312581808 512-byte hdwr sectors (160042 MB) ← 第二顆 sata 硬碟
開始動手
安置硬碟 FDISK
Command (m for help): x
Expert command (m for help): m
Command action
b move beginning of data in a partition
c change number of cylinders
d print the raw data in the partition table
e list extended partitions
f fix partition order
g create an IRIX (SGI) partition table
h change number of heads
m print this menu
n add a new partition
p print the partition table
q quit without saving changes
r return to main menu
s change number of sectors/track
v verify the partition table
w write table to disk and exit
- 新增
Command (m for help): n - 選完分割區大小後, 寫入
Command (m for help): w
會顯示The partition table has been altered! 訊息 - 離開 FDISK
Command (m for help): q
格式化並手動掛載
格式化硬碟只要做一次就好,format 完,先手動掛載一次,看看有沒有什麼問題。若沒問題,再使用下面介紹的永久掛載方式,以使每次開機自動掛成某個資料夾(本文以 /home2 為例)。
寫入/etc/fstab永久掛載
#
# filesystem mountpoint type options dump pass /dev/sda2 / ext3 defaults,errors=remount-ro 0 1 /dev/sda1 none swap sw 0 0 proc /proc proc defaults 0 0 /dev/fd0 /floppy vfat defaults,user,noauto,showexec,umask=022 0 0 /dev/cdrom /cdrom iso9660 defaults,ro,user,noexec,noauto 0 0 none /sys sysfs defaults 0 0 none /dev/pts devpts defaults 0 0 /dev/hdb1 /home2 ext3 defaults,errors=remount-ro 0 0 |
- root@dns# df
- root@dns# fdisk -l