国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統(tǒng) > Linux > 正文

Linux系統(tǒng)硬盤分區(qū) 格式化 掛載的方法推薦

2024-08-27 23:55:38
字體:
供稿:網(wǎng)友
  在windows中安裝好硬盤之后我們只要分區(qū)與格式化就可以了,但在linux中還要多一步硬盤掛載了,下面本文章就全面的介紹linux下安裝一塊磁盤的過程,其實就包括了硬盤分區(qū) 格式化 掛載,希望文章能幫助到各位.
 
  1.添加磁盤,查看磁盤狀況,代碼如下:
 
  [root@db1 /]# fdisk -l
  Disk /dev/sda: 10.7 GB, 10737418240 bytes
  255 heads, 63 sectors/track, 1305 cylinders
  Units = cylinders of 16065 * 512 = 8225280 bytes
     Device Boot      Start         End      Blocks   Id  System
  /dev/sda1   *         151        1305     9277537+  83  Linux
  /dev/sda2               1         150     1204843+  82  Linux swap
  Partition table entries are not in disk order
  Disk /dev/sdb: 5368 MB, 5368709120 bytes
  255 heads, 63 sectors/track, 652 cylinders
  Units = cylinders of 16065 * 512 = 8225280 bytes
     Device Boot      Start         End      Blocks   Id  System
  從查詢結(jié)果看出,多了一個/dev/sdb的盤.
 
  2.用fdisk 對/dev/sdb 進行分區(qū),代碼如下:
 
  [root@db1 /]# fdisk /dev/sdb
  Command (m for help): n
  Command action
     e   extended
     p   primary partition (1-4)
  p
  Partition number (1-4): 1
  First cylinder (1-652, default 1):
  Using default value 1
  Last cylinder or +size or +sizeM or +sizeK (1-652, default 652):
  Using default value 652
  
  Command (m for help): w
  The partition table has been altered!
  
  Calling ioctl() to re-read partition table.
  Syncing disks.
  再次查看分區(qū)情況,多出來一個/dev/sdb1 的區(qū),這個1是我們在前面指定的,如果我們指定2,就變成 sdb2了,代碼如下:
 
  [root@db1 /]# fdisk -l
  
  Disk /dev/sda: 10.7 GB, 10737418240 bytes
  255 heads, 63 sectors/track, 1305 cylinders
  Units = cylinders of 16065 * 512 = 8225280 bytes
     Device Boot      Start         End      Blocks   Id  System
  /dev/sda1   *         151        1305     9277537+  83  Linux
  /dev/sda2               1         150     1204843+  82  Linux swap
  Partition table entries are not in disk order
  
  Disk /dev/sdb: 5368 MB, 5368709120 bytes
  255 heads, 63 sectors/track, 652 cylinders
  Units = cylinders of 16065 * 512 = 8225280 bytes
  
     Device Boot      Start         End      Blocks   Id  System
  /dev/sdb1               1         652     5237158+  83  Linux
  [root@db1 /]#
  3.格式化 /dev/sdb1 分區(qū),代碼如下:
 
  [root@db1 /]# mkfs -t ext3 /dev/sdb1
  mke2fs 1.35 (28-Feb-2004)
  Filesystem label=
  OS type: Linux
  Block size=4096 (log=2)
  Fragment size=4096 (log=2)
  655360 inodes, 1309289 blocks
  65464 blocks (5.00%) reserved for the super user
  First data block=0
  Maximum filesystem blocks=1342177280
  40 block groups
  32768 blocks per group, 32768 fragments per group
  16384 inodes per group
  Superblock backups stored on blocks:
          32768, 98304, 163840, 229376, 294912, 819200, 884736
  
  Writing inode tables: done
  Creating journal (8192 blocks): done
  Writing superblocks and filesystem accounting information: done
  
  This filesystem will be automatically checked every 30 mounts or
  180 days, whichever comes first.  Use tune2fs -c or -i to override.
  4.創(chuàng)建目錄 并將 /dev/sdb1 掛在到該目錄下,代碼如下:
 
  [root@db1 /]# ls
  backup  dev   initrd      media  opt   sbin     sys       usr
  bin     etc   lib         misc   proc  selinux  tftpboot  var
  boot    home  lost+found  mnt    root  srv      tmp
  [root@db1 /]# mkdir /u01
  [root@db1 /]# ls
  backup  dev   initrd      media  opt   sbin     sys       u01
  bin     etc   lib         misc   proc  selinux  tftpboot  usr
  boot    home  lost+found  mnt    root  srv      tmp       var
  [root@db1 /]# mount /dev/sdb1 /u01
  5.驗證掛載是否成功,代碼如下:
 
  [root@db1 /]# df -k
  Filesystem           1K-blocks      Used Available Use% Mounted on
  /dev/sda1              9131772   7066884   1601012  82% /
  none                    454256         0    454256   0% /dev/shm
  /dev/sdb1              5154852     43040   4849956   1% /backup
  6.設(shè)置開機自動掛載,代碼如下:
 
  [root@db1 /]# vi /etc/fstab
  # This file is edited by fstab-sync - see ’man fstab-sync’ for details
  LABEL=/                 /                       ext3    defaults        1 1
  none                    /dev/pts                devpts  gid=5,mode=620  0 0
  none                    /dev/shm                tmpfs   defaults        0 0
  none                    /proc                   proc    defaults        0 0
  none                    /sys                    sysfs   defaults        0 0
  LABEL=SWAP-sda2         swap                    swap    defaults        0 0
  /dev/sdb1               /u01                 ext3    defaults        0 0
  /dev/hdc                /media/cdrom            auto    pamconsole,exec,noauto,m
  anaged 0 0   --phpfensi.com
  /dev/fd0                /media/floppy           auto    pamconsole,exec,noauto,m
  anaged 0 0。
 

(編輯:武林網(wǎng))

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 五台县| 澄迈县| 交城县| 定襄县| 梨树县| 高陵县| 中方县| 黄山市| 河南省| 咸丰县| 应用必备| 浠水县| 黄梅县| 耒阳市| 监利县| 延吉市| 进贤县| 永安市| 家居| 年辖:市辖区| 揭阳市| 榆树市| 涡阳县| 泸西县| 藁城市| 仙游县| 潢川县| 吉隆县| 攀枝花市| 丰县| 长泰县| 金湖县| 安康市| 勐海县| 哈尔滨市| 双辽市| 建昌县| 涟源市| 嘉鱼县| 北海市| 资中县|