Linux上添加新硬盘的实例介绍
在Linux上添加新硬盘的实例讲解,有需要的朋友可以看看。
系统:Redhat AS3 UP3
硬盘:scsi
注意:# 表示是root用户执行的命令
[root@cncmail data1]# fdisk -l ## 这里是查看目前系统上有几块硬盘
Disk /dev/sda: 36.4 GB, 36401479680 bytes
255 heads, 63 sectors/track, 4425 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 255 2048256 83 Linux
/dev/sda2 256 1530 10241437+ 83 Linux
/dev/sda3 4296 4425 1044225 82 Linux swap
/dev/sda4 1531 4295 22209862+ f Win95 Ext'd (LBA)
/dev/sda5 1531 2805 10241406 83 Linux
/dev/sda6 2806 4295 11968393+ 83 Linux
Partition table entries are not in disk order
Disk /dev/sdb: 36.7 GB, 36703918080 bytes ## 这里发现/dev/sdb,容量36.7G,切未被分区
255 heads, 63 sectors/track, 4462 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdc doesn't contain a valid partition table
[root@linux root]# fdisk /dev/sdb ## 接下去就对/dev/sdb分区进行分区
The number of cylinders for this disk is set to 4462.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
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
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): p ## 打印出目前该硬盘下的分区列表
Disk /dev/sdb: 36.7 GB, 36703918080 bytes
255 heads, 63 sectors/track, 4462 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
Command (m for help): n ## 增加一个分区
Command action
e extended
p primary partition (1-4)
## 因为通常选择主分区,所以这里打一个p
p
Partition number (1-4): 1 ## 这里因为是第一个分却,所以只选择1,如果是第二个分区,则选择2,依次类推
First cylinder (1-4462, default 1): ## 新分区起始的磁盘块数
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-4462, default 4462):
如果要分区10G,这里可以直接输入:+10240M,因为这里要全部使用硬盘空间,则用默认
Using default value 4462
Command (m for help): p
Disk /dev/sdb: 36.7 GB, 36703918080 bytes
255 heads, 63 sectors/track, 4462 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 4462 35840983+ 83 Linux
## 这里第一个分区已经分好了,接下去得把这个分区写入硬盘,用w
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
对该硬盘进行格式,这里是格式化成ext3
[root@linux root]# mke2fs -j /dev/sdb1
mke2fs 1.32 (09-Nov-2002)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
4480448 inodes, 8960245 blocks
448012 blocks (5.00%) reserved for the super user
First data block=0
274 block groups
32768 blocks per group, 32768 fragments per group
16352 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 23 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
检查一下,是否已经格式话好
[root@linux root]# fdisk -l
Disk /dev/sda: 36.4 GB, 36401479680 bytes
255 heads, 63 sectors/track, 4425 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 255 2048256 83 Linux
/dev/sda2 256 1530 10241437+ 83 Linux
/dev/sda3 4296 4425 1044225 82 Linux swap
/dev/sda4 1531 4295 22209862+ f Win95 Ext'd (LBA)
/dev/sda5 1531 2805 10241406 83 Linux
/dev/sda6 2806 4295 11968393+ 83 Linux
Partition table entries are not in disk order
Disk /dev/sdb: 36.7 GB, 36703918080 bytes
255 heads, 63 sectors/track, 4462 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 4462 35840983+ 83 Linux
分区分好,也格式化好了,下面就是挂载
我把/dev/sdb1挂载到/data1下
[root@linux root]# mkdir /data1 ## 首先建立挂载的目录data1
[root@linux root]# vi /etc/fstab ##
修改/etc/fstab,使Linux 系统启动就可以自动挂载,当然也可以用mount命令,这里我习惯用这个!
LABEL=/ / ext3 defaults 1 1
LABEL=/bak /bak ext3 defaults,quota 1 2
/dev/sdb1 /data1 ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
none /proc proc defaults 0 0
none /dev/shm tmpfs defaults 0 0
LABEL=/usr /usr ext3 defaults 1 2
LABEL=/var /var ext3 defaults 1 2
/dev/sda3 swap swap defaults 0 0
/dev/cdrom /mnt/cdrom udf,iso9660 noauto,owner,kudzu,ro 0 0
/dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0
重起后,把linux系统重起一下,查看是否挂载成功:
[root@linux data1]# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/sda1 2.0G 454M 1.4G 25% /
/dev/sda6 12G 53M 11G 1% /bak
/dev/sdb1 34G 33M 32G 1% /data1
none 250M 0 250M 0% /dev/shm
/dev/sda2 9.7G 1.5G 7.7G 17% /usr
/dev/sda5 9.7G 8.6G 559M 95% /var
这里看到/dev/sda6 12G 53M 11G 1% /bak
说明已经挂载成功。
Linux上添加新硬盘的实例介绍的更多相关文章
- Linux虚拟机添加新硬盘的全程图解
查看网的文章,我将在vm虚拟机LinuxRedhat中添加一个新的硬盘, 过程大致如下: 1.选择"VM"----"setting"并打开,将光标定位在hard ...
- Linux命令-添加新硬盘,分区及挂载[转]
http://www.cnblogs.com/qiyebao/p/4484370.html 转自:http://blog.chinaunix.net/uid-25829053-id-3067619.h ...
- Linux下添加新硬盘,分区及挂载(转)
挂载好新硬盘后输入fdisk -l命令看当前磁盘信息,卸载硬盘分区 umount /dev/sdb 可以看到除了当前的第一块硬盘外还有一块sdb的第二块硬盘,然后用fdisk /dev/sdb 进行分 ...
- Linux下添加新硬盘,分区及挂载
挂载好新硬盘后输入fdisk -l命令看当前磁盘信息 可以看到除了当前的第一块硬盘外还有一块sdb的第二块硬盘,然后用fdisk /dev/sdb 进行分区 进入fdisk命令,输入h可以看到该命令的 ...
- 【转】Linux下添加新硬盘,分区及挂载
原文:http://blog.chinaunix.net/uid-25829053-id-3067619.html ------------------------------------------ ...
- linux,添加新硬盘的方法
一.物理机添加一块新的硬盘方法(目的是把后加的磁盘直接加在现有的上面,不用再分区挂载)1.首先要确定现有系统在那块盘上 [root@localhost ~]# df -lhFilesystem ...
- Linux中添加新硬盘后对硬盘的分区以及挂载
转自:https://www.linuxidc.com/Linux/2018-06/152958.htm 我将使用VM来进行模拟 先使用df看下我的电脑硬盘信息: df -h 可以看到只有一个sda1 ...
- linux系统下添加新硬盘的方法详解
对于linux新手来说,在linux上添加新硬盘,是很有挑战性的一项工作. 在Linux服务器上把硬盘接好,启动linux,以root登陆. fdisk -l ## 这里是查看目前系统上有几块硬盘 D ...
- CentOS系统在不重启的情况下为虚拟机添加新硬盘
一.概述 用过虚拟机的都知道,如果在系统运行的时候去给虚拟机添加一块新设备,比如说硬盘,系统是读取不到这个新硬盘的,因为系统在启动的时候会去检测硬件设备.但是我们也可能会遇到这样的情况,比如正在运行比 ...
随机推荐
- ZH奶酪:Linux/Ubuntu 安装/卸载 软件
1.安装.deb文件 以安装Chrome为例: (1)到官方网站下载Chrome浏览器相应版本,比如google-chrome-stable_current_i386.deb: (2)Ctrl+Alt ...
- base64 图片编码之再优化
首先进入网站: http://b64.io/ 最多可减少图片体积容量近70%,建议不要优化base 64 图片格式为gif , 已实测如果用gif的话会增加容量.
- html5开放资料
http://www.cnblogs.com/tim-li/archive/2012/08/06/2580252.html KineticJS教程(12) 摘要: KineticJS教程(12) 作者 ...
- [转]intellij 13新建javaweb项目并用tomcat 7启动
来自:http://blog.csdn.net/little__zm/article/details/19570535 对intellij不熟,找了很多文章,只这篇最为顺利.其他都有各种各校的问题,先 ...
- PHPCMS详细文件目录结构
PHPCMS详细文件目录结构 根目录 | – api 接口文件目录 | – caches 缓存文件目录 | – configs 系统配置文件目录 | – caches_* 系统缓存目录 ...
- notify notifyAll 死锁
从一个死锁分析wait,notify,notifyAll 泡芙掠夺者 关注 2017.08.24 22:00* 字数 1361 阅读 249评论 3喜欢 7赞赏 1 本文通过wait(),notify ...
- 【Oracle】查询字段的长度、类型、精度、注释等信息
查询数据字典中字段的相关信息 SELECT T .column_name AS column_name, --列名 T .column_type AS column_type, ---字段类型 T . ...
- 自定义AppServer
TelnetSever.cs public class TelnetServer : AppServer<TelnetSession> { protected override bool ...
- MONyog_5.6.9.0 key激活|监控MYSQL
SQLyog与MONyog是一家公司对mysql推出的商业化软件,可能大家对SQLyog很熟悉,MONyog是对mysql-server服务的监控. 脚本执行时长.安全性.等的监控! key:a668 ...
- ORACLE—005:创建JOB(一)
JOB在实际应用中.使用非常多.一般用户定时运行某些函数,存储过程等. 以下看看怎样创建并启动JOB. 比如,使用job定时运行某个存储过程. 存储过程名:Pro_Test_JOB 运行间隔:2小时, ...