您的位置:首页 > 运维架构 > Linux

linux分区与格式化(ubuntu)

2008-10-15 15:23 525 查看
linux下格式化硬盘:
fdisk -l //查看硬盘分区默认是fdisk /dev/sda -l,也可能能过指定设备查看,如fdisk /dev/sdb -l(如果存在该硬盘)
fdisk /dev/sda,进入命令行进行分区管理。
Command (m for help): m //工作出现提示符,输入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)
要创建新的分区键入n,提示你是划分主分区,还是逻辑分区
指定分区大小是以(10240MB),注意单位,如果不使用单位,会认为是硬盘的扇区块,不能超过总的大小
划分完成后别忘输入w,将分区写入分区表。

创建分区选择需要格式化的形式,使用mkfs.*,对就不同的分区格式,如mkfs.ext3,mkfs.vfat

linux系统对优盘实现自动挂载,在/media目录下,如:disk-2
使用mount命令可以查看目前所有挂载的盘符,找到优盘对应的设备如:/dev/sdc
$mount
proc on /proc type proc (rw,noexec,nosuid,nodev)
/sys on /sys type sysfs (rw,noexec,nosuid,nodev)
varrun on /var/run type tmpfs (rw,noexec,nosuid,nodev,mode=0755)
varlock on /var/lock type tmpfs (rw,noexec,nosuid,nodev,mode=1777)
udev on /dev type tmpfs (rw,mode=0755)
devshm on /dev/shm type tmpfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
lrm on /lib/modules/2.6.24-20-generic/volatile type tmpfs (rw)
securityfs on /sys/kernel/security type securityfs (rw)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
none on /proc/fs/vmblock/mountPoint type vmblock (rw)
gvfs-fuse-daemon on /root/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev)
/dev/sda7 on /media/disk type ext3 (rw,nosuid,nodev,uhelper=hal)
/dev/sdb on /media/disk-1 type vfat (rw,nosuid,nodev,uhelper=hal,shortname=mixed,uid=0,utf8,umask=077,flush)
/dev/sdc on /media/disk-2 type vfat -----这就是我的优盘 (rw,nosuid,nodev,uhelper=hal,shortname=mixed,uid=0,utf8,umask=077,flush)
$
此时优盘处于使用状态,如果想格式化优盘,先得将优盘卸载

sudo umount /media/disk-2
再在终端上输入
mkfs.vfat -I /dev/sdc
这样就可以了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: