阿裡雲主機linux繫統如何掛在雲硬盤

2015-09-27 10:27:00
hainuo
原創 2190
摘要:在linux上掛在硬盤
如何在linux上掛在硬盤這對很多新手來説很痛苦的,因爲怕弄錯瞭。其實這一點大可不必,我們的操作不會對繫統産生很大的影響,哪怕你掛載在瞭錯誤位置首先我們要弄清楚```➜ ~ fdisk -lDisk /dev/xvda: 21.5 GB, 21474836480 bytes255 heads, 63 sectors/track, 2610 cylinders, total 41943040 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x000da36d Device Boot Start End Blocks Id System/dev/xvda1 * 2048 41940991 20969472 83 LinuxDisk /dev/xvdb: 107.4 GB, 107374182400 bytes43 heads, 44 sectors/track, 110843 cylinders, total 209715200 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x0b93bdf4 Device Boot Start End Blocks Id System/dev/xvdb1 2048 209715199 104856576 83 Linux```通過以上可以看到有一箇硬盤 svdb1 100G需要掛在那麽掛在需要先對硬盤進行格式化如何格式化呢```➜ ~ mkfs.ext4 /dev/xvdb1mke2fs 1.42.9 (4-Feb-2014)Filesystem label=OS type: LinuxBlock size=4096 (log=2)Fragment size=4096 (log=2)Stride=0 blocks, Stripe width=0 blocks6553600 inodes, 26214144 blocks1310707 blocks (5.00%) reserved for the super userFirst data block=0Maximum filesystem blocks=4294967296800 block groups32768 blocks per group, 32768 fragments per group8192 inodes per groupSuperblock backups stored on blocks:32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,4096000, 7962624, 11239424, 20480000, 23887872Allocating group tables: doneWriting inode tables: doneCreating journal (32768 blocks): doneWriting superblocks and filesystem accounting information: done```關鍵看最後這箇done就搞定瞭然後就是```mkdir /home/wwwrootmount /dev/xvdb1 /home/wwwroot```將硬盤掛在到web分區中,保證web的容量掛在錯瞭怎麽取消掛載呢```umount /home/wwwroot```Ps 我們需要註意的是,當前這種方式不能夠及時掛載相應的分區,需要我們作如下處理在`/etc/fstab`文件末尾寫入自動掛載處理命令```/dev/xvdb1 /home/wwwroot ext4 defaults 1 2```也可以使用命令```echo '/dev/xvdb1 /home/wwwroot ext4 defaults 1 2' >> /etc/fstab```
發錶評論
陸 加 貳 =
評論通過審核後顯示。