茫茫網海中的冷日 - 對這文章發表回應
茫茫網海中的冷日
         
茫茫網海中的冷日
發生過的事,不可能遺忘,只是想不起來而已!
 恭喜您是本站第 1672136 位訪客!  登入  | 註冊
主選單

Google 自訂搜尋

Goole 廣告

隨機相片
WAVE_LS_SW_00043.jpg

授權條款

使用者登入
使用者名稱:

密碼:


忘了密碼?

現在就註冊!

對這文章發表回應

發表限制: 非會員 可以發表

發表者: 冷日 發表時間: 2019/9/4 7:12:31

Linux加掛第二顆硬碟

出自 Itsmw

流程簡介
檢查硬碟代號→ fdisk → mkfs.ext3格式化 → 永久掛載



檢查第二顆硬碟的代號

  • 若 IDE 直接檢查 hd 字串
    root@dns:~# dmesg |grep hd

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 ...依此類推


  • 若 SATA , 那麼 hd 及 sd 皆可能
    root@dns:~# dmesg |grep sd

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 直接檢查 sd 字串
    root@dns:~# dmesg |grep sd

SCSI device sda: 312581808 512-byte hdwr sectors (160042 MB) ← 第一顆 sata 硬碟
SCSI device sdb: 312581808 512-byte hdwr sectors (160042 MB) ← 第二顆 sata 硬碟



開始動手

安置硬碟 FDISK

  • 使用 FDISK 初始化新的硬碟
    root@dns# fdisk /dev/hdb


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


  1. 新增
    Command (m for help): n
  2. 選完分割區大小後, 寫入
    Command (m for help): w
    會顯示The partition table has been altered! 訊息
  3. 離開 FDISK
    Command (m for help): q



格式化並手動掛載

格式化硬碟只要做一次就好,format 完,先手動掛載一次,看看有沒有什麼問題。若沒問題,再使用下面介紹的永久掛載方式,以使每次開機自動掛成某個資料夾(本文以 /home2 為例)。


  • 格式化 hdb1
    root@dns:# mkfs.ext3 /dev/hdb1

  • 將新硬碟掛在新增目錄
    root@dns# mount -t ext3 /dev/hdb1 /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


  • 依 /etc/fstab 最新的設定重新掛載:
    root@dns# mount -a
  • 觀察
  1. root@dns# df
  2. root@dns# fdisk -l

原文出處: Linux加掛第二顆硬碟 - Itsmw
內容圖示
url email imgsrc image code quote
樣本
bold italic underline linethrough   












 [詳情...]
validation picture

注意事項:
預覽不需輸入認證碼,僅真正發送文章時才會檢查驗證碼。
認證碼有效期10分鐘,若輸入資料超過10分鐘,請您備份內容後,重新整理本頁並貼回您的內容,再輸入驗證碼送出。

選項

Powered by XOOPS 2.0 © 2001-2008 The XOOPS Project|