fdisk -l 命令看当前磁盘信息
[root@roswell root]# 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):
Command (m for help): p --打印待分区的磁盘信息
Disk /dev/sdb: 50.0 GB, 50019202560 bytes
255 heads, 63 sectors/track, 6081 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
Command (m for help):
Command (m for help): n --进行磁盘分区
Command action
e extended
p primary partition (1-4)
p --e:逻辑分区 p:主分区,4个主分区
Partition number (1-4): 1 --划分为第一个主分区
First cylinder (1-6081, default 1): 1 --起始磁盘数,不填默认为1
Last cylinder or +size or +sizeM or +sizeK (1-6081, default 6081): 6081 --定义该分区大小,不填默认为全部可用存储额
Command (m for help):
Command (m for help): p --打印待分区的磁盘信息
Disk /dev/sdb: 50.0 GB, 50019202560 bytes
255 heads, 63 sectors/track, 6081 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 6081 48845601 83 Linux
Command (m for help):
Command (m for help): w --执行分区操作,等待命令结束
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
二、格式化分区
[root@roswell root]# mkfs -t ext3 /dev/sdb1 --格式化为ext3格式
mke2fs 1.32 (09-Nov-2002)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
6111232 inodes, 12211400 blocks
610570 blocks (5.00%) reserved for the super user
First data block=0
373 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 38 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
三、挂载分区
[root@roswell root]# vi /etc/fstab --用vi编辑器,编辑磁盘挂载配置文件
LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
LABEL=/export /export ext3 defaults 1 2
none /proc proc defaults 0 0
none /dev/shm tmpfs defaults 0 0
/dev/sdb2 swap swap defaults 0 0
/dev/cdrom /mnt/cdrom udf,iso9660 noauto,owner,kudzu,ro 0 0
/dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0
/dev/sdb1 /media ext3 defaults 1 2
--把/dev/sdb1挂载到/media目录下,“defaults” 是挂载时所要设定的参数(只读,读写,启用quota等),输入defaults包括的参数有(rw、dev、exec、auto、nouser、async) ,“1”是使用dump是否要记录,0是不要。 “2”是开机时检查的顺序,是boot系统文件就为1,其他文件系统都为2,如不要检查就为0
[root@roswell export]# mount /dev/sdb1 --挂载命令执行
四、查看挂载分区
[root@roswell media]# df -h --查看挂载分区
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 8.3G 2.4G 5.5G 30% /
/dev/sda2 99M 26M 69M 27% /boot
/dev/sdc1 16G 13G 2.3G 85% /export
none 250M 0 250M 0% /dev/shm
/dev/sdb1 46G 33M 44G 1% /media
5558

被折叠的 条评论
为什么被折叠?



