在现有的Linux 系统上添加新的磁盘
今天上午,因为练习需要,我想要装一个Oracle 12R2的数据库,软件也下载了,也上传到虚拟机了,解压的时候,发现解压失败,因为磁盘空间满了,没法解压了,但是这不能阻挡我想要装数据库的动力,所以我就想着在linux系统上添加额外的磁盘。其实这种问题,很多朋友都遇到过这样问题,自己的虚拟机用着用着,忽然发现没有空间了,但是还必须用,这怎么办呢,就必须在现有的linux系统上添加新的磁盘,所以我就总结一下,方便大家的使用。
在当前的我这个环境中,我必须首先把我当前的虚拟机关机,然后添加硬盘。我用的是VMware Workstation虚拟计算机软件。关机之后,设备--硬盘,左下方“添加”,进入添加硬件向导中,硬盘--默认第二个scsi接口类型--模式,独立永久--创建新虚拟机磁盘--磁盘大小,这个根据自己需要多大,就建立多大,我这里设置10G,在选择第三个将虚拟磁盘拆分多个文件--完成。再打开计算机,下面就具体进入怎么添加磁盘了
1、fdisk-l
这个命令会列出当前分区和配置。
[root@cql ~]# fdisk -l
Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000e3d27
Device Boot Start End Blocks Id System
/dev/sda1 1 914 7340032 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 914 1437 4194304 82 Linux swap / Solaris
/dev/sda3 * 1437 2611 9436160 83 Linux
Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
/dev/sdb就是我新添加的硬盘
2、分区
[root@cql ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x902f648a.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
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): m ###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): n #####新建
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1305, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1305, default 1305): +10G
Value out of range.
Last cylinder, +cylinders or +size{K,M,G} (1-1305, default 1305): +9G
Command (m for help): w ######保存和退出
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
验证
[root@cql ~]# fdisk -l
Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000e3d27
Device Boot Start End Blocks Id System
/dev/sda1 1 914 7340032 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 914 1437 4194304 82 Linux swap / Solaris
/dev/sda3 * 1437 2611 9436160 83 Linux
Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x902f648a
Device Boot Start End Blocks Id System
/dev/sdb1 1 1176 9446188+ 83 Linux
3、格式化
首先确定我当前的文件系统都是什么类型的,这里可以看到都是ext3日志类型的
[root@cql ~]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda3 ext3 8.9G 4.0G 4.5G 48% /
tmpfs tmpfs 931M 72K 931M 1% /dev/shm
/dev/sda1 ext3 6.9G 3.4G 3.2G 52% /u01
格式化
[root@cql ~]# mkfs.ext3 /dev/sdb1
mke2fs 1.41.12 (17-May-2010)
文件系统标签=
操作系统:Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
591008 inodes, 2361547 blocks
118077 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=2420113408
73 block groups
32768 blocks per group, 32768 fragments per group
8096 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
正在写入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.
4、挂在分区
[root@cql ~]# mount /dev/sdb1 /u01
查看
[root@cql ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 8.9G 4.0G 4.5G 48% /
tmpfs 931M 224K 931M 1% /dev/shm
/dev/sda1 8.9G 149M 8.3G 2% /u01
/dev/sr0 3.6G 3.6G 0 100% /media/RHEL_6.5 x86_64 Disc 1
/dev/sdb1 8.9G 149M 8.3G 2% /u01
5、加入开机自动
我是通过修改/etc/fstab文件,加入开机自动的,反正方法各种各样,都可以的,随自己的心情~
5.1首先查看分区的UUID
[root@cql ~]# sudo blkid
/dev/sda3: UUID="16046051-6a05-4e6b-b5d2-b64258f5e6d2" TYPE="ext3"
/dev/sda1: UUID="1573581f-e2d5-4f7c-a2de-da6e0eb94359" TYPE="ext3"
/dev/sda2: UUID="a0b44529-1476-4cd7-a009-51b879ba163a" TYPE="swap"
/dev/sdb1: UUID="f124b1f5-16df-4d68-bdc4-41aa08562111" TYPE="ext3"
5.2编辑
[root@cql ~]# vi /etc/fstab
#
# /etc/fstab
# Created by anaconda on Sun Sep 17 22:40:58 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=16046051-6a05-4e6b-b5d2-b64258f5e6d2 / ext3 defaults 1 1
UUID=1573581f-e2d5-4f7c-a2de-da6e0eb94359 /u01 ext3 defaults 1 2
UUID=a0b44529-1476-4cd7-a009-51b879ba163a swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
UUID=f124b1f5-16df-4d68-bdc4-41aa08562111 /u01 ext3 defaults 1 2
~
"/etc/fstab" 16L, 899C written
[root@cql ~]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Sun Sep 17 22:40:58 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=16046051-6a05-4e6b-b5d2-b64258f5e6d2 / ext3 defaults 1 1
UUID=1573581f-e2d5-4f7c-a2de-da6e0eb94359 /u01 ext3 defaults 1 2
UUID=a0b44529-1476-4cd7-a009-51b879ba163a swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
UUID=f124b1f5-16df-4d68-bdc4-41aa08562111 /u01 ext3 defaults 1 2
5.3重启,确认结果~
[root@cql ~]# reboot
Broadcast message from root@cql
(/dev/pts/3) at 21:50 ...
The system is going down for reboot NOW!
[root@cql ~]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda3 ext3 8.9G 4.0G 4.5G 48% /
tmpfs tmpfs 931M 72K 931M 1% /dev/shm
/dev/sda1 ext3 8.9G 149M 8.3G 2% /u01
/dev/sdb1 ext3 8.9G 149M 8.3G 2% /u01
OK!

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。
持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。
转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。
- 上一篇
linux命令格式和常用命令
Linxu命令使用格式 ~]#COMMAND OPTIONS ARGUMENTS CMMMAND:发起一命令:请求内核将某个二进制程序运行为一个进程; OPTIONS:指定命令的运行特性; 短选项:-C, 例如-l, -d 注意:有些命令的选项没有-; 如果同一命令同时使用多个短选项,多数可合并:-l -d = -ld 长选项:--word, 例如--help, --human-readable 注意:长选项不能合并; ARGUMENTS:命令的作用对象;命令对什么生效; 注意:不同的命令的参数;有些命令可同时带多个参数,多个之间以空白字符分隔; 例如:ls -ld /var /etc linux常用命令 ifconfig ifconfig被用于配置和显示Linux内核中网络接口的网络参数。用ifconfig命令配置的网卡信息,在网卡重启后机器重启后,配置就不存在。要想将上述的配置信息永远的存的电脑里,那就要修改网卡的配置文件了。 语法 ifconfig (参数) 实例 ifconfig -a :显示所有网卡配置 [root@localhost ~]# ifconfig -a e...
- 下一篇
红帽Linux迎来25岁生日 未来将着眼云和容器技术
如今,Linux 和开源软件无处不在,然而,在 25 年前,Linux 还是个名不见经传的业余操作系统。据了解,Linux 的发展离不开 Red Hat 的推动。红帽联合创始人鲍勃杨(Bob Young)曾经从事打字机租赁业务,他对 Linux 很感兴趣。 1993 年,他创立了 ACC 公司,一家销售 Slackware Linux CD 和开源软件的公司。 Young 回忆说:“那时,Solaris 比 Linux 要好得多,但只有使用 Linux 才能调整操作系统以满足他们的需求。”当时, Young 意识到 Linux 的买点不在于它比其他操作系统更好更快,或者拥有比 Unix 更多的功能,而在于:用户可以对它进行调整来满足他们的需求。 这在今天也仍然是它的重要特点。 因此,他与 Linux 开发人员 Marc Ewing 合作,像其他早期的 Linux 企业一样,红帽开始销售磁盘,然后是服务器,服务和 CD。 Young 在接受采访时说:“我喜欢它的发展历程,它吸引了许多来自自由软件/开放源代码社区的伟大贡献者,包括 Stallman,Torvalds,Marc 和 Matt...
相关文章
文章评论
共有0条评论来说两句吧...
文章二维码
点击排行
推荐阅读
最新文章
- Eclipse初始化配置,告别卡顿、闪退、编译时间过长
- MySQL8.0.19开启GTID主从同步CentOS8
- CentOS8,CentOS7,CentOS6编译安装Redis5.0.7
- CentOS7编译安装Cmake3.16.3,解决mysql等软件编译问题
- Springboot2将连接池hikari替换为druid,体验最强大的数据库连接池
- 设置Eclipse缩进为4个空格,增强代码规范
- CentOS7,CentOS8安装Elasticsearch6.8.6
- CentOS8编译安装MySQL8.0.19
- SpringBoot2整合MyBatis,连接MySql数据库做增删改查操作
- CentOS6,CentOS7官方镜像安装Oracle11G