[分享]CentOS Linux操作系统硬盘分区/挂载教程
Linux操作系统硬盘分区/挂载,此办法分区,把系统盘,和数据盘分开了,系统坏了,不会直接导致数据丢失,还有补救的机会,但唯一不足就是有部分的硬盘空间不能使用,导致浪费,不过好在数据能得到安全保障。
SSH登录到Linux系统 先检查硬盘分区和挂载情况:
以上我们可以看到,/dev/xvdb有20G硬盘没有分区,接下来就是对/dev/xvdb分区 (注:/dev/xvdb设备名称是根据系统的不同改变的,后面的也随便改变)
[root@MyVPS ~]# fdisk /dev/xvdb 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 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)
输入n新建分区 Command (m for help): n Command action e extended p primary partition (1-4) p
/dev/xvdb中第1个分区 Partition number (1-4): 1 First cylinder (1-2871, default 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. 对/dev/xvdb1进行ext3格式化
格式完毕后,我们把/dev/xvdb1挂载到home目录中 新建home目录,然后挂载
- mkdir /home
- mount /dev/xvdb1 /home
复制代码 查看分区情况,来确定是否挂载好
最后一步,开机自动挂载
- echo "/dev/xvdb1 /home1 ext3 defaults 1 2" >> /etc/fstab
复制代码 重装系统后的处理方法 重新建立目录/home1,然后重新挂载,xvdb1的文件内容不受影响
- mkdir /home1
- mount /dev/xvdb1 /home1
复制代码 最后,重新添加自动挂载即可:
- echo "/dev/xvdb1 /home1 ext3 defaults 1 2" >> /etc/fstab
复制代码
|
来源:
阅读:1667 次
日期:2013/2/28
|
【 双击滚屏 】 【 推荐朋友 】 【 收藏 】 【 打印 】 【 关闭 】
【 字体:大 中
小 】 |
|