Lab 6 Adding New Filesystems to the Filesystem Tree

Goal: Develop skills and knowlege related to partitioning and filesystems

Estimated Duration: 60 minutes

Sequence 1: Creating and Mounting Filesystems

Instructions:

1. Use fdisk -l to locate information about your harddisk. Depending on hardware you will see either a /dev/sda or /dev/hda disk. Partition sizes are given in cylinders.

2. Now use fdisk to add a new logical partition that is 1GB to 2GB in size. Create an extended partition (if necessary) that uses the rest of the drive before creating the logical partition. (Make sure to write the changes to disk using the w command.). Run fdisk -l to verify that the partition was created.

fdisk requires a single disk device as parameter. If your workstation is equipped with a SATA drive this is /dev/sda. Otherwise use /dev/hda.

# fdisk /dev/hda

The following commands are all within fdisk:

a. Within fdisk, type p to print the current partition table. Verify that the drive already has an extended partition. If there is none, create one that spans the rest of the disk now:

• Press n for a new partition

• e to create an extended partition

• as the partition number

• First cylinder: First unused cylinder is default, so type Enter here

• Last cylinder: Last cylinder of disk is default, press Enter

b. Create a new logical partition.

• n for a new partition

• l (the letter L) to create an logical partition (skipped if no primary partitions left)

• First cylinder: Enter

• Last cylinder: +1024M

c. Write the new partition table with w. This will also terminate the fdisk command

3. Run cat /proc/partitions. Why does the new partition not show up?

The kernel has not reread its partition table

4. Reboot to reread the revised partition table or use partprobe to refresh the kernel's view of the partition table.

5. Create an ext3 filesystem on the new partition. Use 2 KB sized blocks and one inode per every 4 KB of disk space. Assign the label opt to the filesystem, mount it on the filesystem tree at /opt. Make sure that the system mounts this filesystem after reboot.

The example solution uses the mkfs.ext3 command. mke2fs with the -j option could have also been used. The -L option sets the filesystem label, we could have just as easily used a separate call to e2label after we created the filesystem. As is the case with just about all our examples, there is more than one way to do it.

a. # mkfs.ext3 -L opt -b 2048 -i 4096 device

b. # mkdir /opt

c. Edit /etc/fstab:

LABEL=opt /opt ext3 defaults 1 2

d. Use the mount -a command to mount the new file system on /opt. Were there any errors? If so check the syntax of the /etc/fstab and try again. Use the mount command, this time with no options, to confirm that /opt mounted properly. Copy /
etc/passwd into /opt and verify that the copy was successful.

e. Reboot the system to verify that the filesystem is automatically mounted after boot.

6. CLEANUP:

a. Unmount /opt and comment out the line in /etc/fstab that references /opt.

# umount /opt

b. Edit /etc/fstab:

#LABEL=opt /opt ext3 defaults 1 2

c. Use fdisk to delete the partition you just created. Hint: The last partition created will be the partition with the highest number.

Run fdisk on the disk device from earlier in the unit.

# fdisk /dev/hda

(Following commands are all within fdisk.)

d. Delete the last partition on the list.

• d for a delete partition

• Choose the highest number listed. For example, if it says:

Partition Number (1-5):

Choose

• Write the new partition table with w. This will also terminate the fdisk command

e. Run partprobe to refresh the kernel's view of the partition table.

Sequence 2: Mounting an NFS Filesystem

Instructions:

1. Ensure that iptables firewalling is disabled.

# service iptables stop
# chkconfig iptables off

2. Mount the export server1:/var/ftp/pub persistently at /mnt/server1.

a. # mkdir /mnt/server1

b. Edit /etc/fstab:

server1:/var/ftp/pub /mnt/server1 nfs defaults 0 0

c. Use the mount -a command to mount the export on /mnt/server1 and check for errors in the /etc/fstab

d. Reboot your system to test.

# init 6

Sequence 3: Automounting data with autofs

Instructions:

1. Ensure that iptables firewalling is disabled.

# service iptables stop
# chkconfig iptables off

2. Configure automounter to mount server1:/var/ftp/pub to /misc/server1.

a. Edit the /etc/auto.master file. Uncomment the first line for /misc.

b. Add a line to the /etc/auto.misc file that will mount the /var/ftp/pub export from server1.example.com to your own /misc/server1 target:

server1 -ro,intr,hard server1:/var/ftp/pub

c. Restart the autofs service:

# service autofs restart

d. Try to access the /misc/server1 directory.

3. Use the automounter to mount the home directories for your NIS users from server1.example.com. You can use getent passwd to see what home directories are assigned. server1.example.com exports /home/guests to your system.

a. Begin by editing /etc/auto.master and add the following line:

/home/guests /etc/auto.guests --timeout=60

This line specifies that /etc/auto.guests defines mount points in /home/guests managed by the automounter. When not in use for more than 60 seconds, filesystems mounted on those mount points are automatically unmounted.

b. Create and edit /etc/auto.guests so it contains the line

* -rw,soft,intr 192.168.0.254:/home/guests/&

This line specifies that access to any immediate subdirectory of /home/guests should make autofs mount a NFS export from 192.168.0.254 where the & is the same as the name of the local subdirectory. (So the automounter would mount 192.168.0.254:/home/guests/guest2001 on /home/guests/ guest2001). The middle column specifies the mount options that will be used; readwrite, timeout eventually if the NFS server is not available, and timeout immediately if an interrupt is sent.

c. Configure autofs to start in run levels 2, 3, 4, and 5, then restart it manually:

[root@stationX]# chkconfig autofs on ; service autofs restart

d. Now try logging in again and see whether the home directory gets mounted automatically. It should. Try logging into to your neighbors system once it is also configured. You should be able to access your home environment from any system in the notexample domain.

RH133读书笔记(6) - Lab 6 Adding New Filesystems to the Filesystem Tree的更多相关文章

  1. RH133读书笔记(8)-Lab 8 Manage Network Settings

    Lab 8 Manage Network Settings Goal: To build skills needed to manually configure networking Estimate ...

  2. RH133读书笔记(1)-Lab 1 Managing Startup

    Lab 1 Managing Startup Goal: To familiarize yourself with the startup process System Setup: A system ...

  3. RH133读书笔记(2)-Lab 2 Working with packages

    Lab 2 Working with packages Goal: To gain working experience with package management System Setup: A ...

  4. RH133读书 笔记(5) - Lab 5 User and Group Administration

    Lab 5 User and Group Administration Goal: To build skills for user and group administration. Estimat ...

  5. RH133读书 笔记(4) - Lab 4 System Services

    Lab 4 System Services Goal: Develop skills using system administration tools and setting up and admi ...

  6. RH133读书 笔记(3) - Lab 3 Configuring the kernel

    Lab 3 Configuring the kernel Goal: Develop skills tuning the /proc filesystem. Gain some experience ...

  7. RH133读书笔记(9)-Lab 9 Installation and System-Initialization

    Lab 9 Installation and System-Initialization Goal: Successfully install Red Hat Enterprise Linux. Sy ...

  8. RH133读书笔记(7)-Lab 7 Advanced Filesystem Mangement

    Lab 7 Advanced Filesystem Mangement Goal: Develop skills and knowlege related to Software RAID, LVM, ...

  9. RH133读书笔记(10)-Lab 10 Exploring Virtualization

    Lab 10 Exploring Virtualization Goal: To explore the Xen virtualization environment and the creation ...

随机推荐

  1. Java UML描述

      开发Java应用程序时,开发者要想有效地利用统一建模语言(UML),必须全面理解UML元素以及这些元素如何映射到Java.本文重点讨论UML类图中的元素. 类图是最常用的UML图,它用于描述系统的 ...

  2. sharepoint 2013 userprofile 用户信息

    Sharepoint2013获得当前用户userfrofile 基本介绍: 什么使用户配置文件. 用户属性和用户配置文件属性提供有关 SharePoint 用户的信息,如显示名称.电子邮件.标题以及其 ...

  3. XSS学习笔记(一个)-点击劫持

    所谓XSS这个场景被触发XSS地方,在大多数情况下,攻击者被嵌入在网页中(问题)该恶意脚本(Cross site Scripting),这里的攻击始终触发浏览器端,攻击的者的目的.一般都是获取用户的C ...

  4. FluentData

    FluentData微型ORM 最近在帮朋友做一个简单管理系统,因为笔者够懒,但是使用过的NHibernate用来做这中项目又太不实际了,索性百度了微型ORM,FluentData是第一个跳入我眼睛的 ...

  5. SecureCRT 6.7.1 注冊机 和谐 破解 补丁 方法

    之前一直在用SecureCRT 6.5.3 版本号,和谐补丁也好找,甚至中文版本号也可找到(眼下仅仅找到了SecureCRT.6.2.0) 可是换为 6.7.1 后就怎么也注冊不了了.. 没办法试了各 ...

  6. 解决.net的堆碎片化带来的内存占用过大的问题

    场景 使用WCF开发的服务端在多个客户端登录后,其服务器的内存占用不断增加. 分析 使用Windbg分析得到内存碎片化严重,其中包含了非常大的空闲空间,最大的一块竟然有150M,真正使用的空间其实很小 ...

  7. 经典排序算法 - 高速排序Quick sort

    经典排序算法 - 高速排序Quick sort 原理,通过一趟扫描将要排序的数据切割成独立的两部分,当中一部分的全部数据都比另外一部分的全部数据都要小,然后再按此方法对这两部分数据分别进行高速排序,整 ...

  8. struts2原理分析

    正在使用struts之前,我们必须明白servlet执行.因为不管什么J2EE框架支持servlet的. 和servlet正在运行的进程.简单地说,例如,下面的: 1.server接收请求 2.一个过 ...

  9. [Elasticsearch] 控制相关性 (一) - 后面的相关度分值理论计算

    从第一章翻译Elasticsearch官方指南Controlling Relevance一章. 控制相关度(Controlling Relevance) 对于仅处理结构化数据(比方日期.数值和字符枚举 ...

  10. 玩转web之servlet(六)---session介绍及简单使用(登录验证中保存信息)

    在浏览器与服务器进行交互时,往往需要把涉及到的一些数据保存下来,这时就需要使用cookie或session进行状态管理. 这篇文章先来说说session怎么用,首先在servlet中创建一个sessi ...