如何新增加磁盤分區掛載

新增磁盤和分區掛載我們先要了解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 20:07
下一篇 2018-03-26 20:08

相關推薦

  • ?redis cluster 安裝指南

    公司的很多項目在使用redis主從。由于coder的各種毀滅性操作,迫切需要一個能帶故障恢復的架構。因此新版的cluster,開始了測試。 一、Cluster 理論基礎 Cluster介紹 Redis集群是一個提供在多個Redis間節點間共享數據的程序集。 Redis集群并不支持處理多個keys的命令,因為這需要在不同的節點間移動數據,從而達不到像Redis…

    Linux干貨 2016-02-14
  • 無痛之ext3升ext4[原創]

    一臺文件存儲服務器單目錄下子目錄已經突破31998數限制,造成無法繼續創建子目錄,服務器系統環境為CentOS5.4 內核版本為2.6.18。解決方案只能是升級到ext4文件系統,首先到https://ext4.wiki.kernel.org/index.php/Ext4_Howto查了一下資料,文中的第一句便是“Ext4 was released as a…

    Linux干貨 2015-03-27
  • 軟鏈接和硬鏈接的區別

    Linux鏈接概念 Linux鏈接分兩種,一種被稱為硬鏈接(Hard Link),另一種被稱為符號鏈接(Symbolic Link)。 硬鏈接 硬連接指通過索引節點來進行連接。在Linux的文件系統中,保存在磁盤分區中的文件不管是什么類型都給它分配一個編號,稱為索引節點號(Inode Index)。在Linux中,多個文件名指向同一索引節點是存在的。一般這種…

    Linux干貨 2016-10-29
  • RAID,pv,vg,lv的實驗

    首先在虛擬機中添加5塊硬盤,以備實驗使用,此實驗以sdc,sdd,sde,sdf,sdg硬盤為例:     添加硬盤:(不用重新啟動虛擬機讀取新添加磁盤)             ~]# echo “- – -” > /sys/class…

    Linux干貨 2017-03-19
  • linux系統基礎目錄結構及功能說明

    linux系統基礎目錄結構及功能說明 [root@localhost /]# ls bin boot dev etc home host lib lib64 media mnt opt proc root run sbin srv sys tmp usr var /bin:所有用戶可用的基本命令程序文件;/sbin:供系統管理使用的工具程序;/boot:引導…

    Linux干貨 2018-03-04
  • 第9天:壓縮,任務,rpm包

    http://note.youdao.com/yws/public/redirect/share?id=b3e4fc37bdd98991638dce69ce3eea53&type=false

    Linux干貨 2016-08-18

評論列表(1條)

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

    哇塞膜拜膜拜

欧美性久久久久