centos7 分区 格式化
1. 查看磁盘
[root@yzb-centos72-3 ~]# fdisk -l
Disk /dev/vda: 32.2 GB, 32212254720 bytes, 62914560 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: 0x0009680e
Device Boot Start End Blocks Id System
/dev/vda1 2048 4194303 2096128 82 Linux swap / Solaris
/dev/vda2 * 4194304 56623103 26214400 83 Linux
Disk /dev/vdb: 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
发现/dev/vdb这块未分区、格式化
2. 分区
[root@yzb-centos72-3 ~]# fdisk /dev/vdb
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.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x20ea1593.
Command (m for help):
输入m 查看
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command (m for help):
输入n
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
输入p
Select (default p): p
一路回车默认
Partition number (1-4, default 1):
First sector (2048-209715199, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-209715199, default 209715199):
Using default value 209715199
Partition 1 of type Linux and of size 100 GiB is set
输入w
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
查看 fdisk -l
已经分好区,但是未格式化
[root@yzb-centos72-3 ~]# fdisk -l
Disk /dev/vda: 32.2 GB, 32212254720 bytes, 62914560 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: 0x0009680e
Device Boot Start End Blocks Id System
/dev/vda1 2048 4194303 2096128 82 Linux swap / Solaris
/dev/vda2 * 4194304 56623103 26214400 83 Linux
Disk /dev/vdb: 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: 0x35bf8022
Device Boot Start End Blocks Id System
/dev/vdb1 2048 209715199 104856576 83 Linux
3. 格式化 mkfs -t ext3 或者 mkfs.ext3
[root@yzb-centos72-3 ~]# mkfs -t ext3 /dev/vdb1
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
6553600 inodes, 26214144 blocks
1310707 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
800 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, 7962624, 11239424, 20480000, 23887872
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
[root@yzb-centos72-3 ~]#
4. 挂载
先在根目录建data
[root@yzb-centos72-3 /]# mkdir data
然后挂载
mount /dev/vdb1 /data
查看挂载后的目录
[root@yzb-centos72-3 /]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/vda2 ext4 25G 3.1G 21G 14% /
devtmpfs devtmpfs 3.9G 0 3.9G 0% /dev
tmpfs tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs tmpfs 3.9G 57M 3.8G 2% /run
tmpfs tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
tmpfs tmpfs 783M 0 783M 0% /run/user/0
/dev/vdb1 ext3 99G 60M 94G 1% /data
将挂载持久化到文件,开机自动挂载
/etc/fstab
vi /etc/fstab
#
# /etc/fstab
# Created by anaconda on Mon Jan 2 22:58:53 2017
#
# 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=381f5199-12a4-4d44-91af-be015a752145 / ext4 defaults 1 1
UUID=4b0d629d-79d8-43e3-82bd-8a7b98fcfb75 swap swap defaults 0 0
/dev/vdb1 /data ext3 defaults 1 1

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。
持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。
转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。
- 上一篇
腾讯云Centos开启IPV6
先看下开启后的效果吧。 [root@VM_centos ~]# ifconfig eth0 Link encap:EthernetHWaddr 52:54:00:341:52 inet addr:10.101.3.185Bcast:10.101.127.255Mask:255.255.192.0 inet6 addr: fe80::5054:ff:fe34:d152/64 Scopeink ------------------------->>>开启成功后会有一列IPV6的地址格式 UP BROADCAST RUNNING MULTICASTMTU:1500Metric:1 RX packets:1010372 errors:0 dropped:0 overruns:0 frame:0 TX packets:423319 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:79625272 (75.9 MiB...
- 下一篇
Linux查找筛选grep命令
Linux系统中grep命令是一种强大的文本搜索工具,它能使用正则表达式搜索文本,并把匹配的行打印出来。grep全称是Global Regular Expression Print,表示全局正则表达式版本,它的使用权限是所有用户。 grep可用于shell脚本,因为grep通过返回一个状态值来说明搜索的状态,如果模板搜索成功,则返回0,如果搜索不成功,则返回1,如果搜索的文件不存在,则返回2。我们利用这些返回值就可进行一些自动化的文本处理工作。 egrep是grep的一个超集,优化了很多操作。 命令格式:grep [option] pattern file -a –text #不要忽略二进制的数据。 -v –revert-match #显示不包含匹配文本的所有行。 -c –count #计算每个文件中符合样式的列数。 -n –line-number #在显示符合样式的那一行之前,标示出该行的列数编号。 -i –ignore-case #忽略字符大小写的差别。 -q –quiet或–silent #不显示任何信息 -s –no-messages #不显示错误信息。 -l –...
相关文章
文章评论
共有0条评论来说两句吧...
文章二维码
点击排行
推荐阅读
最新文章
- SpringBoot2编写第一个Controller,响应你的http请求并返回结果
- CentOS6,7,8上安装Nginx,支持https2.0的开启
- Eclipse初始化配置,告别卡顿、闪退、编译时间过长
- Springboot2将连接池hikari替换为druid,体验最强大的数据库连接池
- CentOS7编译安装Cmake3.16.3,解决mysql等软件编译问题
- Windows10,CentOS7,CentOS8安装Nodejs环境
- 设置Eclipse缩进为4个空格,增强代码规范
- SpringBoot2全家桶,快速入门学习开发网站教程
- CentOS8编译安装MySQL8.0.19
- CentOS8,CentOS7,CentOS6编译安装Redis5.0.7