最近发现阿里云服务器的磁盘快不够满了(df -lh), 登录阿里云控制面板查看原来还有一块数据盘没用,原来阿里云服务器的数据盘默认是不会自动挂载的。
开始挂载:
首先使用 SSH登陆到阿里云服务器,比如:SecureCRT ,Putty ...
1.先查看哪一块没挂载好: fdisk -l
[root@AY************** ~]# fdisk -l
Disk /dev/hda: 21.4 GB, 21474836480 bytes
224 heads, 56 sectors/track, 3343 cylinders
Units = cylinders of 12544 * 512 = 6422528 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 3343 20967268 83 Linux
Disk /dev/xvdb: 53.6 GB, 53687091200 bytes
224 heads, 56 sectors/track, 8359 cylinders
Units = cylinders of 12544 * 512 = 6422528 bytes
Disk /dev/xvdb doesn't contain a valid partition table
2. 然后 fdisk /dev/xvdb ,注意红色部分,绿色这里有按回车 默认即可。
[root@AY************** ~]# fdisk /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.
The number of cylinders for this disk is set to 8359.
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)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-8359, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-8359, default 8359):
Using default value 8359
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
3. 格式化分区 mkfs.ext3 /dev/xvdb1
[root@AY************** ~]# mkfs.ext3 /dev/xvdb1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
.........................
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 30 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
4.挂载分区,先要在根目录建立data0(mkdir /data0),才能完成挂载。
mount /dev/xvdb1 /data0/
5.设置开机自动挂载
vi /etc/fstab
/dev/xvdb1 /data ext3 defaults 0 0
6.查看挂载情况:
[root@AY************** ~]# df -lh
Filesystem Size Used Avail Use% Mounted on
/dev/hda1 20G 14G 4.7G 75% /
tmpfs 1006M 0 1006M 0% /dev/shm
/dev/xvdb1 50G 180M 47G 1% /data0
成功!
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。