- 修改开机图片
- 修改
grub.conf
里面的一些配置信息,例如更改开机启动图片 - 首先下载一个张合适的
jpg
图片;
- 然后使用
gimp
修改图片的分辨率和色度
- 然后进行图片的保存,保存为
xpm
格式,并且进行压缩
- 修改虚拟主机的配置文件
/etc/grub.conf
- 重新启动虚拟主机可以查看效果
- 进入单用户模式
- 进入下面的界面
- 使用字母
e
进入编辑界面
- 选择第二项,进入编辑界面
- 在最后添加
s 1 或者singel
进入单用户界面
- 通过
enter
保存修改,然后进入,ESC
进入上一个界面,并且放弃修改
- 使用
b
来启动系统,这里提供了一个小的bash
环境,可以用于修改密码等操作;
- 修改完秘密之后,系统重新启动
- 设置grub密码
- 有时为了防止别人修改进入单用户模式可以设置
grub
密码,这里设置的是一个全局密码
- 如果需要在启动界面编辑
grub
就需要输入密码,这个界面提示,通过p
来输入密码,解锁操作
- 然后就可以进入编辑界面了
- 这样明文存储密码的形式是不安全的;
- 通过
grub
提供的命令保存密码文件的摘要值,然后保存密码的摘要
- 如果将密码文件的位置从全局放到了
title
里面,表示在进入这个title
需要输入密码,一般就是在启动内核时,需要输入密码; - grub损坏的安装操作
- 手动破坏
bootloader
,不应该超过446
字节,否则MBR
就会被破坏
- 这个过程在
rhel5.8
上面探测失败,但是在rhel6.5
上面是成功的,并且可以正常安装,在grub
损坏之后,一定不能够进行重启操作,否则只能够进入紧急救援模式来解决 - 将grub安装在一块磁盘上面
- 首先来创建三个分区,用于
/boot / /swap
[root@server10 ~]# fdisk /dev/vdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x7f89a006.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-16644, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-16644, default 16644): +20M
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (43-16644, default 43):
Using default value 43
Last cylinder, +cylinders or +size{K,M,G} (43-16644, default 16644): +512M
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4):
Value out of range.
Partition number (1-4): 3
First cylinder (1084-16644, default 1084):
Using default value 1084
Last cylinder, +cylinders or +size{K,M,G} (1084-16644, default 16644): +128M
Command (m for help): t
Partition number (1-4): 3
Hex code (type L to list codes): 82
Changed system type of partition 3 to 82 (Linux swap / Solaris)
Command (m for help): p
Disk /dev/vdb: 8589 MB, 8589934592 bytes
16 heads, 63 sectors/track, 16644 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x7f89a006
Device Boot Start End Blocks Id System
/dev/vdb1 1 42 21136+ 83 Linux
/dev/vdb2 43 1083 524664 83 Linux
/dev/vdb3 1084 1344 131544 82 Linux swap / Solaris
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@server10 ~]# partprobe /dev/vdb
- 然后进行格式化
[root@server10 ~]# mke2fs /dev/vdb1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
5304 inodes, 21136 blocks
1056 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=21757952
3 block groups
8192 blocks per group, 8192 fragments per group
1768 inodes per group
Superblock backups stored on blocks:
8193
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 28 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@server10 ~]# mke2fs /dev/vdb2
mke2fs 1.41.12 (17-May-2010)
warning: 94 blocks unused.
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
32832 inodes, 131072 blocks
6558 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=134217728
4 block groups
32768 blocks per group, 32768 fragments per group
8208 inodes per group
Superblock backups stored on blocks:
32768, 98304
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 28 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
- 格式化第三个分区
[root@server10 ~]# mkswap /dev/vdb3
Setting up swapspace version 1, size = 131540 KiB
no label, UUID=07e6a110-06f2-47f0-98bb-8178d9c19009
- 创建几个需要的目录
[root@server10 ~]# mkdir /mnt/boot
[root@server10 ~]# mount /dev/vdb2 /mnt/boot/
- 然后安装
grub
[root@server10 ~]# grub-install --root-directory=/mnt/ /dev/vdb
Installation finished. No error reported.
This is the contents of the device map /mnt//boot/grub/device.map.
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install'.
(fd0) /dev/fd0
(hd0) /dev/vda
(hd1) /dev/vdb
- 通常会自动生成下面这些文件
- 编辑一个配置文件
default=0
timeout=5
title FakeLinux
root (hd0,0)
kernel /vmlinux
initrd /initramfs
- 找到这块硬盘使用的文件
- 将当前的虚拟主机挂起
- 然后按照下面的步骤执行
- 选择磁盘文件
- 选择下一步安装
- 选择
yes
- 选择主机内存网卡的配置信息
启动这个主机查看
grub
页面
grub损毁
- 如果配置文件丢失会进入这个页面
- 在这个页面,查找根文件所在的位置,在这个界面其实是你手动指定了根文件,
initrd
文件所在的位置,来代替grub.vonf
文件的作用;
- 最后使用
boot
命令,系统进入启动页面 - 按照上面的操作出现了下面的错误
- 这个错误是没有正确的传递
root
参数导致的,网上的教程都是不传递这个参数的,但是在这里不传递就会出现错误; - 这个参数的传递需要参考配置文件的说明
- 因为操作系统是使用卷组的方式安装的,所以需要指定
root=/dev/mapper/VolGroup-lv_root
,传递参数错误会导致无法启动; - 启动之后,需要手动创建配置文件