1. 程式人生 > >linux 裝置掛載

linux 裝置掛載

磁碟掛載:

1.檢視當前有哪些硬碟掛載著
fdisk -l

Disk /dev/xvdb: 404.8 GB, 404800667648 bytes
255 heads, 63 sectors/track, 49214 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/xvda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000f2f6a

2.嘗試掛載 /dev/xvdb 到 /data 目錄
mkdir /data
mount /dev/xvdb /data

3.如果報錯:
mount:you must specify the filesystem type
3.1.格式化當前的裝置
mkfs.ext4 /dev/xvdb

注意:首先 df -T -h 檢視當前被掛載的裝置的檔案系統型別
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
              ext4     16G  795M   14G   6% /
tmpfs        tmpfs    5.8G     0  5.8G   0% /dev/shm
/dev/xvda1    ext4    485M   32M  429M   7% /boot
如果其他的硬碟是 ext3 就使用 mkfs.ext3 /dev/xvdb
如果是ext4 就使用 mkfs.ext3 /dev/xvdb

3.2.然後再次嘗試掛載裝置
mount /dev/xvdb /data