[root@server12c /]# fdisk -l
Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 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: 0x00016e57
Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 2611 20458496 8e Linux LVM
Disk /dev/sdb: 21.5 GB, 21474836480 bytes #sdb为新加磁盘
255 heads, 63 sectors/track, 2610 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: 0xc8e055ac复制
虽然硬盘分区表中最多能存储四个分区,但我们实际使用时一般只分为两个分区,一个是主分区(Primary Partion)一个是扩展分区(extended partition)两种,主分区可以马上被使用但不能再分区,扩展分区必须再进行分区后才能使用,也就是说它必须还要进行二次分区。那么由扩充分区再分下去的是什么呢?它就是逻辑分区(Logical Partion),况且逻辑分区没有数量上限制。对习惯于使用Dos或Windows的朋友来说,有几个分区就有几个驱动器,并且每个分区都会获得一个字母标识符,然后就可以选用这个字母来指定在这个分区上的文件和目录,它们的文件结构都是独立的,非常好理解。但是初上手Red Hat Linux吗,可就有点恼人了。因为对Linux用户来说无论有几个分区,分给哪一目录使用,它归根结底就只有一个根目录,一个独立且唯一的文件结构。Red Hat Linux中每个分区都是用来组成整个文件系统的一部分,因为它采用了一种叫“挂载点”的处理方法,它的整个文件系统中包含了一整套的文件和目录,且将一个分区和一个目录联系起来。这时要载入的一个分区将使它的存储空间在一个目录下获得。
[root@server12c ~]# fdisk /dev/sdb
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command action
l extend #扩展分区
p primary partition (1-4)#主分区
p
Partition number (1-4): 1 #分区号1
+2G
同上建立扩展分区
扩展分区建立好后就可以建逻辑分区
[root@server12c /]# fdisk /dev/sdb
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
p
Partition number (1-4): 1
Partition 1 is already defined. Delete it before re-adding it.
Command (m for help): ^[[A
[: unknown command
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (786-2610, default 786):
Using default value 786
Last cylinder, +cylinders or +size{K,M,G} (786-2610, default 2610): +10G
Command (m for help): p
Disk /dev/sdb: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 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: 0xc8e055ac
Device Boot Start End Blocks Id System
/dev/sdb1 1 262 2104483+ 83 Linux
/dev/sdb2 786 2091 10490445 83 Linux
/dev/sdb4 263 785 4200997+ 5 Extended
/dev/sdb5 263 785 4200966 83 Linux
Partition table entries are not in disk order
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
格式化
[root@server12c /]# mkfs -t ext3 /dev/sdb4
mke2fs 1.43-WIP (20-Jun-2013)
mkfs.ext3: inode_size (128) * inodes_count (0) too big for a
filesystem with 0 blocks, specify higher inode_ratio (-i)
or lower inode count (-N).
[root@server12c /]# mkfs -t ext3 /dev/sdb1
mke2fs 1.43-WIP (20-Jun-2013)
文件系统标签=
OS type: Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
131648 inodes, 526120 blocks
26306 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=541065216
17 block groups
32768 blocks per group, 32768 fragments per group
7744 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Allocating group tables: 完成
正在写入inode表: 完成
Creating journal (16384 blocks): 完成
Writing superblocks and filesystem accounting information: 完成
[root@server12c ~]# mkfs -t ext3 /dev/sdb2
mke2fs 1.43-WIP (20-Jun-2013)
文件系统标签=
OS type: Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
655776 inodes, 2622611 blocks
131130 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=2688548864
81 block groups
32768 blocks per group, 32768 fragments per group
8096 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
Allocating group tables: 完成
正在写入inode表: 完成
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成
[root@server12c ~]# mkdir /data16
[root@server12c ~]# mount /dev/sdb2 /data16
[root@server12c ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_server12c-lv_root
18G 14G 3.0G 82% /
tmpfs 1.9G 0 1.9G 0% /dev/shm
/dev/sda1 477M 84M 364M 19% /boot
/dev/sdb5 3.9G 8.2M 3.7G 1% /data15
/dev/sdb2 9.8G 23M 9.3G 1% /data16
新建目录并挂载
root@server12c ~]# mount /dev/sdb2 /data16
[root@server12c ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_server12c-lv_root
18G 14G 3.0G 82% /
tmpfs 1.9G 0 1.9G 0% /dev/shm
/dev/sda1 477M 84M 364M 19% /boot
/dev/sdb5 3.9G 8.2M 3.7G 1% /data15
/dev/sdb2 9.8G 23M 9.3G 1% /data16
查看挂载是否成功
[root@server12c ~]# df -TH /data15/
Filesystem Type Size Used Avail Use% Mounted on
/dev/sdb5 ext3 4.1G 8.6M 3.9G 1% /data15
防止重启手动挂载
[root@server12c ~]# vim /etc/fstab
/dev/sdb5 /data15 ext3 defaults 0 0
/dev/sdb2 /data16 ext3 defaults 0 0复制
文章转载自木底木叉,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。