Linux VPS 挂载磁盘ext3格式(重装系统数据不丢失)
2015-05-13 22:54
274 查看
傲游出于数据保护机制,我们都会给客户准备2块硬盘,一块用来存放用户数据(即网站数据等),一块用来存放系统,这样在您的系统出现问题之后后台选择重装系统,另外一个磁盘分区的数据就不会丢失了,所以在购买VPS之后,要手动将另外一块硬盘挂载到用户数据的目录。这个机制有一个缺点就是存放系统的分区将无法应用于用户数据(网站数据等),所以如果您需要充分利用您的磁盘,您可以挂载磁盘为LVM格式,教程参考这里:Linux
VPS 挂载磁盘LVM格式(充分利用磁盘)傲游主机不提供Raid10,请注意备份数据!
下面教程开始:
注意事项:
1.请勿在有数据存于/home目录的情况下进行此操作,请注意备份数据。
2.尽管理论上可以实现重装系统第二块磁盘的数据不丢失,但是我们依然强烈建议您备份好自己的数据,备份才是王道!
VPS 挂载磁盘LVM格式(充分利用磁盘)傲游主机不提供Raid10,请注意备份数据!
下面教程开始:
[root@MyVPS ~]# fdisk -l (查看磁盘分区) Disk /dev/xvdb: 7516 MB, 7516192768 bytes 255 heads, 63 sectors/track, 913 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk /dev/xvdb doesn't contain a valid partition table Disk /dev/xvda: 10.7 GB, 10737418240 bytes 255 heads, 63 sectors/track, 1305 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/xvda1 * 1 13 104391 83 Linux /dev/xvda2 14 1044 8281507+ 8e Linux LVM /dev/xvda3 1045 1305 2096482+ 8e Linux LVM [root@MyVPS ~]# df -hal //*查看已划分区空间使用情况*// Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup00-LogVol00 9.3G 1.2G 7.7G 13% / proc 0 0 0 - /proc sysfs 0 0 0 - /sys devpts 0 0 0 - /dev/pts /dev/xvda1 99M 29M 66M 31% /boot tmpfs 151M 0 151M 0% /dev/shm none 0 0 0 - /proc/sys/fs/binfmt_misc sunrpc 0 0 0 - /var/lib/nfs/rpc_pipefs [root@MyVPS ~]# fdisk /dev/xvdb //*对硬盘/dev/xvdb进行增加分区操作*// Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel. 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) Command (m for help): n //*输入n新建分区*// Command action e extended p primary partition (1-4) p //*输入p主分区*// Partition number (1-4): 1 //*输入1第一个分区*// First cylinder (1-913, default 1): //*回车跳过*// Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-913, default 913): //*回车跳过*// Using default value 913 Command (m for help): w //*输入W保存退出*// The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. [root@MyVPS ~]# mkfs -t ext3 /dev/xvdb1 //*将新分区xvdb1(此名称因系统而异)格式化为ext3格式*// mke2fs 1.39 (29-May-2006) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) 917504 inodes, 1833410 blocks 91670 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=1879048192 56 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 Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 21 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to overri 8c0a de. [root@MyVPS ~]# mount /dev/xvdb1 /home //*将新分区xvdb1挂载到目录/home*// [root@MyVPS ~]# df -hal Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup00-LogVol00 9.3G 1.2G 7.7G 13% / proc 0 0 0 - /proc sysfs 0 0 0 - /sys devpts 0 0 0 - /dev/pts /dev/xvda1 99M 29M 66M 31% /boot tmpfs 151M 0 151M 0% /dev/shm none 0 0 0 - /proc/sys/fs/binfmt_misc sunrpc 0 0 0 - /var/lib/nfs/rpc_pipefs /dev/xvdb1 6.9G 144M 6.4G 3% /home [root@MyVPS ~]# echo "/dev/xvdb1 /home ext3 defaults 1 2" >> /etc/fstab //*添加开机自动挂载*// //*S4 Did For aoyouhost*//
注意事项:
1.请勿在有数据存于/home目录的情况下进行此操作,请注意备份数据。
2.尽管理论上可以实现重装系统第二块磁盘的数据不丢失,但是我们依然强烈建议您备份好自己的数据,备份才是王道!
相关文章推荐
- Linux VPS新硬盘分区与挂载教程(面板重装不丢失数据)
- LINUX系统的VPS里挂载第二个硬盘且重装系统数据也不会丢失
- 重装系统后管家婆数据库丢失,数据库碎片扫描、提取、重组数据恢复
- 系统重装 如何转换GPT的磁盘格式为MBR或者反过来
- 移动文档——避免重装系统丢失个人数据
- 怎么解决重装系统后硬盘数据丢失问题
- 系统重装 如何转换GPT的磁盘格式为MBR或者反过来
- 创建硬链接避免重装系统数据丢失
- 同步所有已挂载的文件系统。所有缓存中的数据将被立刻写入磁盘
- 腾讯云Linux VPS新硬盘分区与挂载教程(面板重装不丢失数据)
- Centos系统保留数据重装后挂载旧硬盘方法
- 拥有Windows8 从此不再担心重装系统丢失数据
- 通过注册表改变“我的文档”等的默认位置,防止系统重装造成数据丢失
- MySql5 Windows vista/7系统重装后的数据恢复与备份
- 【转】warning C4819,该文件保存为 Unicode 格式以防止数据丢失,处理方法
- linux中磁盘的分区,文件系统的创建,挂载
- 真正管用!warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
- word2003保存文时总是提示“文档被保存,但是语音识别的数据丢失,因为没有足够的空间存储这些数据。确保没有录音时关闭麦克风,并检查磁盘上的存储空间。[转]
- 磁盘文件系统损坏要怎么找回数据
- redmine备份 重装系统后,redmine数据恢复