电脑技术学习

linux fdisk命令详解

dn001

  Partition number (1-4): 3 注:指定为3 ,因为主分区已经分了两个了,这个也算主分区,从3开始;

  First cylinder (51-125, default 51): 注:直接回车;

  Using default value 51

  Last cylinder or +size or +sizeM or +sizeK (51-125, default 125): 注:直接回车,把其余的所有空间都给扩展分区;

  Using default value 125

  Command (m for help): p

  Disk /dev/sda: 1035 MB, 1035730944 bytes

  256 heads, 63 sectors/track, 125 cylinders

  Units = cylinders of 16128 * 512 = 8257536 bytes

  Device Boot Start End Blocks Id System

  /dev/sda1 1 25 201568+ 83 Linux

  /dev/sda2 26 50 201600 83 Linux

  /dev/sda3 51 125 604800 5 Extended

  Command (m for help): n

  Command action

  l logical (5 or over)

  p primary partition (1-4)

  l 注:添加逻辑分区;

  First cylinder (51-125, default 51):

  Using default value 51

  Last cylinder or +size or +sizeM or +sizeK (51-125, default 125): +200M 注:添加一个大小为200M大小的分区;

  Command (m for help): n

  Command action

  l logical (5 or over)

  p primary partition (1-4)

  l 注:添加一个逻辑分区;

  First cylinder (76-125, default 76):

  Using default value 76

  Last cylinder or +size or +sizeM or +sizeK (76-125, default 125): +200M 注:添加一个大小为200M大小的分区;

  Command (m for help): p 列出分区表;

  Disk /dev/sda: 1035 MB, 1035730944 bytes

  256 heads, 63 sectors/track, 125 cylinders

  Units = cylinders of 16128 * 512 = 8257536 bytes

  Device Boot Start End Blocks Id System

  /dev/sda1 1 25 201568+ 83 Linux

  /dev/sda2 26 50 201600 83 Linux

  /dev/sda3 51 125 604800 5 Extended

  /dev/sda5 51 75 201568+ 83 Linux

  /dev/sda6 76 100 201568+ 83 Linux

  然后我们根据前面所说通过t指令来改变分区类型;

  最后不要忘记w保存退出;

  五、对分区进行格式化,以及加载;

  先提示一下;用 mkfs.bfs mkfs.ext2 mkfs.jfs mkfs.msdos mkfs.vfatmkfs.cramfs mkfs.ext3 mkfs.minix mkfs.reiserfs mkfs.xfs 等命令来格式化分区,比如我想格式化 sda6为ext3文件系统,则输入;

  [root@localhost beinan]# mkfs.ext3 /dev/sda6

  如果我想加载 sda6到目前系统来存取文件,应该有mount 命令,但首先您得建一个挂载目录;比如 /mnt/sda6 ;

  [root@localhost beinan]# mkdir /mnt/sda6

  [root@localhost beinan]# mount /dev/sda6 /mnt/sda6

  [root@localhost beinan]# df -lh

  Filesystem 容量 已用 可用 已用% 挂载点

  /dev/hda8 11G 8.4G 2.0G 81% /

  /dev/shm 236M 0 236M 0% /dev/shm

  /dev/hda10 16G 6.9G 8.3G 46% /mnt/hda10

  /dev/sda6 191M 5.6M 176M 4% /mnt/sda6

  这样我们就能进入 /mnt/sda6目录,然后存取文件了;

  具体的权限方法,以及mount 更详细的用法,在以后我会专门写一个帖子;在一帖中放下所有的内容实在有点为难;

标签: linux