标签:分区 nts 必须 ica anaconda size may 行操作 原因分析
U盘安装LINUX系统,拔除U盘后无法引导系统使用U盘安装LINUX操作系统,拔除U盘后,无法正常引导系统,必须插入U盘才可以进入系统。
GRUB全.称为.Grand Unified Boot Loader,是Linux操.作系统主流的启动引导管理器。主要作用是启动和装载Linux操作系统。系统启动过程中一旦完成了BIOS自检,GRUB会被立刻装载。在GRUB里面包含了可以载入操作系统的代码以及将操作系统引导权传递给其他启动引导管理器的代码。GRUB可以允许用户选择使用不同的kernel启动系统,或者在启动系统的过程中设置不同的启动参数。
客户在安装LINUX操作系统过程中,使用的是U盘方式安装,引导的grub信息被默认安装到了U盘的MBR中,拔除U盘后启动过程无法读取相应的启动管理器的代码信息,导致系统无法启动。
重新安装系统的grub信息到本地硬盘MBR,并修改/boot/grub/grub.conf文件。操作步骤如下:
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 48G 2.1G 44G 5% /
tmpfs 3.9G 0 3.9G 0% /dev/shm
/dev/sda1 190M 40M 141M 22% /boot
/dev/sda4 409G 742M 409G 1% /data
[root@localhost ~]#
[root@localhost ~]# grub
Probing devices to guess BIOS drives. This may take a long time.
GNU GRUB version 0.97 (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename.]
grub>root(hd0,0) # (hd0,0)表示安装到系统识别的第一块硬盘中的第一个分区。
grub>setup(hd0)
grub> quit
quit
[root@localhost ~]#
系统中包含有独立的/boot分区时,使用
grub-install /dev/hda(如果是SCSI或SAS硬盘,设备名称可能不同,请使用fdisk -l命令进行查询。)
例如:
[root@localhost ~]# fdisk -l
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 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: 0x000db1d7
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 6400 51200000 83 Linux
/dev/sda3 6400 7420 8192000 82 Linux swap / Solaris
/dev/sda4 7420 60802 428788736 83 Linux
Disk /dev/sdb: 7933 MB, 7933526016 bytes
255 heads, 63 sectors/track, 964 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: 0x1870fb89
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 965 7746560 c W95 FAT32 (LBA)
Partition 1 has different physical/logical endings:
phys=(963, 254, 63) logical=(964, 135, 3)
[root@localhost ~]# grub-install /dev/sda
Installation finished. No error reported.
This is the contents of the device map /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‘.
# this device map was generated by anaconda
(hd0) /dev/sda
(hd1) /dev/sdb
[root@localhost ~]#
如果只有/,没有单独建立/boot分区,使用
grub-install --root-directory=/boot/dev/hda
完成grub信息安装后,还需要修改/boot/grub/grub.conf,把文件中的引导信息也改为(hd0,0)。如果不对此文件进行修改,系统启动到菜单项时,会出现找不到目标分区的故障,可在此时按e键进行临时修改,正常进入系统后再编辑此文件。
[root@localhost ~]# cp -a /boot/grub/grub.conf ./
[root@localhost ~]# vim /boot/grub/grub.conf
1 # grub.conf generated by anaconda
2 #
3 # Note that you do not have to rerun grub after making changes to this file
4 # NOTICE: You have a /boot partition. This means that
5 # all kernel and initrd paths are relative to /boot/, eg.
6 # root (hd1,0)
7 # kernel /vmlinuz-version ro root=/dev/sdb2
8 # initrd /initrd-[generic-]version.img
9 #boot=/dev/sda
10 default=0
11 timeout=5
12 splashimage=(hd1,0)/grub/splash.xpm.gz # 改为和grub设置一致,一般为:(hd0,0)
13 hiddenmenu
14 title CentOS 6 (2.6.32-754.el6.x86_64)
15 root (hd1,0) # 改为和grub设置一致,一般为:(hd0,0)
16 kernel /vmlinuz-2.6.32-754.el6.x86_64 ro root=UUID=83a11f53-681b-42bf-9995-61166250f028 rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=us rd_NO_MD crashkernel=auto LANG=z
h_CN.UTF-8 rd_NO_LVM rd_NO_DM rhgb quiet
17 initrd /initramfs-2.6.32-754.el6.x86_64.img
[root@localhost ~]#
把12行和15行的(hd1,0)改为:(hd0,0)
标签:分区 nts 必须 ica anaconda size may 行操作 原因分析
原文地址:http://blog.51cto.com/moerjinrong/2335681