linux下如何格式化U盘

linux下如何格式化U盘
2009-07-26 15:14
[root@localhost /]# df

文件系统 1K-块 已用 可用 已用% 挂载点
/dev/sda7 30233896 7191424 21506660 26% /
/dev/sda9 61076224 8340772 49632904 15% /home
/dev/sda6 1004024 24996 928024 3% /boot
tmpfs 512672 76 512596 1% /dev/shm
/dev/sda5 40955680 5243424 35712256 13% /media/_wind
/dev/sda1 20472816 9167072 11305744 45% /media/WINXP
/dev/sdb 255732 245204 10528 96% /media/disk
[root@localhost /]# mkfs.ext2 /dev/sdb
mke2fs 1.41.3 (12-Oct-2008)
/dev/sdb is entire device, not just one partition!
Proceed anyway? (y,n) y
/dev/sdb is mounted; will not make a filesystem here!
[root@localhost /]# umount /media/disk
[root@localhost /]# df
文件系统 1K-块 已用 可用 已用% 挂载点
/dev/sda7 30233896 7191424 21506660 26% /
/dev/sda9 61076224 8340788 49632888 15% /home
/dev/sda6 1004024 24996 928024 3% /boot
tmpfs 512672 76 512596 1% /dev/shm
/dev/sda5 40955680 5243424 35712256 13% /media/_wind
/dev/sda1 20472816 9167072 11305744 45% /media/WINXP
[root@localhost /]# mkfs.ext2 /dev/sdb
mke2fs 1.41.3 (12-Oct-2008)
/dev/sdb is entire device, not just one partition!
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
64000 inodes, 256000 blocks
12800 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
32 block groups
8192 blocks per group, 8192 fragments per group
2000 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729, 204801, 221185

Writing inode tables: done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 27 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@localhost /]# dfdisk -l
-bash: dfdisk: command not found
[root@localhost /]# fdisk -l

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x041f041e

Device Boot Start End Blocks Id System
/dev/sda1 * 1 2550 20482843+ c W95 FAT32 (LBA)
/dev/sda2 2551 19457 135805477+ f W95 Ext'd (LBA)
/dev/sda5 2551 7650 40965718+ b W95 FAT32
/dev/sda6 7651 7777 1020096 83 Linux
/dev/sda7 7778 11601 30716248+ 83 Linux
/dev/sda8 11602 11732 1052226 82 Linux swap / Solaris
/dev/sda9 11733 19457 62051031 83 Linux

Disk /dev/sdb: 262 MB, 262144000 bytes
9 heads, 56 sectors/track, 1015 cylinders
Units = cylinders of 504 * 512 = 258048 bytes
Disk identifier: 0x00000000

Disk /dev/sdb doesn't contain a valid partition table
[root@localhost /]#

插入U盘后,先用df查看设备号,再执行umount进行卸载,然后执行格式化命令mkfs.ext2 /dev/sdb。执行umount操作后,虽然用df -l看不到U盘的相关信息,但用fdisk -l是可以看到的
posted @ 2011-10-28 14:19  general001  阅读(1313)  评论(0编辑  收藏  举报