实 验 报 告
题 目: 院 系: 专 业: 班 级: 姓 名: 学 号: 指导教师:
项目三、Linux文件系统与磁盘管理
计算机系 软件工程 2010级?班 ?? 2010???? 何东彬 2012 年 3 月 28 日
实训项目3-1 Linux文件系统与磁盘管理
一、实训目的
● 掌握Linux下文件系统的创建、挂载与卸载。 ● 掌握文件系统的自动挂载。
二、项目背景
某企业的Linux服务器中新增了一块硬盘/dev/sdb,请使用fdisk命令新建/dev/sdb1主分区和/dev/sdb2扩展分区,并在扩展分区中新建逻辑分区/dev/sdb5,并使用mkfs命令分别创建vfat和ext3文件系统。然后用fsck命令检查这两个文件系统;最后,把这两个文件系统挂载到系统上。
三、实训内容
练习Linux系统下文件系统的创建、挂载与卸载及自动挂载的实现。
四、实训步骤
子项目1.创建/dev/sdb1和/dev/sdb5
●首先查看磁盘情况,使用fdisk命令 # fdisk -l
Disk /dev/sda: 21.5 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00001a36
Device Boot Start End Blocks Id System /dev/sda1 * 1 26 204800 83 Linux Partition 1 does not end on cylinder boundary.
/dev/sda2 26 154 1024000 82 Linux swap / Solaris Partition 2 does not end on cylinder boundary.
/dev/sda3 154 2611 19741696 83 Linux
Disk /dev/sdb: 10.7 GB, 10737418240 bytes 255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00023207
Device Boot Start End Blocks Id System
Disk /dev/sdc: 10.7 GB, 10737418240 bytes 255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000454a1
Device Boot Start End Blocks Id System
Disk /dev/sdd: 10.7 GB, 10737418240 bytes 255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000d37fe
Device Boot Start End Blocks Id System
●使用fdisk命令创建/dev/sdb1主分区。
● 使用fdisk命令创建/dev/sdb2扩展分区。
● 使用fdisk命令创建/dev/sdb5逻辑分区。
Command (m for help): n (输入n) Command action
l logical (5 or over)
p primary partition (1-4)
l (输入1)
First cylinder (51-1305, default 51): (直接回车,默认51) Using default value 51
Last cylinder, +cylinders or +size{K,M,G} (51-1305, default 1305): 130 (输入130)
Command (m for help): p (输入p)
Disk /dev/sdb: 10.7 GB, 10737418240 bytes 255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00023207
Device Boot Start End Blocks Id System /dev/sdb1 1 50 401593+ 83 Linux /dev/sdb2 51 1305 10080787+ 5 Extended /dev/sdb5 51 130 642568+ 83 Linux
Command (m for help): w (输入w输入子命令w,把设置写入硬盘分区表) The partition table has been altered!
Calling ioctl() to re-read partition table. Syncing disks.
● 退出fdisk并重新启动系统。
● 用mkfs命令在上述刚刚创建的分区上创建ext3文件系统和vfat文件系统。
# mkfs -t ext4 /dev/sdb1 # mkfs.vfat /dev/sdb5
● 用fsck命令检查上面创建的文件系统。 # fsck /dev/sdb1
fsck from util-linux-ng 2.17.2 e2fsck 1.41.12 (17-May-2010)
/dev/sdb1: clean, 11/100744 files, 22970/401409 blocks # fsck /dev/sdb5
子项目2.挂载/dev/sdb1和/dev/sdb5
● 利用mkdir命令,在/mnt目录下建立挂载点,mountpoint1和mountpoint2。 # mkdir /mnt/mountpoint1 /mnt/mountpoint2
● 把上述新创建的ext4分区挂载到/mnt/mountpoint1上。 #mount -t ext4 /dev/sdb1 /mnt/mountpoint1
● 把上述新创建的vfat分区挂载到/mnt/mountpoint2上。 # mount -t vfat /dev/sdb5 /mnt/mountpoint2
● 利用mount命令列出挂载到系统上的分区,查看挂载是否成功。 # mount
/dev/sda3 on / type ext4 (rw) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext=\/dev/sda1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw) vmware-vmblock on /var/run/vmblock-fuse type fuse.vmware-vmblock (rw,nosuid,nodev,default_permissions,allow_other) sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)