1

I installed Centos7 and Windows on my desktop computer and my computer and boot success at first.

But recently I have removed a file partition from Windows 7,the partition is that I install Centos7,since Centos7 works fine,so I remove it and now I merge the space to an exists windows partition .

since then each time when I boot(or reboot) my computer I will get the following error message:

error:unknown filesystem.
Entering resuce mode
grub resuce>

Using set will get the follwoing message:

>set
prefix=(hd0,msdos9)/boot/grub2
root=hd0,msdos9

Now I found the root cause of it:msdos8 should be change to msdos9,so I input the following code:

>set prefix=(hd0,msdos8)/boot/grub2
>set root=hd0,msdos8
>insmod normal
>normal

After doing this,the system can boot success and I can choose to boot Windows or Linux.

But the problem is that:If I reboot or boot my computer next time,I will still get the error list above and I have to use set to do it again.

I want to know if there is a way to fix this issue permanently so that I do not need to use set to correct it every time.Thanks in advance!

I have tried to modify grub.cfg under /boot/grub2,but it didn't work,below is the configuration code of my grub.cfg file:

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub2-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
set pager=1

if [ -s $prefix/grubenv ]; then
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="${saved_entry}"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

terminal_output console
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=5
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/01_users ###
if [ -f ${prefix}/user.cfg ]; then
  source ${prefix}/user.cfg
  if [ -n "${GRUB2_PASSWORD}" ]; then
    set superusers="root"
    export superusers
    password_pbkdf2 root ${GRUB2_PASSWORD}
  fi
fi
### END /etc/grub.d/01_users ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'CentOS Linux  7' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-693.21.1.el7.x86_64-advanced-ec143453-515a-4bc9-b17b-6bd33f305e3a' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_msdos
        insmod xfs
        set root='hd0,msdos8'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos8 --hint-efi=hd0,msdos8 --hint-baremetal=ahci0,msdos8 --hint='hd0,msdos8'  1f858d09-5ce8-435e-9aba-7f48c3100abe
        else
          search --no-floppy --fs-uuid --set=root 1f858d09-5ce8-435e-9aba-7f48c3100abe
        fi
        linux16 /vmlinuz-3.10.0-693.21.1.el7.x86_64 root=/dev/mapper/centos-root ro rd.lvm.lv=centos/swap vconsole.keymap=us rd.lvm.lv=centos/usr crashkernel=auto  vconsole.font=latarcyrheb-sun16 rd.lvm.lv=centos/root rhgb quiet 
        initrd16 /initramfs-3.10.0-693.21.1.el7.x86_64.img
}
if [ "x$default" = 'CentOS Linux 7' ]; then default='Advanced options for CentOS Linux>CentOS Linux (3.10.0-693.21.1.el7.x86_64) 7 (Core)'; fi;
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/20_ppc_terminfo ###
### END /etc/grub.d/20_ppc_terminfo ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Windows 7' --class windows --class os $menuentry_id_option 'osprober-chain-C4DC2ACFDC2ABB94' {
        insmod part_msdos
        insmod ntfs
        set root='hd0,msdos1'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1'  C4DC2ACFDC2ABB94
        else
          search --no-floppy --fs-uuid --set=root C4DC2ACFDC2ABB94
        fi
        parttool ${root} hidden-
        chainloader +1
}
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
11
  • "But recently I have removed a file partition from Windows 7" what partition did you remove and why? Have you tried restoring that partition?
    – DavidPostill
    Commented Apr 22, 2018 at 10:23
  • Run sudo update-grub and this should create a new configuration file with the new partition numbers caused by changing the number of partitions.
    – AFH
    Commented Apr 22, 2018 at 10:25
  • the partition is that I install Centos7,since Centos7 works fine,so I remove it and now I merge the space to an exists windows partition
    – flyingfox
    Commented Apr 22, 2018 at 10:26
  • @AFH my linux system is centos7 and update-grub will not work
    – flyingfox
    Commented Apr 22, 2018 at 10:27
  • I have use grub2-mkconfig to generate a new grub.cfig file and with the new file,the problem still exist
    – flyingfox
    Commented Apr 22, 2018 at 10:29

1 Answer 1

0

Finally I found the using grub2-install with root can solve this:

grub2-install /dev/sda
3
  • Doesn't sudo grub2-mkconfig do the same? I found you submitted this answer while I was waiting for a response on the chat link. You should at least have told me that you were not continuing the chat.
    – AFH
    Commented Apr 22, 2018 at 18:32
  • @AFH sudo grub2-mkconfig isn't work in my side,I have tested it in my side before asking this question.And I am very sorry that yesterday when I send message to you to chat online,I didn't receive reply from you,I think you are offline,so I didn't send message again to you,very sorry again.
    – flyingfox
    Commented Apr 23, 2018 at 1:36
  • I'm glad you found a solution: it's rather strange that grub2-mkconfig doesn't do this. I have been looking round the different Grub build files on Ubuntu (which runs grub2, but uses grub in its file names and directories), and although grub-install exists as a binary it seems to be called only from ocs-install-grub, and I can't see where this is invoked. I'd like to understand it, but the main thing is that it's working.
    – AFH
    Commented Apr 23, 2018 at 8:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .