Linux營運系統工程師系列---22

來源:互聯網
上載者:User

標籤:linux營運 磁碟管理 建立檔案系統 掛載

磁碟管理---建立檔案系統與掛載

    

  1. 建立檔案系統

     

格式化
[[email protected] devices]# mkfs.ext4 /dev/sdb1
或者
[[email protected] devices]# mkfs -t ext4 /dev/sdb1

 

mkfs.ext4格式化時候的選項:

 -b——指定檔案系統塊的大小

 -g——指定每個塊組的大小

 -i——指定每個i節點佔用多少位元組磁碟空間

 -I——指定檔案系統i節點所佔用空間大小

 -N——指定i節點的數量,近似值

 -L——指定磁碟分割的標籤


1) 格式化時指定塊的大小


[[email protected] ~]# mkfs.ext4 -b 1024 /dev/sdb2


[[email protected] ~]# dumpe2fs -h /dev/sdb2 | grep Block
dumpe2fs 1.41.12 (17-May-2010)
Block count:              208844
Block size:               1024
Blocks per group:         8192


2) 格式化時指定分區的標籤(卷標)
[[email protected] ~]# mkfs.ext4 -L data /dev/sdb2


查看分區的卷標
[[email protected] ~]# e2label /dev/sdb2
data

 

2.掛載

掛載的目的:

 通過掛載點,提供訪問裝置的介面

 

1) mount命令
——查看當前掛載情況
 [[email protected] ~]# mount
 /dev/sda2 on / type ext4 (rw)
 proc on /proc type proc (rw)
 sysfs on /sys type sysfs (rw)
——查看掛載的時候顯示分區的標籤
 [[email protected] ~]# mount -l

 

2) mount掛載
 文法格式
  mount [-fnrsvw] [-t vfstype] [-o options] device dir


 掛載選項
  async——非同步
  sync——同步
  atime——訪問時間
  noatime——不更改訪問時間
  auto——自動
  defaults—— rw, suid, dev, exec, auto,  nouser,  async,and relatime.
  remount——重新掛載


 舉例子:
  [[email protected] ~]# mount -t ext4 -o ro /dev/sdb2 /mnt/sdb2
  [[email protected] ~]# mount | grep sdb
  /dev/sdb2 on /mnt/sdb2 type ext4 (ro)
  [[email protected] ~]# cd /mnt/sdb2/
  [[email protected] sdb2]# ls
  lost+found
  [[email protected] sdb2]# touch abc
  touch: cannot touch `abc‘: Read-only file system
  [[email protected] sdb2]# cd
  [[email protected] ~]# mount -o rw,remount /dev/sdb2
  [[email protected] ~]# cd /mnt/sdb2/
  [[email protected] sdb2]# ls
  lost+found
  [[email protected] sdb2]# touch a
  [[email protected] sdb2]# ls
  a  lost+found

 

本文出自 “空穀幽蘭” 部落格,請務必保留此出處http://2489843.blog.51cto.com/2479843/1671276

Linux營運系統工程師系列---22

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.