腾讯云Linux VPS新硬盘分区与挂载教程(面板重装不丢失数据)
以腾讯云Centos系统服务器为例,小记的是数据盘不在本地,大小为20G,以下的教程来自小夕博客的一篇相关添加教程的修改,适合腾讯云Linux Centos系统.说明:参数也许不对,我没有截图了,但所有命令均已修改,直接复制就行。
通过fdisk -l我们可以看到/dev/vdb(此名称因系统而异)容量有20G,而且没有分区,接下来我们对它进行分区和挂载
fdisk -l
[root@MyVPS ~ ]# fdisk -l
Disk /dev/vda: 8589 MB, 8589901824 bytes255 heads, 63 sectors/track, 1044 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0xcd6e8236
Device Boot Start End Blocks Id System/dev/vda1 * 1 1044 8385898+ 83 LinuxNote: sector size is 4096 (not 512)
Disk /dev/vdb: 21.5 GB, 21474836480 bytes16 heads, 56 sectors/track, 5851 cylindersUnits = cylinders of 896 * 4096 = 3670016 bytesSector size (logical/physical): 4096 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk identifier: 0x5c9ffc78
Device Boot Start End Blocks Id System/dev/vdb1 1 5851 20969760 83 Linux
对/dev/vdb(此名称因系统而异)进行分区:
fdisk /dev/vdb
[root@MyVPS ~]# fdisk /dev/vdb
The number of cylinders for this disk is set to 2871.
There is nothing wrong with that, but this is larger than 1024,
and could in certain **ps 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)
输入n新建分区
Command (m for help): n (输入n新建分区)
Command action
e extended
p primary partition (1-4)
p (输入P选择分区类型)
/dev/vdb中第1个分区
Partition number (1-4): 1 (输入1或者默认回车)
First cylinder (1-2871, default 1): (输入1或者默认回车)
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-2871, default 2871):
Using default value 2871
输入W保存退出
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
将新分区vdb1(此名称因系统而异)格式化为ext3格式
mkfs -t ext3 /dev/vdb1
[root@MyVPS ~]# mkfs -t ext3 /dev/vdb1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
2883584 inodes, 5765319 blocks
288265 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
176 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 24 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
我们示范将新分区vdb1挂载到目录/home1
新建目录/home1,然后挂载
mkdir /home1
mount /dev/vdb1 /home1
完成后我们通过df -hal可以看到,新分区已经挂载到目录/home1上了
[root@MyVPS ~]# df -hal
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
5.7G 1.4G 4.1G 25% /
proc 0 0 0 – /proc
sysfs 0 0 0 – /sys
devpts 0 0 0 – /dev/pts
/dev/vda1 99M 28M 67M 30% /boot
tmpfs 256M 0 256M 0% /dev/shm
none 0 0 0 – /proc/sys/fs/binfmt_misc
sunrpc 0 0 0 – /var/lib/nfs/rpc_pipefs
/dev/vdb1 22G 173M 21G 1% /home1
最后添加开机自动挂载:
echo “/dev/vdb1 /home1 ext3 defaults 1 0″ >> /etc/fstab
这样就完成了!
通过面板重装后的处理
重新建立目录/home1,然后重新挂载,xvdb1的文件内容不受影响
mkdir /home1
mount /dev/vdb1 /home1
最后,重新添加自动挂载即可:
echo “/dev/vdb1 /home1 ext3 defaults 1 0″ >> /etc/fs
腾讯云Linux VPS新硬盘分区与挂载教程(面板重装不丢失数据)的更多相关文章
- Linux VPS新硬盘分区与挂载教程
通过fdisk -l我们可以看到/dev/xvdb(此名称因系统而异)容量有23.6G,而且没有分区,接下来我们对它进行分区和挂载 (红色字为需要输入的部分,黑色字为系统显示部分) 1.fdisk - ...
- 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格式化数据盘,分区并挂载一个文件系统
阿里云一块全新的数据盘挂载到ECS实例后,您必须创建并挂载至少一个文件系统.本示例使用I/O优化实例,操作系统为CentOS 7.6,为一块新的300GiB数据盘(设备名为/dev/vdb)创建一个M ...
- Linux添加新硬盘自动挂载硬盘
Linux添加新硬盘自动挂载硬盘的具体步骤 1.插入新硬盘,启动Linux服务器,使用fdisk -l 查看硬盘 #fdisk -l Disk /dev/sdb: 1000.2 GB, 1000204 ...
- 安装Ubuntu Linux系统时硬盘分区最合理的方法
无论是安装Windows还是Linux操作系统,硬盘分区都是整个系统安装过程中最为棘手的环节,网上的一些Ubuntu Linux安装教程一般都是自动分区,给初学者带来很大的不便,下面我就根据多年来在合 ...
- 给腾讯云Linux主机创建Swap文件
新买的腾讯云主机没有提供Swap分区 理由是由于主机经常因为内存使用率过高,频繁使用Swap,导致磁盘IO过高,服务器整体性能反而下降. 不过用户依然可以使用Swap文件的方式添加Swap. 方法如下 ...
随机推荐
- python programming作业5
# -*- coding: utf-8 -*- class ageError(Exception): pass class salaryError(Exception): pass class s ...
- Ajax传参讲解
客户端和服务器 1.请求:request 2.响应:response 服务器响应事件:onreadystatechange() send() 用于向后台传递参数: Ajax的请求方式 get: ...
- 让android程序根据重力感应旋转屏幕(支持4个方向旋转)
原文地址:http://blog.csdn.net/yixiaoqingyuz/article/details/6453798代码如下: ChangeOrientationHandler.java p ...
- C#截取字符串按字节截取SubString
public static string CutByteString(string str,int len) { string result=string.Empty;// 最终返 ...
- servlet为什么会出现?servlet有什么作用?
在面试中遇到了这个问题,所以想总结一下,所以上网找了一下,主要是网上的一些我觉得比较合理的解释: servlet为什么会出现? Servlet = Service + Applet,表示小服务程序.S ...
- 如何在ubuntu系统里面用新加装的硬盘对系统进行扩容
我这里是用256G的固态硬盘安装了系统,想通过扩展1T的机械硬盘存储数据的,现在我们需要的就是把这个1T的硬盘进行扩容进去 使用df -h和sudo fdisk -l命令查看磁盘情况 切换到root用 ...
- oracle取出多个字段列中的最大值和最小值
greatest 函数和least函数 select serverid, greatest(e.core0, e.core1, e.score2 ) from e
- Docker 核心技术与实现原理
提到虚拟化技术,我们首先想到的一定是 Docker,经过四年的快速发展 Docker 已经成为了很多公司的标配,也不再是一个只能在开发阶段使用的玩具了.作为在生产环境中广泛应用的产品,Docker 有 ...
- Http Request Method:options
在调试前端界面时突然发现每个请求都执行了两次,点进去看详情,才发现第一个请求是options
- day15(模块引用笔记)
import spam文件名是spam.py,模块名则是spam# 首次导入模块发生?件事# 1. 会产生一个模块的名称空间# 2. 执行文件spam.py,将执行过程中产生的名字都放到模块的名称空间 ...