Chinaunix首页 | 论坛 | 博客
  • 博客访问: 597432
  • 博文数量: 239
  • 博客积分: 7941
  • 博客等级: 准将
  • 技术积分: 2467
  • 用 户 组: 普通用户
  • 注册时间: 2010-07-10 12:14
个人简介

及时当勉励

文章分类

全部博文(239)

文章存档

2013年(29)

2011年(22)

2010年(188)

分类:

2010-03-10 00:17:40

    上一篇是只有一个分区,这下我创建三个分区。操作如下:::
首先,如果挂载过了,要先卸载 #sudo umount /... 后面就是挂载的地方了。我没有挂载,所以就不用卸载了。
/*此为注释部分,也就是说不重要的地方,有上一篇说过的。可以略过不看。   蓝色为主要部分
hua@hua-desktop:~$ sudo fdisk -l /dev/sdb           #查看
[sudo] password for hua:

Disk /dev/sdb: 254 MB, 254279680 bytes
8 heads, 61 sectors/track, 1017 cylinders
Units = cylinders of 488 * 512 = 249856 bytes
Sector size (logical / optimal IO): 512 bytes / 512 bytes
Disk identifier: 0x00015b81

   Device Boot      Start         End      Blocks   Id  System                     #原来的三个分区
/dev/sdb1             201         700      122000   83  Linux
/dev/sdb2   *         701        1017       77348   83  Linux
/dev/sdb3               1         200       48769+  83  Linux

Partition table entries are not in disk order
hua@hua-desktop:~$ sudo fdisk /dev/sdb                #格U盘

Command (m for help): m                  #命令如上一篇里面介绍。主要是删除(d)和添加(n,p Num),写(w)
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): d                                          #删除分区
Partition number (1-4): 1                  #删除第一分区。我一共有三个分区嘛。

Command (m for help): d
Partition number (1-4): 2

Command (m for help): d
Selected partition 3

Command (m for help): 3                                    #已经删除过了,
3: 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): p                            #查看

Disk /dev/sdb: 254 MB, 254279680 bytes
8 heads, 61 sectors/track, 1017 cylinders
Units = cylinders of 488 * 512 = 249856 bytes
Sector size (logical / optimal IO): 512 bytes / 512 bytes
Disk identifier: 0x00015b81

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n                 #添加一个分区
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1017, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1017, default 1017):
Using default value 1017                    #默认,就是从1-1017都算上,就只有一个了。

Command (m for help): p

Disk /dev/sdb: 254 MB, 254279680 bytes
8 heads, 61 sectors/track, 1017 cylinders
Units = cylinders of 488 * 512 = 249856 bytes
Sector size (logical / optimal IO): 512 bytes / 512 bytes
Disk identifier: 0x00015b81

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        1017      248117+  83  Linux

Command (m for help): q                                               #我直接退出了,这样就没有写操作,是不成功的,也就是说刚才的操作不成功。
hua@hua-desktop:~$ sudo fdisk /dev/sdb           #查看一下,果然没有变。下面格成三个分区。

Command (m for help): p                                  #杳看。

Disk /dev/sdb: 254 MB, 254279680 bytes
8 heads, 61 sectors/track, 1017 cylinders
Units = cylinders of 488 * 512 = 249856 bytes
Sector size (logical / optimal IO): 512 bytes / 512 bytes
Disk identifier: 0x00015b81

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1             201         700      122000   83  Linux
/dev/sdb2   *         701        1017       77348   83  Linux
/dev/sdb3               1         200       48769+  83  Linux

Partition table entries are not in disk order

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 (m for help): d                #删除1
Partition number (1-4): 1

Command (m for help): d                                                       
#删除2
Partition number (1-4): 2

Command (m for help): d                                                     
#删除3
Selected partition 3

Command (m for help): p                                   #查看。

Disk /dev/sdb: 254 MB, 254279680 bytes
8 heads, 61 sectors/track, 1017 cylinders
Units = cylinders of 488 * 512 = 249856 bytes
Sector size (logical / optimal IO): 512 bytes / 512 bytes
Disk identifier: 0x00015b81

   Device Boot      Start         End      Blocks   Id  System                #都没有了。

Command (m for help): n                                                                  #添加分区
Command action
   e   extended                                        #扩展分区
   p   primary partition (1-4)                   #主分区
p                                                                                         #先添加主分区
Partition number (1-4): 1                                                        #主分区号 。。。选1就是  /dev/sd1
First cylinder (1-1017, default 1):                                            #输入1,或者是默认             (cylinder是圆柱体,这里面应该是磁道数吧。)
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1017, default 1017):
Using default value 1017

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
hua@hua-desktop:~$ sudo mount /dev/sdb1 /media/floppy0/
hua@hua-desktop:~$ ls
examples.desktop  公共的  视频  文档  音乐
Pupp汉化.doc      模板    图片  下载  桌面
hua@hua-desktop:~$ sudo mou
mount            mount.fuse       mount.ntfs-3g    mountpoint
mountall         mount.ntfs       mount.ntfs-fuse  mousetweaks
hua@hua-desktop:~$ sudo mount /dev/sdb
sdb   sdb1  
hua@hua-desktop:~$ fdisk /dev/sdb

Unable to open /dev/sdb
hua@hua-desktop:~$ sudo fdisk /dev/sdb

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 (m for help): p

Disk /dev/sdb: 254 MB, 254279680 bytes
8 heads, 61 sectors/track, 1017 cylinders
Units = cylinders of 488 * 512 = 249856 bytes
Sector size (logical / optimal IO): 512 bytes / 512 bytes
Disk identifier: 0x00015b81

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        1017      248117+  83  Linux

Command (m for help): d
Selected partition 1

Command (m for help): a
Partition number (1-4): q^C
hua@hua-desktop:~$ fdisk /dev/sdb

Unable to open /dev/sdb
hua@hua-desktop:~$ sudo fdisk /dev/sdb

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 (m for help): p

Disk /dev/sdb: 254 MB, 254279680 bytes
8 heads, 61 sectors/track, 1017 cylinders
Units = cylinders of 488 * 512 = 249856 bytes
Sector size (logical / optimal IO): 512 bytes / 512 bytes
Disk identifier: 0x00015b81

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        1017      248117+  83  Linux

Command (m for help): d
Selected partition 1

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1017, default 1): 1
Last cylinder, +cylinders or +size{K,M,G} (1-1017, default 1017): 1017

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
hua@hua-desktop:~$ sudo mkfs.ext3 /dev/sdb
mke2fs 1.41.10 (10-Feb-2009)
/dev/sdb is entire device, not just one partition!
无论如何也要继续? (y,n) n
hua@hua-desktop:~$ sudo mkfs.ext3 /dev/sdb1
mke2fs 1.41.10 (10-Feb-2009)
文件系统标签=
操作系统:Linux
块大小=1024 (log=0)
分块大小=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
62248 inodes, 248116 blocks
12405 blocks (5.00%) reserved for the super user
第一个数据块=1
Maximum filesystem blocks=67371008
31 block groups
8192 blocks per group, 8192 fragments per group
2008 inodes per group
Superblock backups stored on blocks:
    8193, 24577, 40961, 57345, 73729, 204801, 221185

正在写入inode表: 完成                            
Creating journal (4096 blocks): 完成
Writing superblocks and filesystem accounting information: 完成

This filesystem will be automatically checked every 20 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
hua@hua-desktop:~$ ls
examples.desktop  公共的  视频  文档  音乐
Pupp汉化.doc      模板    图片  下载  桌面
hua@hua-desktop:~$ cls
No command 'cls' found, but there are 19 similar ones
cls: command not found
hua@hua-desktop:~$ clear

hua@hua-desktop:~$ sudo fidsk /dev/sdb
[sudo] password for hua:
hua@hua-desktop:~$ umount /media/
/media/Core   /media/Study  
hua@hua-desktop:~$ clear















到这里都是没有多大用处的,我用颜色注释一下。
*/



hua@hua-desktop:~$ sudo umount /media/                              #先卸载U盘
Core/  Study/
hua@hua-desktop:~$ sudo umount /media/Core/
[sudo] password for hua:
hua@hua-desktop:~$ sudo fdisk /dev/sdb                         #操作开始

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 (m for help): p                     #查看

Disk /dev/sdb: 254 MB, 254279680 bytes
8 heads, 61 sectors/track, 1017 cylinders
Units = cylinders of 488 * 512 = 249856 bytes
Sector size (logical / optimal IO): 512 bytes / 512 bytes
Disk identifier: 0x00015b81

   Device Boot      Start         End      Blocks   Id  System                 #只有一个分区
/dev/sdb1               1        1017      248117+  83  Linux

Command (m for help): d                                                                 #删除那一个分区
Selected partition 1

Command (m for help): p                        #看一下,什么都没有了。

Disk /dev/sdb: 254 MB, 254279680 bytes
8 heads, 61 sectors/track, 1017 cylinders
Units = cylinders of 488 * 512 = 249856 bytes
Sector size (logical / optimal IO): 512 bytes / 512 bytes
Disk identifier: 0x00015b81

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n                       #添加分区
Command action
   e   extended                                                                                                   ##扩展分区
   p   primary partition (1-4)                         #主分区
p                                                                                #选加主分区
Partition number (1-4): 1               #选1,相当于是/dev/sdb1
First cylinder (1-1017, default 1): 1            #选1,这是从第一个柱面开始,默认也可
Last cylinder, +cylinders or +size{K,M,G} (1-1017, default 1017): 200   #默认1017,当然不能默认,我选200

Command (m for help): p                 #再查看一下。多了一个分区

Disk /dev/sdb: 254 MB, 254279680 bytes
8 heads, 61 sectors/track, 1017 cylinders
Units = cylinders of 488 * 512 = 249856 bytes
Sector size (logical / optimal IO): 512 bytes / 512 bytes
Disk identifier: 0x00015b81

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         200       48769+  83  Linux

Command (m for help): n                                        #继续添加
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (201-1017, default 201):    
Using default value 201
Last cylinder, +cylinders or +size{K,M,G} (201-1017, default 1017): 500

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (501-1017, default 501):
Using default value 501
Last cylinder, +cylinders or +size{K,M,G} (501-1017, default 1017):
Using default value 1017

Command (m for help): p                                                  #都添加好了。查看一下

Disk /dev/sdb: 254 MB, 254279680 bytes
8 heads, 61 sectors/track, 1017 cylinders
Units = cylinders of 488 * 512 = 249856 bytes
Sector size (logical / optimal IO): 512 bytes / 512 bytes
Disk identifier: 0x00015b81

   Device Boot      Start         End      Blocks   Id  System               #OK
,有三个。格式是linux 系统的
/dev/sdb1               1         200       48769+  83  Linux
/dev/sdb2             201         500       73200   83  Linux
/dev/sdb3             501        1017      126148   83  Linux

Command (m for help): w                     #写入,非常的重要,没有这步相当于做梦一声。

The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

最后是格式化:
sudo mkfs.ext3 /dev/sdb1                         #格成ext3的,要多一个文件吧。
sudo mkfs.vfat -F 32 -n disk /dev/sdb1        #通用的格式
其实不用格式化也可以挂载。挂载后再格式化也可以。

好了,就这么多了。
阅读(1292) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~