如何新增加磁盤分區掛載

新增磁盤和分區掛載我們先要了解fdisk的參數以及菜單的操作說明,下面是fdisk的參數說明:
?fdisk參數說明:
m :顯示菜單和幫助信息
a :活動分區標記/引導分區
d :刪除分區
l :顯示分區類型
n :新建分區
p :顯示分區信息
q :退出不保存
t :設置分區號
v :進行分區檢查
w :保存修改
x :擴展應用,高級功能
1 ?查看磁盤分區:
[root@localhost ~]# fdisk -l ? ??
Disk /dev/sda: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 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: 0x0002faa0
Device Boot Start End Blocks Id System
/dev/sda1 * 1 26 204800 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 26 52 204800 83 Linux
Partition 2 does not end on cylinder boundary.
/dev/sda3 52 26109 209304576 83 Linux
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: 0x00000000
·
2 ? 新增加硬盤分區
root@localhost ~]# fdisk /dev/sdb ? ? ? ? ? ?#(進到磁盤分區)
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xd4339e72.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won’t be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It’s strongly recommended to
switch off the mode (command ‘c’) and change display units to
Command (m for help): n ? ? ? ? ? ?#(輸入新加硬盤分區命令n 說明:n為添加磁盤分命令)
Command action ? ? ? ? ?#(e為擴展分區 p主分區)
e extended
p primary partition (1-4)
p
Partition number (1-4): 1 ? ? ? ?#(輸入1 增加第一塊磁盤分區表)
First cylinder (1-2610, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610): (默認大?。?/span>
Using default value 2610 sectors (command ‘u’).
Command (m for help): w ? ? ?#(輸入w 保存退出)
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
3 ?確認新增加磁盤分區
[root@localhost ~]# fdisk -l? ? ? (查看新增加磁盤分區結果)
Disk /dev/sda: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 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: 0x0002faa0
Device Boot Start End Blocks Id System
/dev/sda1 * 1 26 204800 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 26 52 204800 83 Linux
Partition 2 does not end on cylinder boundary.
/dev/sda3 52 26109 209304576 83 Linux
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: 0xd4339e72
Device Boot Start End Blocks Id System
/dev/sdb1 1 2610 20964793+ 83 Linux ? ? ? ? ? ? #(成功分區)
4 ? 格式化磁盤
[root@localhost ~]# mkfs.ext4 /dev/sdb1 ? ? ? ? ? ? #(格式化新加磁盤/dev/sdb1 )
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1310720 inodes, 5241198 blocks
262059 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
160 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
5 ? 創建磁盤掛載節點
[root@localhost /]# mkdir data
6 ? 掛載磁盤
root@localhost /]# mount /dev/sdb1 data
7 ? 自動掛載
[root@localhost ~]# vim /etc/fstab
[root@localhost ~]# vim /etc/fstab
# /etc/fstab
# Created by anaconda on Tue Mar 13 18:59:31 2018
#
# Accessible filesystems, by reference, are maintained under ‘/dev/disk’
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=85ea0a44-7e35-43e7-bb61-a191f9a89065 / ext4 defaults 1 1
UUID=02777557-2f20-4794-8f83-78bf35b46575 /boot ext4 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/sdb1 /data
輸入reboot關機重啟
? ? ? 注 :以上紅色字體為步驟說明??黃色字體為命令 ? 紫色 字體為備注說明。

本文來自投稿,不代表Linux運維部落立場,如若轉載,請注明出處:http://www.www58058.com/93020

(3)
xiangyangxiangyang
上一篇 2018-03-26
下一篇 2018-03-26

相關推薦

  • 7月21號:CentOS6.8(及7)基礎配置項+Linux入門(1)

    7月21號,馬哥第二天,主要內容有三個部分:一、基本命令復習二、CentOS6.8(及7)基礎配置項;三、linux入門(1) 一、基本命令復習    ls         查看文件內容  l查看文件詳細信息  -a顯示包含隱藏文…

    Linux干貨 2016-08-05
  • 修改文件的權限

        linux中一切皆文件,文件有權限,所有者,所屬組,大小等屬性。文件所有者是指創建文件的用戶,所屬組是指創建文件的用戶屬于哪一個主要的組(用戶的主組只能有一個)。     用戶對文件進行各種操作的前提是有相應的權限,所以有些文件我們只能讀,不能寫,而有些文件既可以讀寫,還可以更改內容,下面就…

    2017-07-30
  • N-22-南京-修 第三周博客作業

    #1、列出當前系統上所有已經登錄的用戶的用戶名,注意:同一個用戶登錄多次,則只顯示一次即可。 [xujie@localhost ~]$ who | cut -d " " -f1 | sort -u #2、取出最后登錄到當前系統的用戶的相關信息。 [root@localhost xujie]# last -x | head -1 #3、取出…

    Linux干貨 2016-09-15
  • 計劃任務與啟動流程

    一、任務計劃 未來的某時間點執行一次任務:    at:在指定的時間執行任務    batch:系統自行選擇空閑時間去執行此處指定的任務周期性運行某任務:    cron:在指定的時間執行任務 1、at任務at [option] TIME  常用選項:&nbs…

    Linux干貨 2016-09-13
  • 初識varnish

      實驗拓撲 varnish主機    地址192.168.150.137 后端web主機     web1靜態服務192.168.150.138     web2動態服務192.168.150.140 varnish的安裝及開啟 varnish主機: ~]# yum info varni…

    Linux干貨 2017-01-05
  • linux作業管理和任務計劃

    一、作業管理 Linux 的作業控制     前臺作業:通過終端啟動,且啟動后一直占據終端;     后臺作業:可通過終端啟動,但啟動后即轉入后臺運行(釋放終端) 如何讓作業運行于后臺? (1)  運行中的作業: Ctrl+z (2)&nb…

    Linux干貨 2016-09-13

評論列表(1條)

  • 兜兜
    兜兜 2018-03-26 20:13

    哇塞膜拜膜拜

欧美性久久久久