磁盤劃分和掛載

  1)、MSDOS磁盤分區
 特色:分區類型的主要分區、擴展分區、邏輯分區
主分區+擴展分區<=4
擴展分區<=1
不支持超過2TB的磁盤
主分區和擴展分區的設備1-->4 邏輯分區從5開始

2)、GPT磁盤分區
注意:目前的BIOS不能支持GPT引導,只有UEFI才能引導GPT啓動分區

3)、1.劃分磁盤分區大小首先要考慮業務的大小。
    2.磁盤劃分須要格式化
    3.須要掛載磁盤數據才能讀入進去
    


#fdisk /dev/磁盤設備名
Command (m for help): n
Command action
   e   extended  擴展分區
   p   primary partition (1-4)   主分區
p
Partition number (1-4): 1       從第一個1開始分區
First cylinder (1-1305, default 1):     分區的大小從什麼位置開始,通常選擇默認
Using default value 1         通常選擇默認
Last cylinder, +cylinders or +size{K,M,G} (1-1305, default 1305): +4G 
選擇分區的大小
Command (m for help): w    保存



  (1)劃分msdos分區
  # parted /dev/sdc
(parted) help
(parted) mklabel msdos                                                    
(parted) mkpart primary 0GB 4GB         新建分區                                  
(parted) mkpart extended 4GB 100%                                         
(parted) mkpart logical 4GB 60%                                           
(parted) mkpart logical 60% 100%                                      
(parted) print                                                            
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdc: 16.1GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number  Start   End     Size    Type      File system  標誌
 1      1049kB  4000MB  3999MB  primary
 2      4000MB  16.1GB  12.1GB  extended               lba
 5      4001MB  9664MB  5662MB  logical
 6      9665MB  16.1GB  6441MB  logical


(parted) mklabel gpt                                                      
警告: The existing disk label on /dev/sdc will be destroyed and all data on this disk will be lost. Do you
want to continue?
是/Yes/否/No? Yes                                                         
(parted) mkpart system 0% 30%
(parted) mkpart application 30% 60%                                            
(parted) mkpart movie 60% 100%                                     
(parted) print                                                            
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdc: 16.1GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name         標誌
 1      1049kB  4832MB  4831MB               system
 2      4832MB  9664MB  4832MB               application
 3      9664MB  16.1GB  6441MB               movie
 
 


Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): b
Changed system type of partition 2 to b (W95 FAT32)
 
 Command (m for help): p

Disk /dev/sdb: 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: 0x87eec63a

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         132     1060258+  83  Linux
/dev/sdb2             133         263     1048576    b  W95 FAT32
Partition 2 does not end on cylinder boundary.



    
    mount 需掛載的設備 掛載的目錄
    
    
    
     配置/etc/fstab 
/root/Downloads/rhel-server-6.5-x86_64-dvd.iso  /mnt/cdrom      iso9660
 defaults        0 0 
/root/Downloads/rhel-server-6.5-x86_64-dvd.iso 須要掛載的設備
/mnt/cdrom                           設備掛載點
iso9660        文件類型  ext2  ext4   swap   iso9660     vfat
defaults   掛載選項   async: 異步    auto :自動(mount  -a)發現沒有掛載的回自動掛載上sync :同步                       noauto :非自動
 exce 可執行   ro  /  rw  :可讀可寫  noexec :不可執行
 0    是否支持dump備份,0 表明不作備份,1 表明天天進行dump備份,2 表明不按期備份
 0    是否用fsck 命令檢測文件系統,0 表明不要檢測,非0 表明須要檢測,數字越小優先級越高
 
 
 rpm -a autofs 查看工具是否安裝
 #/etc/auto.master 主配置文件
 /misc   /etc/auto.misc     --timeout=10(以秒爲單位)
一級掛載點   二級掛點子配置文件     10秒以後自動卸載

 
#/etc/auto.misc   子配置文件
/U01                    ext4     掛載的設備
二級掛載點,名字能夠隨意    文件類型

#service autofs restart
啓動服務就ok
  
  
   
    環境:掛載10.1.1.254機器的目錄(/dada/share/notes)到本身目錄(/uplook/ule)
    一、修改主配置文件 /etc/auto.master
    /uplook    /etc/auto.ule
    
    二、建立子配置文件
    
    vim /etc/auto.ule
      ule  -ro,nfs  10.1.1.254:/data/share/notes
     
    三、重啓服務
      service autofs restart
    四、測試驗證
     cd /uplook/ule  二級掛載點第一次使用時看不見
相關文章
相關標籤/搜索