[root@hadoop04-184 ~]# fdisk -l Disk /dev/sdb: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x7f7d07a7Device Boot Start End Blocks Id SystemDisk /dev/sda: 53.7 GB, 53687091200 bytes, 104857600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000e6745Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 104857599 51379200 8e Linux LVMDisk /dev/mapper/centos-root: 50.5 GB, 50457477120 bytes, 98549760 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytesDisk /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes[root@hadoop04-184 ~]# fdisk /dev/sdb //我們來給/dev/sdb 分區(qū)
Welcome to fdisk (util-linux 2.23.2).Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.Command (m for help): m
Command actiona toggle a bootable flagb edit bsd disklabel c toggle the dos compatibility flagd delete a partition *(刪除一個分區(qū))l list known partition types (和ls -l的意思一樣的 列出分區(qū)的類型)m print this menu *(打印菜單 就是查看幫助)n add a new partition *(new 創(chuàng)建一個分區(qū))o create a new empty DOS partition tablep print the partition table *(print打印分區(qū)表)q quit without saving changes *(quit 退出不保存)s create a new empty Sun disklabel (創(chuàng)建一個新的空的sun )t change a partition's system id *(改變一個分區(qū)的系統(tǒng)id)u change display/entry unitsv verify the partition tablew write table to disk and exit *(保存并退出)x extra functionality (experts only)Command (m for help): p Disk /dev/sdb: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x7f7d07a7Device Boot Start End Blocks Id SystemCommand (m for help): n
Partition type:e extended 擴(kuò)展分區(qū)p primary partition (1-4) 主分區(qū)接下來選擇pPartition number (1-4): 1 第一塊分區(qū)的名字
First sector (2048-2097151, default 2048): 這里直接回車表示默認(rèn)從2048扇區(qū)開始
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-2097151, default 2097151): //直接回車把所有的都給1Command (m for help): pDisk /dev/sdb: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x7f7d07a7Device Boot Start End Blocks Id System
/dev/sdb1 2048 209715199 104856576 83 Linux
Command (m for help): w //保存退出
The partition table has been altered!Calling ioctl() to re-read partition table.
Syncing disks. [root@hadoop04-184 ~]# partprobe /dev/sdb (這里命令是告訴linux內(nèi)核,我們修改了你的分區(qū)表)partprobe - inform the OS of partition table changes
通知操作系統(tǒng)分區(qū)表的變化,不執(zhí)行這個命令就需要重新啟動操作系統(tǒng) ,執(zhí)行了這個命令就不需要了。
在centos6.5系統(tǒng)中[root@hdfs-node02-90-149--22 /etc/yum.repos.d]# partprobe /dev/sdb -bash: partprobe: command not found 解決方法:參考鏈接為:https://blog.51cto.com/tonychiu/326592
[root@server1 ~]# partprobe
-bash: partprobe: command not found
[root@server1 ~]# yum -y install parted
[root@server1 ~]# partprobe
分區(qū)好了,接下來就是格式化 接下來格式化,創(chuàng)建文件系統(tǒng)。
[root@hadoop04-184 ~]# mkfs
mkfs mkfs.btrfs mkfs.cramfs mkfs.ext2 mkfs.ext3 mkfs.ext4 mkfs.minix mkfs.xfs
[root@hadoop04-184 ~]# mkfs.xfs /dev/sdb1
這里命令就是可視化,指定文件系統(tǒng)的類型為xfs
...
...
...[root@hadoop04-184 ~]# tune2fs -c -1 /dev/sdb1 (不讓他檢查的意思) [root@linux6 ~]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda3 ext4 7.1G 1.6G 5.1G 25% /
tmpfs tmpfs 491M 0 491M 0% /dev/shm
/dev/sda1 ext4 194M 29M 155M 16% /boot
[root@linux6 /]# cd mnt/
[root@linux6 mnt]# ll
total 0
[root@linux6 mnt]# mkdir data1 (創(chuàng)建掛載點(diǎn))
[root@linux6 mnt]# ll
total 4
drwxr-xr-x. 2 root root 4096 2017-12-21 15:53 data1
[root@linux6 mnt]# cd ~
[root@linux6 ~]# mount /dev/sdb1 /mnt/data1/ (掛載上去)
[root@linux6 ~]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda3 ext4 7.1G 1.6G 5.1G 25% /
tmpfs tmpfs 491M 0 491M 0% /dev/shm
/dev/sda1 ext4 194M 29M 155M 16% /boot
/dev/sdb1 ext4 16M 1.2M 14M 8% /mnt/data1
[root@linux6 ~]# cd /mnt/data1/
[root@linux6 data1]# touch majihui.txt
[root@linux6 data1]# echo "i love datcent" > majihui.txt
[root@linux6 data1]# cat majihui.txt
i love datcent