当前位置:首页 > Linux

Linux VPS新硬盘分区与挂载教程

canca12年前 (2014-10-04)Linux768
通过fdisk -l我们可以看到/dev/xvdb(此名称因系统而异)容量有23.6G,而且没有分区
接下来我们对它进行分区和挂载 (红色字为需要输入的部分,黑色字为系统显示部分) 1.fdisk -l [root@MyVPS ~]# fdisk -l Disk /dev/xvda: 8589 MB, 8589934592 bytes 255 heads, 63 sectors/track, 1044 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 Disk /dev/xvdb: 23.6 GB, 23622320128 bytes 255 heads, 63 sectors/track, 2871 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System
2.对/dev/xvdb(此名称因系统而异)进行分区: [root@MyVPS ~]# fdisk /dev/sdb 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.
3.将新分区xvdb1(此名称因系统而异)格式化为ext3格式 [root@MyVPS ~]# mkfs -t ext3 /dev/sdb1 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. 3.我们示范将新分区xvdb1挂载到目录/home [root@MyVPS ~]# mount /dev/sdb1 /home
也可以新建目录/home1,然后挂载home1目录,新建目录命令mkdir /home 然后 mount /dev/xvdb1 /home1
4.完成后我们通过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/xvda1 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/xvdb1 22G 173M 21G 1% /home
5.最后添加开机自动挂载: [root@MyVPS ~]# echo "/dev/sdb1 /home ext3 defaults 1 2" >> /etc/fstab 注意:检验是否挂盘成功,需要重启服务器,如果能够连接则成功,不能则失败。重启命令“reboot” 
-------------------------
6.通过my.vpsks.com面板重装后的处理 [root@MyVPS ~]# mkdir /home1 [root@MyVPS ~]# mount /dev/sdb1 /home 最后,重新添加自动挂载即可: [root@MyVPS ~]# echo "/dev/sdb1 /home ext3 defaults 1 2" >> /etc/fstab

扫描二维码推送至手机访问。

版权声明:本文由Ant.Master's Blog发布,如需转载请注明出处。

本文链接:https://iant.work/post/106.html

标签: Linux
分享给朋友:

“Linux VPS新硬盘分区与挂载教程” 的相关文章

Linux常用命令集锦

查看所有已安装前缀为samba的RPM包      rpm -qa samba*删除目录或文件   rm -r 文件名linux解压bz2文件使用   bunzip2   linux-2-4-2.tar.bz2 &nbs…

如何通过Linux系统下iptables防火墙开启/关闭指定端口方法

一般情况下iptables已经包含在Linux发行版中.运行iptables --version来查看系统是否安装iptables 启动iptablesservice iptables startiptables --list //*查看iptables规则集*//下面是没有定义…

CentOS 7最小化安装后找不到‘ifconfig’命令——修复小提示

就像我们所知道的,“ifconfig”命令用于配置GNU/Linux系统的网络接口。它显示网络接口卡的详细信息,包括IP地址,MAC地址,以及网络接口卡状态之类。但是,该命令已经过时了,而且在最小化版本的RHEL 7以及它的克隆版本CentOS&n...…

centos 7 crontab定时器及开机自启

crontab 建议直接采用centos7 自带得cronteb包,定时器:就是定时去执行干某一件事在这里我以脚本为媒介1 当然是创建一个脚本,创建目录随意但是你一定要记得。。直接通过vi来创建一个test.sh脚本!…

centos7 手动修改dns

方法一:vim /etc/resolv.conf…

debian系统如何搭建 Samba服务器

debian系统如何搭建 Samba服务器

几乎所有的 Linux 发行版都提供了一个很好的工具 Samba来轻松实现文件共享。最近在Nanopi2 上安装了 debian 系统,然后准备搭建Samba 服务器来实现文件的共享,以下步骤仅供参考。…

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。