RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

时间:2024-03-29 20:32:23

考试:

1) RHCSA : 上午    时长:  2:30  总分:300  通过: 210

2) RHCE:  下午  时长: 3:30  总分:300 通过: 210    *****

 

上午一台虚拟机: system1.domain2.example.com

 

考试要点:考试题 在网页查看  中文

 

    1. 认真阅读前考信息:考试域名,网段,主机等等
    2. 填写正确的 名字 拼音上午和下午的名字要一样和 邮箱地址 *****
    3. 考试时,不要自行 还原虚拟机 reset , 如果服务器配置出错,导致服务器无法启动,找考官

 

 

上午:RHCSA   实验演示

 

环境:考试机器 server1   还没有开始做题  server1 没有给root密码   #  server0 

 

    1. 配置主机名:server0.example.com
    2. 配置IP 地址:172.25.0.11 ,子网掩码:255.255.255.0 网关:172.25.0.254,DNS服务器地址:172.25.254.254
    3. 将server0的root密码设置为:Asibean

 

 

 

实验准备:

 

1)配置root密码:Asibean

 

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

按ctrl+x 进入switch_root模式:

 

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

 

重新挂载:/sysroot 目录,以可读写方式挂载

 

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

修改当前的文件系统的根:/sysroot

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

 

修改root密码:

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

重置selinux上下文:

 

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

按两次exit: 等待重启

 

进入系统,无图形,切换到图形:

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

 

 

    1. 配置主机名:server0.example.com

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

 

    1. 配置IP 地址:172.25.0.11 ,子网掩码:255.255.255.0 网关:172.25.0.254,DNS服务器地址:172.25.254.254

 

 

 

将原有的配置文件删除:

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

在线视频观看地址:https://edu.51cto.com/sd/ceb6f

[[email protected] Desktop]#

[[email protected] Desktop]# nmcli connection add con-name network1 ifname eth0 type  ethernet autoconnect yes

Connection 'network1' (6845ed2b-0c6f-4835-aec6-87ca4caafbfc) successfully added.

 

[[email protected] Desktop]# nmcli connection modify network1 ipv4.addresses "172.25.0.11/24 172.25.0.254"

[[email protected] Desktop]#

 

 

 

[[email protected] Desktop]# nmcli connection modify network1 ipv4.addresses "172.25.0.11/24 172.25.0.254"

[[email protected] Desktop]# nmcli connection modify network1 ipv4.dns 172.25.254.254

[[email protected] Desktop]#

[[email protected] Desktop]#

[[email protected] Desktop]# nmcli connection modify network1 ipv4.method manual

[[email protected] Desktop]#

[[email protected] Desktop]#

[[email protected] Desktop]# nmcli connection up network1

Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/2)

[[email protected] Desktop]#

 

 

 

测试:

 

[[email protected] Desktop]# ping 172.25.0.254

PING 172.25.0.254 (172.25.0.254) 56(84) bytes of data.

64 bytes from 172.25.0.254: icmp_seq=1 ttl=64 time=0.620 ms

64 bytes from 172.25.0.254: icmp_seq=2 ttl=64 time=0.827 ms

^C

--- 172.25.0.254 ping statistics ---

2 packets transmitted, 2 received, 0% packet loss, time 1002ms

rtt min/avg/max/mdev = 0.620/0.723/0.827/0.106 ms

[[email protected] Desktop]#

 

做练习:

 

在线视频观看地址:https://edu.51cto.com/sd/ceb6f

1)配置 SELINUX 使其工作在 enforcing 模式下

 

 

 

 

[[email protected] Desktop]#

[[email protected] Desktop]# cat /etc/sysconfig/selinux

 

# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

#     enforcing - SELinux security policy is enforced.

#     permissive - SELinux prints warnings instead of enforcing.

#     disabled - No SELinux policy is loaded.

SELINUX=enforcing

# SELINUXTYPE= can take one of these two values:

#     targeted - Targeted processes are protected,

#     minimum - Modification of targeted policy. Only selected processes are protected.

#     mls - Multi Level Security protection.

SELINUXTYPE=targeted

 

 

[[email protected] Desktop]# reboot  #重启 

 

 

2) 为你的系统配置一个默认的软件仓库,仓库地址如下:

http://classroom.example.com/content/rhel7.0/x86_64/dvd/

 

 

 

 

 

[[email protected] yum.repos.d]# pwd

/etc/yum.repos.d

[[email protected] yum.repos.d]# ls

[[email protected] yum.repos.d]#

 

 

 

[[email protected] yum.repos.d]#

[[email protected] yum.repos.d]# touch http.repo

[[email protected] yum.repos.d]#

[[email protected] yum.repos.d]# vim http.repo

[[email protected] yum.repos.d]# cat http.repo

[http]

name=http repo

baseurl=http://classroom.example.com/content/rhel7.0/x86_64/dvd/

gpgcheck=0

enabled=1

 

[[email protected] yum.repos.d]# yum repolist

Loaded plugins: langpacks

http                                                                                     | 4.1 kB  00:00:00    

(1/2): http/group_gz                                                                     | 134 kB  00:00:00    

(2/2): http/primary_db                                                                   | 3.4 MB  00:00:00    

repo id                                             repo name                                             status

http                                                http repo                                             4,305

repolist: 4,305

[[email protected] yum.repos.d]#

 

3.创建一个(所在卷组大小为 1GB)逻辑卷名为 vo,大小为 200MB,并且格式化为 ext4,开机

挂载在/vo 目录下,然后在线将 vo 的大小调整为 290MB,挂载的文件系统也变为

290MB

 

实验环境要配置的,考试不需要:

[[email protected] /]#

[[email protected] /]# fdisk -l

 

Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

 

 

Disk /dev/sda: 10.7 GB, 10737418240 bytes, 20971520 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk label type: dos

Disk identifier: 0x00013f3e

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *        2048    20970332    10484142+  83  Linux

[[email protected] /]# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.23.2).

 

Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.

 

Device does not contain a recognized partition table

Building a new DOS disklabel with disk identifier 0x89ddc36d.

 

Command (m for help): p

 

Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk label type: dos

Disk identifier: 0x89ddc36d

 

   Device Boot      Start         End      Blocks   Id  System

 

Command (m for help): n

Partition type:

   p   primary (0 primary, 0 extended, 4 free)

   e   extended

Select (default p): p

Partition number (1-4, default 1): 1

First sector (2048-20971519, default 2048):

Using default value 2048

Last sector, +sectors or +size{K,M,G} (2048-20971519, default 20971519): +1G

Partition 1 of type Linux and of size 1 GiB is set

 

Command (m for help): w

The partition table has been altered!

 

Calling ioctl() to re-read partition table.

Syncing disks.

[[email protected] /]#

[[email protected] /]#

[[email protected] /]# fdisk -l

 

Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk label type: dos

Disk identifier: 0x89ddc36d

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1            2048     2099199     1048576   83  Linux

 

Disk /dev/sda: 10.7 GB, 10737418240 bytes, 20971520 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk label type: dos

Disk identifier: 0x00013f3e

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *        2048    20970332    10484142+  83  Linux

[[email protected] /]# pvcreate /dev/sdb1

  /dev/cdrom: open failed: No medium found

  Physical volume "/dev/sdb1" successfully created

[[email protected] /]#

[[email protected] /]#

[[email protected] /]#

[[email protected] /]# vgcreate vg1 /dev/sdb1

  Volume group "vg1" successfully created

[[email protected] /]# vgs

  VG   #PV #LV #SN Attr   VSize    VFree  

  vg1    1   0   0 wz--n- 1020.00m 1020.00m

[[email protected] /]# lvcreate -n vo -L 200M vg1

  Logical volume "vo" created

[[email protected] /]#

[[email protected] /]#

[[email protected] /]# mkfs.ext4 /dev/vg1/vo

mke2fs 1.42.9 (28-Dec-2013)

Filesystem label=

OS type: Linux

Block size=1024 (log=0)

Fragment size=1024 (log=0)

Stride=0 blocks, Stripe width=0 blocks

51200 inodes, 204800 blocks

10240 blocks (5.00%) reserved for the super user

First data block=1

Maximum filesystem blocks=33816576

25 block groups

8192 blocks per group, 8192 fragments per group

2048 inodes per group

Superblock backups stored on blocks:

8193, 24577, 40961, 57345, 73729

 

Allocating group tables: done                           

Writing inode tables: done                           

Creating journal (4096 blocks): done

Writing superblocks and filesystem accounting information: done

 

[[email protected] /]#

[[email protected] /]#

[[email protected] /]#

 

[[email protected] /]#

[[email protected] /]# cat /etc/fstab

 

#

# /etc/fstab

# Created by anaconda on Wed May  7 01:22:57 2014

#

# Accessible filesystems, by reference, are maintained under '/dev/disk'

# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info

#

UUID=9bf6b9f7-92ad-441b-848e-0257cbb883d1 /                       xfs     defaults        1 1

/dev/vg1/vo     /vo   ext4    defaults   0  0 

[[email protected] /]# mount -a

[[email protected] /]#

[[email protected] /]#

[[email protected] /]# df -hT

Filesystem         Type      Size  Used Avail Use% Mounted on

/dev/sda1          xfs        10G  3.1G  7.0G  31% /

devtmpfs           devtmpfs  1.9G     0  1.9G   0% /dev

tmpfs              tmpfs     1.9G  140K  1.9G   1% /dev/shm

tmpfs              tmpfs     1.9G   17M  1.9G   1% /run

tmpfs              tmpfs     1.9G     0  1.9G   0% /sys/fs/cgroup

/dev/mapper/vg1-vo ext4      190M  1.6M  175M   1% /vo

[[email protected] /]#

 

在线视频观看地址:https://edu.51cto.com/sd/ceb6f

解题 :

 

 

[[email protected] /]# df -hT

Filesystem         Type      Size  Used Avail Use% Mounted on

/dev/sda1          xfs        10G  3.1G  7.0G  31% /

devtmpfs           devtmpfs  1.9G     0  1.9G   0% /dev

tmpfs              tmpfs     1.9G  140K  1.9G   1% /dev/shm

tmpfs              tmpfs     1.9G   17M  1.9G   1% /run

tmpfs              tmpfs     1.9G     0  1.9G   0% /sys/fs/cgroup

/dev/mapper/vg1-vo ext4      190M  1.6M  175M   1% /vo

[[email protected] /]# lvextend -L 290M /dev/mapper/vg1-vo

  Rounding size to boundary between physical extents: 292.00 MiB

  Extending logical volume vo to 292.00 MiB

  Logical volume vo successfully resized

[[email protected] /]#

[[email protected] /]#

[[email protected] /]# df -hT

Filesystem         Type      Size  Used Avail Use% Mounted on

/dev/sda1          xfs        10G  3.1G  7.0G  31% /

devtmpfs           devtmpfs  1.9G     0  1.9G   0% /dev

tmpfs              tmpfs     1.9G  140K  1.9G   1% /dev/shm

tmpfs              tmpfs     1.9G   17M  1.9G   1% /run

tmpfs              tmpfs     1.9G     0  1.9G   0% /sys/fs/cgroup

/dev/mapper/vg1-vo ext4      190M  1.6M  175M   1% /vo

 

#ext4:

 

[[email protected] /]# resize2fs /dev/mapper/vg1-vo

resize2fs 1.42.9 (28-Dec-2013)

Filesystem at /dev/mapper/vg1-vo is mounted on /vo; on-line resizing required

old_desc_blocks = 2, new_desc_blocks = 3

The filesystem on /dev/mapper/vg1-vo is now 299008 blocks long.

 

 

#xfs:

 

[[email protected] /]# xfs_growfs /dev/mapper/vg1-vo

 

[[email protected] /]# df -hT

Filesystem         Type      Size  Used Avail Use% Mounted on

/dev/sda1          xfs        10G  3.1G  7.0G  31% /

devtmpfs           devtmpfs  1.9G     0  1.9G   0% /dev

tmpfs              tmpfs     1.9G  140K  1.9G   1% /dev/shm

tmpfs              tmpfs     1.9G   17M  1.9G   1% /run

tmpfs              tmpfs     1.9G     0  1.9G   0% /sys/fs/cgroup

/dev/mapper/vg1-vo ext4      279M  2.1M  259M   1% /vo

[[email protected] /]#

 

 

4.创建用户账号:

创建如下用户,组和组成员关系

名字为 adminuser 的组

用户 natasha,使用 adminuser 作为附属组

用户 harry,使用 adminuser 作为附属组

用户 sarash,在系统中不能访问可交互的 SHELL,且不是 adminuser 组中的成员

natasha,harry,sarash 密码都为:redhat

 

 

 

[[email protected] /]# groupadd  adminuser

[[email protected] /]#

[[email protected] /]#

[[email protected] /]# useradd  natasha

[[email protected] /]# echo "redhat" | passwd --stdin natasha

Changing password for user natasha.

passwd: all authentication tokens updated successfully.

[[email protected] /]#

[[email protected] /]#

[[email protected] /]# useradd  harry

[[email protected] /]#

[[email protected] /]# echo "redhat" | passwd --stdin harry

Changing password for user harry.

passwd: all authentication tokens updated successfully.

[[email protected] /]#

[[email protected] /]#

[[email protected] /]# usermod -aG  adminuser natasha

[[email protected] /]#

[[email protected] /]# usermod -aG  adminuser harry

[[email protected] /]#

[[email protected] /]#

[[email protected] /]# useradd -s /sbin/nologin  sarash

[[email protected] /]#

[[email protected] /]#

[[email protected] /]# echo "redhat" | passwd  --stdin  sarash

Changing password for user sarash.

passwd: all authentication tokens updated successfully.

[[email protected] /]#

[[email protected] /]#

[[email protected] /]#

 

 

 

5.

配置/var/tmp/fstab 的权限:

复制文件/etc/fstab 到/var/tmp/fstab

配置/var/tmp/fstab 的权限如下:

文件/var/tmp/fstab 所有者是 root

文件/var/tmp/fstab 所属组是 root

文件/var/tmp/fstab 不能被任何用户执行

用户 natasha 可读和可写/var/tmp/fstab

用户 harry 不能读写/var/tmp/fstab

所有其他用户(现在和将来的)具有读/var/tmp/fstab 的能力

 

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

 

 

 

在线视频观看地址:https://edu.51cto.com/sd/ceb6f

 

6.

配置一个 cront 计划任务:

用户 natasha 必须配置一个 cron job, 当地时间每天 14:23 运行 /bin/echo hiya

 

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

 

 

 

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

 

 

 

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

 

 

7.

创建一个共享目录:

创建一个共享目录/home/admins,使其具有以下特性:

/home/admins 所属组为 adminuser

目录对组 adminuser 的成员具有可读,可写和可执行的权限

在/home/admins 创建的任何文件所属组自动设置为 adminuser

 

 

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

 

 

8.

安装内核升级:

内核下载地址:

http://classroom.example.com/content/rhel7.0/x86_64/errata/Packages/更新内核作为系

统启动的默认内核,原来的内核在系统启动的时候依然有效和可引导

 

 

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

下载到root家目录下:

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

 

 

等待 安装完成。

 

 

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

 

9.

绑定外部验证服务器:

系统 classrom.example.com 提供了一个 LDAP 的验证服务,你的系统应该按以下内容绑

定服务器:

验证服务的 DN:dc=example,dc=com

服务器地址:classroom.example.com

证书地址:http://classroom.example.com/pub/example-ca.crt

当正确的配置后,ldapuser1 可以登录你的系统,但是没有 home 目录,直到你完成

autofs 题目之后才可以。

 

 

安装四个包:

 

 

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

 

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

 

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

在线视频观看地址:https://edu.51cto.com/sd/ceb6f

10.

配置 NTP:

配置你的系统时间服务器使用以下服务器:classroom.example.com

 

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

 

 

安装图形化配置工具:

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

 

 

 

11.

配置 autofs:

配置 autofs 自动挂载 ldap 用户的家目录,如下要求:

classroom.example.com 使用NFS共享了home 目录给你的系统,这个文件系统包含了预

先配置好的用户 ldapuser1 的 home 目录

ldapuser1 的 home 目录为:classroom.example.com:/home/guests/ldapuser1

ldapuser1 的 home 目录应该自动挂载到本地的/home/guests 目录下的 ldapuser1

 

 

 

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

 

安装:

 

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

 

开机启动

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

 

修改配置文件:将classroom.example.com:/home/guests/ldapuser1  挂载到 server0:/home/guests/ldapuser1

 

 

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

 

 

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

 

12.

配置一个用户账号:

创建一个用户 iar, uid 为 3400,这个户用户的密码是:redhat

 

 

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

 

在线视频观看地址:https://edu.51cto.com/sd/ceb6f

13.

 

 

添加一个 swap 分区:

为你的系统额外添加一个大小为 500MB 的交换分区,这个交换分区在系统启动的时候

应该能自动挂载。不要移除和修改你系统上现有的交换分区。

 

考试时,环境中的/dev/vda,的磁盘已使用了三个主分区,类拟于实验环境如下:

 

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

 

考试需要新建两人分区, 一个用于swap交换,一个用于17题 的卷组的PV,

 

分区时要注意, /dev/sdb已使用了三个主分区,所以不能再划分主分区了 。

 

只能划分扩展分区,再在扩展分区中划分逻辑分区:

 

创建护分区,分配所有空间。

 

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

 

划分逻辑分区,用于swap交换:

 

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

 

 

格式化swap:

 

 

 

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

刷新磁盘分区表:

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

 

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

 

 

14.

 查找文件:

找到所有者是 iar 的文件,并把文件拷贝到/root/findresults 目录中

 

 

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

 

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

在线视频观看地址:https://edu.51cto.com/sd/ceb6f

 

15.

查找一个字符串:

在/usr/share/dict/words 内找到所有包含字符串 seismic 的行,然后把这些内容行依照原

样拷贝到/root/lines.txt 中。

 

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

 

16.

创建名为/root/backup.tar.bz2 的备份文件,其中包含/usr/local 的内容,tar 必须使用

bzip2 压缩

 

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

 

 

 

2020年RHCE7红帽系统工程师认证考试模拟题详解-RHCSA部分

 

 

 

 

17.

 

创建一个逻辑卷:

按照下面的要求创建一个新的逻辑卷

逻辑卷的名字为 database,属于 datastore 卷组中,逻辑卷的大小为 50 个 PE。

datastore 卷组的 PE 大小为 16MB

使用 ext3 格式化这个新的逻辑卷,此逻辑卷在系统启动时自动挂载到/mnt/database 目

录下。

 

 

 

[[email protected] ~]# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.23.2).

 

Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.

 

 

Command (m for help): n

All primary partitions are in use

Adding logical partition 6

First sector (7321600-20971519, default 7321600): 

Using default value 7321600

Last sector, +sectors or +size{K,M,G} (7321600-20971519, default 20971519): +2G

Partition 6 of type Linux and of size 2 GiB is set

 

Command (m for help): w

The partition table has been altered!

 

Calling ioctl() to re-read partition table.

 

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.

The kernel still uses the old table. The new table will be used at

the next reboot or after you run partprobe(8) or kpartx(8)

Syncing disks.

[[email protected] ~]# fdisk -l /dev/sdb

 

Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk label type: dos

Disk identifier: 0x89ddc36d

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1            2048     2099199     1048576   83  Linux

/dev/sdb2         2099200     4196351     1048576   83  Linux

/dev/sdb3         4196352     6293503     1048576   83  Linux

/dev/sdb4         6293504    20971519     7339008    5  Extended

/dev/sdb5         6295552     7319551      512000   83  Linux

/dev/sdb6         7321600    11515903     2097152   83  Linux

[[email protected] ~]#

 

 

[[email protected] ~]# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.23.2).

 

Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.

 

 

Command (m for help): n

All primary partitions are in use

Adding logical partition 6

First sector (7321600-20971519, default 7321600): 

Using default value 7321600

Last sector, +sectors or +size{K,M,G} (7321600-20971519, default 20971519): +2G

Partition 6 of type Linux and of size 2 GiB is set

 

Command (m for help): w

The partition table has been altered!

 

Calling ioctl() to re-read partition table.

 

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.

The kernel still uses the old table. The new table will be used at

the next reboot or after you run partprobe(8) or kpartx(8)

Syncing disks.

[[email protected] ~]# fdisk -l /dev/sdb

 

Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk label type: dos

Disk identifier: 0x89ddc36d

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1            2048     2099199     1048576   83  Linux

/dev/sdb2         2099200     4196351     1048576   83  Linux

/dev/sdb3         4196352     6293503     1048576   83  Linux

/dev/sdb4         6293504    20971519     7339008    5  Extended

/dev/sdb5         6295552     7319551      512000   83  Linux

/dev/sdb6         7321600    11515903     2097152   83  Linux

[[email protected] ~]# pvcreate /dev/sdb6

  Physical volume /dev/sdb6 not found

  Device /dev/sdb6 not found (or ignored by filtering).

[[email protected] ~]# partprobe /dev/sdb

[[email protected] ~]# pvcreate /dev/sdb6

  Physical volume "/dev/sdb6" successfully created

[[email protected] ~]# vgcreate -s 16M datastore /dev/sdb6

  Volume group "datastore" successfully created

[[email protected] ~]#

[[email protected] ~]#

[[email protected] ~]# vgs

  VG        #PV #LV #SN Attr   VSize    VFree 

  datastore   1   0   0 wz--n-    1.98g   1.98g

  vg1         1   1   0 wz--n- 1020.00m 728.00m

[[email protected] ~]# lvcreate -n database -l 50 datastore

  Logical volume "database" created

[[email protected] ~]# lvs

  LV       VG        Attr       LSize   Pool Origin Data%  Move Log Cpy%Sync Convert

  database datastore -wi-a----- 800.00m                                            

  vo       vg1       -wi-ao---- 292.00m                                            

[[email protected] ~]# mkfs.ext3 /dev/datastore/database

mke2fs 1.42.9 (28-Dec-2013)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

Stride=0 blocks, Stripe width=0 blocks

51296 inodes, 204800 blocks

10240 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=209715200

7 block groups

32768 blocks per group, 32768 fragments per group

7328 inodes per group

Superblock backups stored on blocks:

32768, 98304, 163840

 

Allocating group tables: done                           

Writing inode tables: done                            

Creating journal (4096 blocks): done

Writing superblocks and filesystem accounting information: done

 

[[email protected] ~]# mkdir /mnt/database

[[email protected] ~]# vim /etc/fstab

[[email protected] ~]# cat /etc/f

cat: /etc/f: No such file or directory

[[email protected] ~]# cat /etc/fstab

 

#

# /etc/fstab

# Created by anaconda on Wed May  7 01:22:57 2014

#

# Accessible filesystems, by reference, are maintained under '/dev/disk'

# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info

#

UUID=9bf6b9f7-92ad-441b-848e-0257cbb883d1 /                       xfs     defaults        1 1

/dev/vg1/vo     /vo   ext4    defaults   0  0 

/dev/sdb5      swap    swap  defaults    0   0

/dev/datastore/database  /mnt/database   ext3  defaults   0 0

[[email protected] ~]# mount -a

[[email protected] ~]# df -hT

Filesystem                                   Type      Size  Used Avail Use% Mounted on

/dev/sda1                                    xfs        10G  3.4G  6.7G  34% /

devtmpfs                                     devtmpfs  1.9G     0  1.9G   0% /dev

tmpfs                                        tmpfs     1.9G  140K  1.9G   1% /dev/shm

tmpfs                                        tmpfs     1.9G   17M  1.9G   1% /run

tmpfs                                        tmpfs     1.9G     0  1.9G   0% /sys/fs/cgroup

/dev/mapper/vg1-vo                           ext4      279M  2.1M  259M   1% /vo

classroom.example.com:/home/guests/ldapuser1 nfs4       10G  7.0G  3.1G  70% /home/guests/ldapuser1

/dev/mapper/datastore-database               ext3      772M  828K  715M   1% /mnt/database

[[email protected] ~]#

 

 

最后重启服务器,看是否能正常启动。