文章字数的设置,该文章的第一部分请访问RHCE033--硬件配置与管理1
- 顺便在这里把一个逻辑分区的文件系统类型改为82,即swap类型
[root@51cto ~]# fdisk /dev/sdb
Command (m for help): t //使用t改变分区的文件系统类型标识
Partition number (1-6): 6 //选择第六个分区号,即一个交换分区
Hex code (type L to list codes): 82 //82是swap类型的文件系统类型号码
Changed system type of partition 6 to 82 (Linux swap / Solaris)
Command (m for help): p //查看分区信息
Disk /dev/sdb: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 122 261 1124550 83 Linux
/dev/sdb2 1 121 971901 5 Extended
/dev/sdb5 62 121 481950 83 Linux
/dev/sdb6 1 61 489919 82 Linux swap / Solaris //交换分区ok
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.
Syncing disks.
- 到这里上面的分区结果已经生效,但是分区设置需要reboot系统才生效.如果不希望
reboot马上生效可以使用partprobe命令使内核更新分区表
[root@51cto ~]#[root@51cto ~]# partprobe
接下来就是格式化操作了,没格式化的分区是不能存储任何信息的.
格式化的命令有:mkfs tune2fs mkswap 三个命令
如下把第一个主分区格式化为ext3格式:
[root@51cto ~]# mkfs -t ext3 /dev/sdb1
//使用-t选项指定格式为ext3,如果直接mkfs /dev/sdb1的话就格式化为ext2类型
mke2fs 1.39 (29-May-2006)
Filesystem label= //分区卷标,这里为空
OS type: Linux
Block size=4096 (log=2) //块大小为4KB
Fragment size=4096 (log=2)
140832 inodes, 281137 blocks
14056 blocks (5.00%) reserved for the super user //保留5%的空间为root用户
First data block=0
Maximum filesystem blocks=289406976
9 block groups
32768 blocks per group, 32768 fragments per group
15648 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 37 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
//可以用tune2fs修改已经格式化的分区的参数
如果格式化的时候指定参数,把分区的块大小设为2KB,保留2%的空间给root用户,
分区卷标为sample
[root@51cto ~]# mkfs -t ext3 -b 2048 -m 2 -L sample /dev/sdb1 //具体命令
mke2fs 1.39 (29-May-2006)
Filesystem label=sample //分区卷标为sample
OS type: Linux
Block size=2048 (log=1) //分区的块大小设为2KB
Fragment size=2048 (log=1)
141120 inodes, 562274 blocks
11245 blocks (2.00%) reserved for the super user //保留2%的空间给root用户
First data block=0
Maximum filesystem blocks=537919 |