ubuntu 12.04 server 挂载硬盘
买的虚拟机添加硬盘需要手动挂载,下面列下简单步骤,作为记录: 1、查看下当前文件系统
df
Filesystem 1K-blocks Used Available Use% Mounted on /dev/vda1 8254240 1099340 6735608 15% / 只有一个/dev/vda1挂在了根下边,也就是系统软件装在这里
2、查看下当前硬盘情况
fdisk -l
Disk /dev/vda: 8589 MB, 8589901824 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: 0xcd6e8236
Device Boot Start End Blocks Id System /dev/vda1 * 1 1044 8385898+ 83 Linux
Disk /dev/vdb: 268.4 GB, 268435456000 bytes 16 heads, 63 sectors/track, 520126 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
Disk /dev/vdb doesn't contain a valid partition table
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
Disk /dev/vdc doesn't contain a valid partition table 看到一个盘,/dev/vdb,270G。现在格式化下。
3、格式化
mkfs -t ext4 /dev/vdb
mke2fs 1.41.12 (17-May-2010) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 16384000 inodes, 65536000 blocks 3276800 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=4294967296 2000 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 25 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. -t 是指分区类型 这里用ext4
4、把磁盘挂载到 /edx mount /dev/vdb /edx
df
Filesystem 1K-blocks Used Available Use% Mounted on /dev/vda1 8254240 1099384 6735564 15% / /dev/vdb 258030980 191708 244732072 1% /edx
5、设置开机自动挂载 vim /etc/fstab 添加一条 /dev/vdb /edx ext4 noatime,acl,user_xattr 1 0 (fstab的文件格式,以后记录)