日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > linux >内容正文

linux

Linux系列之fdisk 分区挂盘

發(fā)布時間:2025/3/17 linux 39 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Linux系列之fdisk 分区挂盘 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

2019/3/28 星期四
Linux系列之fdisk 分區(qū)掛盤

[root@hadoop04-184 ~]# df -Th Filesystem Type Size Used Avail Use% Mounted on /dev/mapper/centos-root xfs 47G 8.3G 39G 18% / devtmpfs devtmpfs 3.9G 0 3.9G 0% /dev tmpfs tmpfs 3.9G 0 3.9G 0% /dev/shm tmpfs tmpfs 3.9G 8.9M 3.9G 1% /run tmpfs tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup /dev/sda1 xfs 1014M 173M 842M 18% /boot tmpfs tmpfs 783M 0 783M 0% /run/user/0

我們的根目錄分配了50G 比較少,我們掛一個/data 盤分給100G

//現(xiàn)在虛擬機(jī)上,掛載硬盤上去
具體操作如下

[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

上面的這個掛載情況,重啟服務(wù)器之后,就沒有了

我們接下里用
掛載可以用設(shè)備也可以用uuid 要想讓他開機(jī)自掛起磁盤的話,就需要在/etc/fstab 上去添加

一般情況下:不用uuid的方法

[root@hadoop04-184 ~]# vim /etc/fstab # # /etc/fstab # Created by anaconda on Wed Jan 16 18:21:38 2019 # # 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 # /dev/mapper/centos-root / xfs defaults,noatime 0 0 UUID=94663c29-d395-4cd0-8cac-1f0d6dea8969 /boot xfs defaults 0 0 /dev/mapper/centos-swap swap swap defaults 0 0 /dev/sdb1 /data xfs defaults,noatime 0 0 然后重啟就好了[root@hadoop04-184 ~]# df -Th Filesystem Type Size Used Avail Use% Mounted on /dev/mapper/centos-root xfs 47G 8.3G 39G 18% / devtmpfs devtmpfs 3.9G 0 3.9G 0% /dev tmpfs tmpfs 3.9G 0 3.9G 0% /dev/shm tmpfs tmpfs 3.9G 8.9M 3.9G 1% /run tmpfs tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup /dev/sda1 xfs 1014M 173M 842M 18% /boot /dev/sdb1 xfs 100G 1.3G 99G 2% /data tmpfs tmpfs 783M 0 783M 0% /run/user/0 cm_processes tmpfs 3.9G 1.4M 3.9G 1% /run/cloudera-scm-agent/process

轉(zhuǎn)載于:https://blog.51cto.com/12445535/2370371

總結(jié)

以上是生活随笔為你收集整理的Linux系列之fdisk 分区挂盘的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。