位置: 编程技术 - 正文

Linux系统下对硬盘分区进行扩容的方法总结(linux系统对硬件要求高吗)

编辑:rootadmin

推荐整理分享Linux系统下对硬盘分区进行扩容的方法总结(linux系统对硬件要求高吗),希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:linux硬件,linux对硬件的要求,简述在linux中使用硬盘的几个步骤,linux系统对硬件的要求,linux的硬件设备有哪些类型,linux硬件,linux系统对硬件的要求,linux系统对硬件的要求,内容如对您有帮助,希望把文章链接给更多的朋友!

硬盘快满了,加硬盘扩容,不管是独立的服务器,还是云空间新买的硬盘,扩容方式一样。下面以阿里VPS为例,详细说一下,挂载硬盘扩容的2种方法。阿里VPS,个人觉得有以下二个方面需要改进1,默认不是lvm,所以系统盘/dev/xvda1是不能扩容的,所以如果有大数据的东西,一开始就要考虑到扩容的问题。数据量越大,操作风险越大。2,不能实现无缝扩容,也就是说,在后台扩容一下,不用登录到VPS,进行调整。非专业人士,扩容困难

一,不采用lvm,直接将硬盘挂载到目录1,查看硬盘分区情况复制代码代码如下:[root@iZzz3wqciZ ~]# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/xvda1 % / tmpfs 0 0% /dev/shm [root@iZzz3wqciZ ~]# fdisk -l Disk /dev/xvda: .5 GB, bytes heads, sectors/track, cylinders Units = cylinders of * = bytes Sector size (logical/physical): bytes / bytes I/O size (minimum/optimal): bytes / bytes Disk identifier: 0xf9c Device Boot Start End Blocks Id System /dev/xvda1 * 1 Linux //id是,非lvm Disk /dev/xvdb: .6 GB, bytes //新买的硬盘 heads, sectors/track, cylinders Units = cylinders of * = bytes Sector size (logical/physical): bytes / bytes I/O size (minimum/optimal): bytes / bytes Disk identifier: 0xcc1f5a

Linux系统下对硬盘分区进行扩容的方法总结(linux系统对硬件要求高吗)

2,硬盘分区并查看分区情况复制代码代码如下:[root@iZzz3wqciZ ~]# fdisk -S /dev/xvdb //分区 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): n //输入n Command action e extended p primary partition (1-4) p //主分区 Partition number (1-4): 1 //分区号1 First cylinder (1-, default 1): Using default value 1 Last cylinder, +cylinders or +size{K,M,G} (1-, default ): Using default value Command (m for help): wq //保存并退出 The partition table has been altered! [root@iZzz3wqciZ ~]# fdisk -l Disk /dev/xvda: .5 GB, bytes heads, sectors/track, cylinders Units = cylinders of * = bytes Sector size (logical/physical): bytes / bytes I/O size (minimum/optimal): bytes / bytes Disk identifier: 0xf9c Device Boot Start End Blocks Id System /dev/xvda1 * 1 Linux Disk /dev/xvdb: .6 GB, bytes heads, sectors/track, cylinders Units = cylinders of * = bytes Sector size (logical/physical): bytes / bytes I/O size (minimum/optimal): bytes / bytes Disk identifier: 0xcc1f5a Device Boot Start End Blocks Id System /dev/xvdb1 1 Linux //分区后

3,格式化新分区xvdb1复制代码代码如下:[root@iZzz3wqciZ ~]# mkfs.ext4 /dev/xvdb1 //格式化分区 mke2fs 1.. (-May-) Filesystem label= OS type: Linux Block size= (log=2) Fragment size= (log=2) Stride=0 blocks, Stripe width=0 blocks inodes, blocks blocks (5.%) reserved for the super user First data block=0 Maximum filesystem blocks= block groups blocks per group, fragments per group inodes per group Superblock backups stored on blocks: , , , , , , , , , Writing inode tables: done Creating journal ( blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every mounts or days, whichever comes first. Use tune2fs -c or -i to override.

4,创建目录,并挂载分区复制代码代码如下:[root@iZzz3wqciZ ~]# mkdir /mnt/fastdfs //挂载目录 [root@iZzz3wqciZ ~]# echo "/dev/xvdb1 /mnt/fastdfs ext4 defaults 0 0" >> /etc/fstab //重启会自动挂载 [root@iZzz3wqciZ ~]# mount -a //挂载所有目录 [root@iZzz3wqciZ ~]# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/xvda1 % / tmpfs 0 0% /dev/shm /dev/xvdb1 1% /mnt/fastdfs //新的分区已挂载 到这儿,就把一块独立的硬盘加到系统当中了。这种扩容的方式操作简单,但是扩展性不强,不推荐这种扩容方式。

二,采用lvm的方式,进行硬盘扩容(推荐)1,取消前面测试的挂载,并删除分区复制代码代码如下:[root@iZzz3wqciZ ~]# umount -a //取消挂载 [root@iZzz3wqciZ ~]# fdisk /dev/xvdb //分区 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): d //删除分区 Selected partition 1 Command (m for help): wq //保存 The partition table has been altered! 2,安装lvm复制代码代码如下:[root@iZzz3wqciZ nginx]# uname -a //查看内核信息 Linux iZzz3wqciZ 2.6.-..3.el6.x_ #1 SMP Thu Jul :: UTC x_ x_ x_ GNU/Linux [root@iZzz3wqciZ ~]# yum install lvm2 device-mapper //安装 LVM2,2.6.9以后版本不用装device-mapper [root@iZzz3wqciZ nginx]# lsmod | grep dm_mod //是否加载了dm_mod dm_mod 5 dm_mirror,dm_log lvm的安装,首先加载device-mapper模块,从linux内核2.6.9开始,device-mapper模块就已经包含在内,所以你只需加载即可。加载mapper模块:modprobe dm_mod。3,创建lvm分区复制代码代码如下:[root@iZzz3wqciZ ~]# fdisk /dev/xvdb //分区 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): l 0 Empty NEC DOS Minix / old Lin bf Solaris 1 FAT Plan 9 Linux swap / So c1 DRDOS/sec (FAT- 2 XENIX root 3c PartitionMagic Linux c4 DRDOS/sec (FAT- 3 XENIX usr Venix OS/2 hidden C: c6 DRDOS/sec (FAT- 4 FAT <M PPC PReP Boot Linux extended c7 Syrinx 5 Extended SFS NTFS volume set da Non-FS data 6 FAT 4d QNX4.x NTFS volume set db CP/M / CTOS / . 7 HPFS/NTFS 4e QNX4.x 2nd part Linux plaintext de Dell Utility 8 AIX 4f QNX4.x 3rd part 8e Linux LVM df BootIt 9 AIX bootable OnTrack DM Amoeba e1 DOS access a OS/2 Boot Manag OnTrack DM6 Aux Amoeba BBT e3 DOS R/O b W FAT CP/M 9f BSD/OS e4 SpeedStor c W FAT (LBA) OnTrack DM6 Aux a0 IBM Thinkpad hi eb BeOS fs e W FAT (LBA) OnTrackDM6 a5 FreeBSD ee GPT f W Ext'd (LBA) EZ-Drive a6 OpenBSD ef EFI (FAT-// OPUS Golden Bow a7 NeXTSTEP f0 Linux/PA-RISC b Hidden FAT 5c Priam Edisk a8 Darwin UFS f1 SpeedStor Compaq diagnost SpeedStor a9 NetBSD f4 SpeedStor Hidden FAT <3 GNU HURD or Sys ab Darwin boot f2 DOS secondary Hidden FAT Novell Netware af HFS / HFS+ fb VMware VMFS Hidden HPFS/NTF Novell Netware b7 BSDI fs fc VMware VMKCORE AST SmartSleep DiskSecure Mult b8 BSDI swap fd Linux raid auto 1b Hidden W FAT3 PC/IX bb Boot Wizard hid fe LANstep 1c Hidden W FAT3 Old Minix be Solaris boot ff BBT 1e Hidden W FAT1 Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-, default 1): Using default value 1 Last cylinder, +cylinders or +size{K,M,G} (1-, default ): Using default value Command (m for help): p Disk /dev/xvdb: .6 GB, bytes heads, sectors/track, cylinders Units = cylinders of * = bytes Sector size (logical/physical): bytes / bytes I/O size (minimum/optimal): bytes / bytes Disk identifier: 0xcc1f5a Device Boot Start End Blocks Id System /dev/xvdb1 1 Linux //不是lvm分区格式 Command (m for help): t //转换 Selected partition 1 Hex code (type L to list codes): 8e //换成8e Changed system type of partition 1 to 8e (Linux LVM) Command (m for help): p Disk /dev/xvdb: .6 GB, bytes heads, sectors/track, cylinders Units = cylinders of * = bytes Sector size (logical/physical): bytes / bytes I/O size (minimum/optimal): bytes / bytes Disk identifier: 0xcc1f5a Device Boot Start End Blocks Id System /dev/xvdb1 1 8e Linux LVM //现在lvm分区格式了 Command (m for help): wq The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. 4,创建逻辑卷组,以及逻辑卷等复制代码代码如下:[root@iZzz3wqciZ ~]# pvcreate /dev/xvdb1 //创建物理卷 Physical volume "/dev/xvdb1" successfully created [root@iZzz3wqciZ ~]# vgcreate myfiles /dev/xvdb1 //创建逻辑卷组 Volume group "myfiles" successfully created [root@iZzz3wqciZ ~]# vgchange -ay myfiles //激活逻辑卷组 0 logical volume(s) in volume group "myfiles" now active [root@iZzz3wqciZ ~]# vgdisplay myfiles | grep "Total PE" //查看该卷组所有的PE Total PE [root@iZzz3wqciZ ~]# lvcreate -l -n fastdfs myfiles //创建逻辑卷 Logical volume "fastdfs" created. 5,格式化逻辑卷复制代码代码如下:[root@iZzz3wqciZ ~]# mkfs.ext4 /dev/myfiles/fastdfs //格式化逻辑卷 mke2fs 1.. (-May-) Filesystem label= OS type: Linux Block size= (log=2) Fragment size= (log=2) Stride=0 blocks, Stripe width=0 blocks inodes, blocks blocks (5.%) reserved for the super user First data block=0 Maximum filesystem blocks= block groups blocks per group, fragments per group inodes per group Superblock backups stored on blocks: , , , , , , , , , Writing inode tables: done Creating journal ( blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every mounts or days, whichever comes first. Use tune2fs -c or -i to override. 6,设置自动挂载,并查看分区复制代码代码如下:[root@iZzz3wqciZ ~]# echo '/dev/myfiles/fastdfs /mnt/fastdfs ext4 defaults 0 0' >> /etc/fstab //自动挂载 [root@iZzz3wqciZ ~]# mount -a //手动挂载 [root@iZzz3wqciZ ~]# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/xvda1 % / tmpfs 0 0% /dev/shm /dev/mapper/myfiles-fastdfs 1% /mnt/fastdfs //lvm逻辑卷已挂载 [root@iZzz3wqciZ ~]# reboot //操作完最好重启一下 7,再扩容一块硬盘到已有逻辑卷复制代码代码如下:[root@iZzz3wqciZ ~]# fdisk /dev/xvdc //详细过程同上,就不详细说明了 [root@iZzz3wqciZ ~]# reboot [root@iZzz3wqciZ ~]# pvcreate /dev/xvdc1 //创建物理卷 Physical volume "/dev/xvdc1" successfully created [root@iZzz3wqciZ ~]# vgextend myfiles /dev/xvdc1 //将新硬盘加入卷组 Volume group "myfiles" successfully extended [root@iZzz3wqciZ ~]# vgdisplay myfiles | grep "Total PE" //查看所有PE Total PE [root@iZzz3wqciZ ~]# lvresize -l /dev/myfiles/fastdfs //重新规定大小 Size of logical volume myfiles/fastdfs changed from . GiB ( extents) to . GiB ( extents). Logical volume fastdfs successfully resized [root@iZzz3wqciZ ~]# resize2fs /dev/myfiles/fastdfs //重新规定大小 resize2fs 1.. (-May-) Filesystem at /dev/myfiles/fastdfs is mounted on /mnt/fastdfs; on-line resizing required old desc_blocks = 2, new_desc_blocks = 2 Performing an on-line resize of /dev/myfiles/fastdfs to (4k) blocks. The filesystem on /dev/myfiles/fastdfs is now blocks long. [root@iZzz3wqciZ ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/xvda1 G G 4.6G % / tmpfs M 0 M 0% /dev/shm /dev/mapper/myfiles-fastdfs G M G 1% /mnt/fastdfs //新的5G硬盘加上去了 如果是频繁的扩容硬盘的话,LVM是首选,扩展真的很方便。

详解Linux中rm与rmdir删除命令的用法 rm命令用法:rm[选项]...文件...删除(unlink)文件。-f,--force强制删除。忽略不存在的文件,不提示确认-i在删除前需要确认-I在删除超过三个文件或者递归删

Linux系统中用于复制的cp和scp命令使用解析 cp命令用法:cp[选项]...[-T]源文件目标文件或:cp[选项]...源文件...目录或:cp[选项]...-t目录源文件...将源文件复制至目标文件,或将多个源文件复制至目

在Linux下通过命令行来操作使用Dropbox Dropbox是一款非常好用的免费网络文件同步工具,是Dropbox公司运行的在线存储服务,通过云计算实现因特网上的文件同步,用户可以存储并共享文件和文

标签: linux系统对硬件要求高吗

本文链接地址:https://www.jiuchutong.com/biancheng/353455.html 转载请保留说明!

上一篇:Linux系统下转换文件编码的方法小结(linux系统转换为win系统脚本)

下一篇:详解Linux中rm与rmdir删除命令的用法(linux中的rm是什么意思)

  • 印花税申报缴纳错误,怎么办
  • 营业执照是怎么样子的
  • 税控财务软件装什么系统
  • 广东通用机打发票可以抵扣吗
  • 民非企业开通捐赠
  • 公司不交工会经费的原因,风险说明
  • 清包工取费标准
  • 软件公司企业成本预测
  • 增值税电子普通发票和增值税专用发票区别
  • 对公账户发工资怎么操作
  • 如何核销财政票据的发票
  • 厂房房产税如何计算
  • 社保基金会割肉操作吗
  • 防洪基金减免的会计分录怎么写?
  • 你觉得微信提现收费合理吗?
  • 怎么确认收到的钱是哪个项目的
  • 水费分割单由哪一方出具
  • 不能抵扣的进项税怎么做账
  • 本地开的住宿费可以退吗
  • 借库存商品贷生产成本这笔会计分录反映的经济业务是
  • 个人出租商铺要交城镇土地使用税吗
  • 光伏安装工程公司有哪些
  • 个税房租和房贷抵扣一样吗
  • 信息技术包括哪几个方面
  • 建筑业预交增值税最新政策
  • 计提个人保险会计分录
  • 3联收据
  • 在建工程工程款优先受偿权
  • 原材料退库怎么做凭证
  • 收到工会经费怎样做账
  • 代开专票计提附加税吗
  • 辞退补偿金怎么算n1吗
  • 工程决算超预算起诉
  • php实现批量删除
  • 第一启动盘设置为u盘
  • 两台mac怎么一起用
  • 苹果最小的充电器是哪一款
  • yii gridview
  • 生产企业出口退税全部流程
  • 稀释性每股收益计算例题
  • 海恩斯科普简介
  • 科研项目财政拨款多少
  • 什么是技术服务工程师
  • 一年一度的施瓦本哈尔圣诞市集,德国巴登-符腾堡州 (© sack/Getty Images Plus)
  • php获取网页所有页数
  • 制造费用账户在期末被结平
  • php中include_once
  • 第一季度季初资产总额和第一季度季末同一个数吗
  • vue3官方教程
  • 富文本编辑器使用
  • 员工离职后个税申报系统如何操作
  • 小规模申请一般纳税人的条件
  • ado连接access数据库
  • mysql字符串字段数据类型
  • 应收账款收不回来了应怎么做会计分录
  • 支付水电费会计
  • 融资租入固定资产的租赁费属于什么费用
  • 物流公司过户给我需要做什么
  • 网络销售平台有哪些平台
  • 电子增值税发票样本
  • 营业费用占比
  • 核定应税所得率征收
  • 技术服务费可以开专票吗
  • 单位社保缴费收费标准
  • 电子发票一定要盖章吗
  • 什么是个人独资企业营业执照
  • 受益无穷还是受用无穷
  • 判断自己的脸型
  • win8.1检测不到更新
  • rsmsink.exe - rsmsink是什么进程 有何作用
  • 电脑系统垃圾
  • win7怎么查看电池信息
  • 网站出现问题怎么办
  • win7系统命令大全
  • node.js的exports、module.exports与ES6的export、export default深入详解
  • win10下python
  • 天津生育津贴如何查询申请进度
  • 上海市国家税务局
  • 个人所得税房贷能退多少钱
  • 所得税的核定征收方法
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

    网站地图: 企业信息 工商信息 财税知识 网络常识 编程技术

    友情链接: 武汉网站建设