close

vm 掛載新硬碟在CentOS 後,要重新Mount 硬碟

 

首先掛載新硬碟後,CentOS

#df -h                                                   //看出目前硬碟 掛載的 是 sda or sdb or sdc...?

#fdisk -l                                              //看一下現在抓取到那些硬碟

#fdisk /dev/sdc                                 //開始對剛掛載的sdc硬碟做fdisk初始化            ----看※注意事項1

#mkfs.ext3 -L data40G /dev/sdc1   //對sdc 硬碟做格式化  這裡用3是因為 這台OS 是centos 5 如果是6.5 你可以用4

#blkid                                            // 再檢查剛加進來的 sdc 是否已可正常觀看 uuid是多少        

#mkdir /data1                             //建立 要mount 的目錄位置

#vi /etc/fstab                            //修改 fstab 檔案  這邊是要開機掛載的硬碟紀載資訊   ----看※注意事項2

#mount -a                              //直接掛載fstab所記載的硬碟資訊

#df -h                                   //做最後檢查 看看有沒正常掛載硬碟

 

 

※注意事項1 [初始化設定]---這部分因自身設定時,沒拍圖 故複製網路所找尋到的資料

[user1@CentOS64 ~]$ sudo fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x06d9f3c4.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
 
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) 

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p

Partition number (1-4): 1
First cylinder (1-26108, default 1): 
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-26108, default 26108): Enter
Using default value 26108

Command (m for help): p

Disk /dev/sdb: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 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: 0x06d9f3c4

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       26108   209712478+  83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

[user1@CentOS64 ~]$ cat /proc/partitions
major minor  #blocks  name
 
   8        0   54525952 sda
   8        1    2048000 sda1
   8        2   52476928 sda2
   8       16  209715200 sdb
   8       17  209712478 sdb1

[user1@CentOS64 ~]$ sudo mkfs.ext4 -L data200G /dev/sdb1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=data200G
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
13107200 inodes, 52428119 blocks
2621405 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
1600 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
4096000, 7962624, 11239424, 20480000, 23887872

Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
 
This filesystem will be automatically checked every 28 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

※注意事項2 UUID不要照抄 請使用 blkid 查剛掛載的UUID碼是多少

UUID="a66f5811-5531-4e14-bf17-1de95380f8a9"     /data1  ext3    defaults     1 2

 

 

※參考資料來源:

http://blog.xuite.net/tolarku/blog/68767008-CentOS+%E6%96%B0%E5%A2%9E%E7%A1%AC%E7%A2%9F+-+%E6%96%B0%E5%A2%9E+VMWare+%28ESX%29+%E7%A1%AC%E7%A2%9F

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 chengyu0701988 的頭像
    chengyu0701988

    chengyu0701988的部落格

    chengyu0701988 發表在 痞客邦 留言(0) 人氣()