Linux下磁盘挂载
1.查看是否已分配
[root@localhost ~]# fdisk -l
Disk /dev/vda: 536.9 GB, 536870912000 bytes
16 heads, 63 sectors/track, 1040253 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00062b97
Device Boot Start End Blocks Id System
/dev/vda1 * 3 1018 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/vda2 1018 41611 20458496 8e Linux LVM
Partition 2 does not end on cylinder boundary.
2、发现有磁盘,路径为/dev/vda。然后使用fdisk命令进行分区
[root@localhost ~]# fdisk /dev/vda
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): p
Disk /dev/vda: 536.9 GB, 536870912000 bytes
16 heads, 63 sectors/track, 1040253 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00062b97
Device Boot Start End Blocks Id System
/dev/vda1 * 3 1018 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/vda2 1018 41611 20458496 8e Linux LVM
Partition 2 does not end on cylinder boundary.
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (1-1040253, default 1): 41611
Last cylinder, +cylinders or +size{K,M,G} (41611-1040253, default 1040253): 665776
Command (m for help): p
Disk /dev/vda: 536.9 GB, 536870912000 bytes
16 heads, 63 sectors/track, 1040253 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00062b97
Device Boot Start End Blocks Id System
/dev/vda1 * 3 1018 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/vda2 1018 41611 20458496 8e Linux LVM
Partition 2 does not end on cylinder boundary.
/dev/vda3 41611 665776 314579584 83 Linux
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Selected partition 4
First cylinder (1-1040253, default 1): 4
Sector 3024 is already allocated
First cylinder (665777-1040253, default 665777): 665777
Last cylinder, +cylinders or +size{K,M,G} (665777-1040253, default 1040253):
Using default value 1040253
Command (m for help): p
Disk /dev/vda: 536.9 GB, 536870912000 bytes
16 heads, 63 sectors/track, 1040253 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00062b97
Device Boot Start End Blocks Id System
/dev/vda1 * 3 1018 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/vda2 1018 41611 20458496 8e Linux LVM
Partition 2 does not end on cylinder boundary.
/dev/vda3 41611 665776 314579584 83 Linux
/dev/vda4 665777 1040253 188736408 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: 设备或资源忙.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
解释:
Partition number表示分区号,由于1、2号已经分区所有从3号分区开始
其中 n 新建分区 d删除分区 p打印分区 w将表写入磁盘保存并退出
3、然后使用fdisk -l 命令查看,已经新建的分区
[root@localhost ~]# fdisk -l
Disk /dev/vda: 536.9 GB, 536870912000 bytes
16 heads, 63 sectors/track, 1040253 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00062b97
Device Boot Start End Blocks Id System
/dev/vda1 * 3 1018 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/vda2 1018 41611 20458496 8e Linux LVM
Partition 2 does not end on cylinder boundary.
/dev/vda3 41611 665776 314579584 83 Linux
/dev/vda4 665777 1040253 188736408 83 Linux
红色部分为刚刚新建的分区
6.建好分区后对分区进行格式化,建立文件系统 mkfs.ext3
[root@localhost ~]# mkfs.ext3 /dev/vda3
mke2fs 1.41.12 (17-May-2010)
文件系统标签=
操作系统:Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
19668992 inodes, 78644896 blocks
3932244 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=4294967296
2401 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, 71663616
正在写入inode表: 完成
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成
This filesystem will be automatically checked every 29 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@localhost ~]# mkfs.ext3 /dev/vda4
mke2fs 1.41.12 (17-May-2010)
文件系统标签=
操作系统:Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
11796480 inodes, 47184102 blocks
2359205 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=4294967296
1440 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
正在写入inode表: 完成
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成
This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
7.然后mount选择一个挂载点挂上
[root@localhost ~]# mount /dev/vda3 /var
[root@localhost ~]# mount /dev/vda4 /opt
8.使用 df -TH 查看文件大小
[root@localhost ~]# df -TH /opt
Filesystem Type Size Used Avail Use% Mounted on
/dev/vda4 ext3 191G 197M 181G 1% /opt
[root@localhost ~]# df -TH /var
Filesystem Type Size Used Avail Use% Mounted on
/dev/vda3 ext3 318G 201M 301G 1% /var
注意:
如果挂载错误可以使用umount取消挂载,如果找不到分区使用partprobe 刷新分区实在不行就reboot下
使用fdisk -l即可查看新的分区
Linux下磁盘挂载相关推荐
- linux下如何挂载格式化内存卡,Linux下磁盘挂载格式化
Linux下磁盘挂载格式化 [日期:2007-07-11] 来源:Linux公社 作者:Linuxidc [字体:大 中 小] 虚拟机上的 系统磁盘空间不足了的事情很容易发生, 这时可以通过增加虚拟磁 ...
- linux 查看下挂磁盘,linux下磁盘挂载与查看
df查看系统分区和使用情况使用方法:df-h(自动按照大小做单位适应显示)df-i(查看iNode使用情况)free查看.. LABEL defaults默认选项: rw (可读写) sudi ...
- linux系统硬盘设置密码,LUKS:Linux下磁盘加密
Linux下磁盘加密 LUKS(Linux Unified Key Setup)为Linux硬盘加密提供了一种标准,它不仅能通用于不同的Linux发行版本,还支持多用户/口令.因为它的加密密钥独立于口 ...
- Linux下磁盘加密
Linux下磁盘加密 LUKS(Linux Unified Key Setup)为Linux硬盘加密提供了一种标准,它不仅能通用于不同的Linux发行版本,还支持多用户/口令.因为它的加密密钥独立于口 ...
- linux 下的挂载
1.先要确认一下磁盘位置 fdisk -l 如D盘 sda5 U盘 sdb1 比较常用的挂载命令: mount /dev/sdb1 -o iocharset=cp936[utf8] -t vfat ...
- 记一次Linux 下磁盘分配和扩容操作
Linux 下磁盘操作命令 前言 磁盘分区.格式化分区.挂载目录 挂载目录扩容 对原有的磁盘的最后一个分区扩容 对原有的磁盘的剩余空间增加主分区 前言 企业真实场景由于硬盘常年大量读写,经常会出现坏盘 ...
- LINUX下磁盘管理的基本流程与相关操作命令
LINUX下磁盘管理的基本流程与相关操作命令 磁盘的管理 添加磁盘 格式化分区 磁盘挂载 磁盘的管理 在Linux中我们可以通过以下几种方式来查看我们所用的磁盘 (1)df命令: 还可以添加后缀命令( ...
- linux分区管理,Linux下磁盘分区管理
Linux下磁盘分区管理 发布时间:2009-04-11 10:29:37来源:红联作者:lvshengming 在Linux下对IDE的设备是以hd命名的,第一个ide设备是hda,第二个是hdb, ...
- linux下的挂载点和分区是什么关系(详解挂载点)
百度定义: 挂载点实际上就是linux中的磁盘文件系统的入口目录,类似于windows中的用来访问不同分区的C:.D:.E:等盘符.其实winxp也支持将一个磁盘分区挂在一个文件夹下面,只是我们C:. ...
最新文章
- php中的几种跳转语句以及各自的特点,PHP中的跳转语句有且仅有break和continue两个语句。...
- IAR环境下STM32+IAP方案的实现(转)
- 在alv grid中的列中设置icon图标
- q-dir 打不开文件_Q-Dir –多窗格文件管理器
- 博客园随笔添加自己的版权信息 [转]
- python list去重函数_python 列表函数
- 解决vscode中Module ‘torch‘ has no ‘xxx‘ member的烦人错误
- pl2303hxa串口线驱动_Prolific PL2303 USB转串口线驱动
- tampermonkey这玩意如何替换flash播放器为h5播放器?
- 基于扩展卡尔曼滤波的slam
- 如果出现 Cause: java.lang.ClassNotFoundException: Cannot find class: com.itheima.domian.User
- 怎么压缩html的文件,css如何压缩?
- 李春葆《数据结构》第五版
- 对话Digital FUN和TEA社区创始人Totti#MiXTalk004
- 机器学习-常用回归算法归纳(全网之最)
- Python蒙特卡罗法测圆周率
- 启动Mysql时报错:mysqld_safe mysqld from pid file /usr/local/mysql/data/Linux.pid ended
- java毕业设计疫情返乡人员管理系统Mybatis+系统+数据库+调试部署
- 市值从100亿缩水到3亿仅用三年,转型的趣店无“底“可抄?
- 触发器原理与使用方法