@media screen 针对不同移动设备
时间:2016-02-20 来源:风信官网 点击:
675次
新购买的Linux云服务器,数据盘未做分区和格式化,无法使用。
可以通过自动格式化和手动格式化两种方式对Linux云服务器数据盘进行格式化。
注:
(1)格式化后,数据盘中的数据将被全部清空。请在格式化之前,确保数据盘中没有数据或对重要数据已进行备份。
(2)为避免服务发生异常,格式化前请确保云服务器已停止对外服务。
首先检查是否有数据盘:
fdisk -l
[root@VM_77_80_centos ~]# fdisk -l
Disk /dev/vda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000736d7
Device Boot Start End Blocks Id System
/dev/vda1 * 1 1045 8387584 83 Linux
Note: sector size is 4096 (not 512)
Disk /dev/vdb: 107.4 GB, 107374182400 bytes
16 heads, 56 sectors/track, 29257 cylinders
Units = cylinders of 896 * 4096 = 3670016 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0xd1ff745a
Device Boot Start End Blocks Id System
/dev/vdb1 1 29257 104856864 83 Linux
Disk /dev/vdc: 2147 MB, 2147483648 bytes
16 heads, 63 sectors/track, 4161 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
看到数据盘的路径是/dev/vdb
如果没有对硬盘进行分区,请执行以下硬盘分区命令:
fdisk /dev/vdb
依次输入 n 、p、 1、 回车、回车、wq
这里的VDB是我们上面看到数据硬盘的名称
格式化分区
mkfs.ext3 /dev/vdb1
[root@VM_77_80_centos ~]# mkfs.ext3 /dev/vdb1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=1 blocks, Stripe width=0 blocks
6553600 inodes, 26214216 blocks
1310710 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
800 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information:
done
This filesystem will be automatically checked every 39 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@VM_77_80_centos ~]#
挂载分区
mount /dev/vdb1 /www
[root@VM_77_80_centos ~]# mount /dev/vdb1 /www
设置开机自动挂载分区
[root@VM_77_80_centos ~]# echo '/dev/vdb1 /www ext3 defaults 0 0' >> /etc/fstab
验证数据盘是否已经挂载好了,这里我们已经看到/dev/vdb1已经挂载上去了。
[root@VM_77_80_centos ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 7.9G 2.6G 5.0G 35% /
/dev/vdb1 99G 188M 94G 1% /www