linux系統磁碟分割之fdisk

來源:互聯網
上載者:User

linux系統磁碟分割之fdisk
 對於學習磁碟分割,通常學習的都是fdisk命令當然,對於小於2TB的磁碟,我們基本上是使用fdisk命令進行分區下面就簡單介紹一下fdisk操作磁碟的基本命令和情境類比常用命令介紹  fdisk -l 查看所有磁碟資訊  fdisk /dev/sdb  使用fdisk命令工具操作/dev/sdb磁碟  m   顯示所有的命令資訊、用法  p   顯示分區資訊  q   退出  w   儲存分區資訊,只有執行了w命令後才會把分區資訊寫入到磁碟  d 1  刪除磁碟的第一個分區情境類比有一個1G的磁碟/dev/sdb分區為一個主要磁碟分割,一個擴充分區,大小都為200M其中在擴充分區上面建立一個100M的邏輯分區 /dev/sdb5格式檔案系統為 mkfs.ext4實現開機自動掛載到目錄 /backup31 使用fdisk命令工具操作磁碟/dev/sdb   fdisk /dev/sdb2 建立一個主要磁碟分割        Command (m for help): n  Command action    e   extended    p   primary partition (1-4) p Partition number (1-4): 1 Using default value 1 Last cylinder, +cylinders or +size{K,M,G} (1-130, default 130): +400M  Command (m for help): p Disk /dev/sdb: 1073 MB, 1073741824 bytes 255 heads, 63 sectors/track, 130 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: 0x0004a98a    Device Boot      Start         End      Blocks   Id  System /dev/sdb1               1          52      417658+  83  Linux3 建立一個擴充分區 Command (m for help): n Command action    e   extended    p   primary partition (1-4) e Partition number (1-4): 2 First cylinder (53-130, default 53): Using default value 53 Last cylinder, +cylinders or +size{K,M,G} (53-130, default 130): +400M Command (m for help): p Disk /dev/sdb: 1073 MB, 1073741824 bytes 255 heads, 63 sectors/track, 130 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: 0x0004a98a    Device Boot      Start         End      Blocks   Id  System /dev/sdb1               1          52      417658+  83  Linux /dev/sdb2              53         104      417690    5  Extended4 建立一個邏輯分區 Command (m for help): n Command action    l   logical (5 or over)    p   primary partition (1-4) l First cylinder (53-104, default 53): Using default value 53 Last cylinder, +cylinders or +size{K,M,G} (53-104, default 104): +100M Command (m for help): p Disk /dev/sdb: 1073 MB, 1073741824 bytes 255 heads, 63 sectors/track, 130 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: 0x0004a98a    Device Boot      Start         End      Blocks   Id  System /dev/sdb1               1          52      417658+  83  Linux /dev/sdb2              53         104      417690    5  Extended /dev/sdb5              53          66      112423+  83  Linux 5 儲存 Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.6 對磁碟進行分區  [root@hsj2 ~]# mkfs.ext4 /dev/sdb1mke2fs 1.41.12 (17-May-2010)Filesystem label=OS type: LinuxBlock size=1024 (log=0)Fragment size=1024 (log=0)Stride=0 blocks, Stripe width=0 blocks104448 inodes, 417656 blocks20882 blocks (5.00%) reserved for the super userFirst data block=1Maximum filesystem blocks=6763315251 block groups8192 blocks per group, 8192 fragments per group2048 inodes per groupSuperblock backups stored on blocks:        8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409Writing inode tables: doneCreating journal (8192 blocks): doneWriting superblocks and filesystem accounting information: doneThis filesystem will be automatically checked every 31 mounts or180 days, whichever comes first.  Use tune2fs -c or -i to override.  [root@hsj2 ~]# mkfs.ext4 /dev/sdb5mke2fs 1.41.12 (17-May-2010)Filesystem label=OS type: LinuxBlock size=1024 (log=0)Fragment size=1024 (log=0)Stride=0 blocks, Stripe width=0 blocks28112 inodes, 112420 blocks5621 blocks (5.00%) reserved for the super userFirst data block=1Maximum filesystem blocks=6737100814 block groups8192 blocks per group, 8192 fragments per group2008 inodes per groupSuperblock backups stored on blocks:        8193, 24577, 40961, 57345, 73729Writing inode tables: doneCreating journal (4096 blocks): doneWriting superblocks and filesystem accounting information: doneThis filesystem will be automatically checked every 31 mounts or180 days, whichever comes first.  Use tune2fs -c or -i to override.ok,搞定
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.