- 查看未分区的硬盘
[@zjm_46_109 ~]# fdisk -l /dev/xvdb
Disk /dev/xvdb: 536.8 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/xvdb doesn't contain a valid partition table
- 将硬盘xvdb分成xvdb1、xvdb2两个分区 (n: 创建新分区;P:主分区;W:保存分区)
[@zjm_46_109 ~]# fdisk /dev/xvdb
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-65270, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-65270, default 65270): +60G
Command (m for help): p
Disk /dev/xvdb: 536.8 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/xvdb1 1 7296 58605088+ 83 Linux
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (7297-65270, default 7297):
Using default value 7297
Last cylinder or +size or +sizeM or +sizeK (7297-65270, default 65270):
Using default value 65270
Command (m for help): p
Disk /dev/xvdb: 536.8 GB, 536870912000 bytes
255 heads, 63 sectors/track, 65270 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/xvdb1 1 7296 58605088+ 83 Linux
/dev/xvdb2 7297 65270 465676155 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
- 格式化分区xvdb1(其中mkfs.ext3可以根据你当前Linux版本来选择,当前系统版本最高ext3)
[@zjm_46_109 ~]# mkfs.ext3 /dev/xvdb1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
7325696 inodes, 14651272 blocks
732563 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
448 block groups
32768 blocks per group, 32768 fragments per group
16352 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 31 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
- 格式化分区xvdb2(其中mkfs.ext3可以根据你当前Linux版本来选择,当前系统版本最高ext3)
[@zjm_46_109 ~]# mkfs.ext3 /dev/xvdb2
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
58212352 inodes, 116419038 blocks
5820951 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
3553 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, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000
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.
- 创建目录挂载分区(创建app和db两个目录,分别挂载xvdb1、xvdb2分区)
[@zjm_46_109 ~]# mkdir /app
[@zjm_46_109 ~]# mkdir /db
[@zjm_46_109 ~]# vim /etc/fstab
/dev/xvdb1 /app ext3 defaults 0 0
/dev/xvdb2 /db ext3 defaults 0 0
[@zjm_46_109 ~]# mount -a
- 查看硬盘
[@zjm_46_109 /app]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda3 91G 3.2G 83G 4% /
/dev/xvda1 99M 21M 73M 23% /boot
tmpfs 4.0G 28K 4.0G 1% /dev/shm
/dev/xvdb1 56G 180M 53G 1% /app
/dev/xvdb2 438G 199M 415G 1% /db