一、bgru Stage1的安裝
1、stage1存儲在MBR的前446字節,首先破壞。使用dd命令
2、使用grub-install命令安裝修復grub stage1
3、使用grub命令修復
二、進入救援模式,修改grub
1、先破壞grub stage
重啟后無法正常開機
2、使用安裝光盤,進入修改模式
三、為現有的linux添一個磁盤,并安裝grub,完成把此磁盤從此linux虛擬機移除,創建新的虛擬機使用此磁盤
添加磁盤
成功添加磁盤,并完成分區及格式化操作
在/mnt目錄下創建boot子目錄,并掛載到/dev/sdb1,創建testroot 子目錄,并掛載到/dev/sdb3
[root@localhost ~]# mkdir /mnt/{boot,testroot} [root@localhost ~]# mount /dev/sdb1 /mnt/boot/ [root@localhost ~]# mount /dev/sdb3 /mnt/testroot [root@localhost ~]#
安裝grub到/mnt/boot目錄下
[root@localhost ~]# grub-install --root-directory=/mnt /dev/sdb //這里的--root-directory=/mnt是boot的父目錄 Probing devices to guess BIOS drives. This may take a long time. 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/sda (hd1) /dev/sdb [root@localhost ~]#
完成安裝
把內核及initramfs復制到/mnt/boo目錄下,并命名為vmlinuz及initramfs,以及創建grub.conf配置文件
在/dev/sdb3上創建完整的根目錄、復制/bin/bash及/bin/bash的庫文件到/mnt/testroot/下相應的位置
[root@localhost /]# mkdir /mnt/testroot/{bin,dev,home,lib64,media,opt,root,sys,usr,etc,lib,mnt,proc,sbin,srv,tmp,var} [root@localhost /]# ls /mnt/testroot/ bin etc lib lost+found mnt proc sbin sys usr dev home lib64 media opt root srv tmp var [root@localhost /]# cp /bin/bash /mnt/testroot/bin/ [root@localhost /]# ldd /bin/bash linux-vdso.so.1 => (0x00007fff2a841000) libtinfo.so.5 => /lib64/libtinfo.so.5 (0x0000003f58800000) libdl.so.2 => /lib64/libdl.so.2 (0x0000003f4dc00000) libc.so.6 => /lib64/libc.so.6 (0x0000003f4e000000) /lib64/ld-linux-x86-64.so.2 (0x0000003f4d800000) [root@localhost /]# cp /lib64/libtinfo.so.5 /mnt/testroot/lib64/ [root@localhost /]# cp /lib64/libdl.so.2 /mnt/testroot/lib64/ [root@localhost /]# cp /lib64/libc.so.6 /mnt/testroot/lib64/ [root@localhost /]# cp /lib64/ld-linux-x86-64.so.2 /mnt/testroot/lib64/ [root@localhost /]#
創建新的虛擬機,并使用/dev/sdb這個磁盤
完成后重啟便可進入系統
原創文章,作者:Net20-deamon,如若轉載,請注明出處:http://www.www58058.com/17523
可以教教我怎么簡單排版這樣的博客嗎?