[SOLVED] How to safely remove OS on hdb?

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post please read how to get help
Post Reply
aikidouke

[SOLVED] How to safely remove OS on hdb?

Post by aikidouke » Sun Feb 02, 2014 12:30 am

I have Mint 16 on my primary drive (hda) and Sparky Linux on another (hdb). I want to format hdb and only run LM 16, but GRUB runs from hdb.

(First comment, I answered incorrectly and GRUB went into recovery mode, so I installed Sparky)

Thanks!
Last edited by aikidouke on Tue Feb 04, 2014 9:59 am, edited 2 times in total.

User avatar
mank_in
Level 6
Level 6
Posts: 1390
Joined: Wed Nov 16, 2011 2:29 pm
Location: Bali

Re: I just formatted a hard drive with a second OS

Post by mank_in » Sun Feb 02, 2014 2:16 am

IF
sda : LM
sdb : formated

and Grub located in sda , it will not be problem.
But i recommend login to mint , format the second drive, and executed in terminal:

Code: Select all

sudo update-grub
Image
Sorry for my bad English , I am Indonesian.

aikidouke

Re: *Edit* How to safely remove OS on hdb?

Post by aikidouke » Mon Feb 03, 2014 7:13 am

Turns out grub was on hdb. On the next boot, GRUB spat out an error and would not load LM. I installed another OS (Sparky) and can boot now. Grub is, in fact, running from hdb.

Here is how grub looks now;

Code: Select all

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

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  load_env
fi
set default="0"
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 {
  insmod vbe
  insmod vga
  insmod video_bochs
  insmod video_cirrus
}

insmod part_msdos
insmod ext2
set root='(/dev/sdb,msdos3)'
search --no-floppy --fs-uuid --set=root 2db9a689-6ffb-411a-a6c9-7b88d99bee2d
if loadfont /usr/share/grub/unicode.pf2 ; then
  set gfxmode=640x480
  load_video
  insmod gfxterm
  insmod part_msdos
  insmod ext2
  set root='(/dev/sdb,msdos3)'
  search --no-floppy --fs-uuid --set=root 2db9a689-6ffb-411a-a6c9-7b88d99bee2d
  set locale_dir=($root)/boot/grub/locale
  set lang=en_US
  insmod gettext
fi
terminal_output gfxterm
insmod part_msdos
insmod ext2
set root='(/dev/sdb,msdos3)'
search --no-floppy --fs-uuid --set=root 2db9a689-6ffb-411a-a6c9-7b88d99bee2d
insmod png
background_image -m stretch /opt/wallpapers/splash.png
set timeout=5
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
insmod part_msdos
insmod ext2
set root='(/dev/sdb,msdos3)'
search --no-floppy --fs-uuid --set=root 2db9a689-6ffb-411a-a6c9-7b88d99bee2d
insmod png
if background_image /opt/wallpapers/splash.png; then
  true
else
  set menu_color_normal=cyan/blue
  set menu_color_highlight=white/blue
fi
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Debian GNU/Linux, with Linux 3.11-2-amd64' --class debian --class gnu-linux --class gnu --class os {
	load_video
	insmod gzio
	insmod part_msdos
	insmod ext2
	set root='(/dev/sdb,msdos3)'
	search --no-floppy --fs-uuid --set=root 2db9a689-6ffb-411a-a6c9-7b88d99bee2d
	echo	'Loading Linux 3.11-2-amd64 ...'
	linux	/boot/vmlinuz-3.11-2-amd64 root=UUID=2db9a689-6ffb-411a-a6c9-7b88d99bee2d ro  quiet 
	echo	'Loading initial ramdisk ...'
	initrd	/boot/initrd.img-3.11-2-amd64
}
menuentry 'Debian GNU/Linux, with Linux 3.11-2-amd64 (recovery mode)' --class debian --class gnu-linux --class gnu --class os {
	load_video
	insmod gzio
	insmod part_msdos
	insmod ext2
	set root='(/dev/sdb,msdos3)'
	search --no-floppy --fs-uuid --set=root 2db9a689-6ffb-411a-a6c9-7b88d99bee2d
	echo	'Loading Linux 3.11-2-amd64 ...'
	linux	/boot/vmlinuz-3.11-2-amd64 root=UUID=2db9a689-6ffb-411a-a6c9-7b88d99bee2d ro single 
	echo	'Loading initial ramdisk ...'
	initrd	/boot/initrd.img-3.11-2-amd64
}
### 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_memtest86+ ###
menuentry "Memory test (memtest86+)" {
	insmod part_msdos
	insmod ext2
	set root='(/dev/sdb,msdos3)'
	search --no-floppy --fs-uuid --set=root 2db9a689-6ffb-411a-a6c9-7b88d99bee2d
	linux16	/boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
	insmod part_msdos
	insmod ext2
	set root='(/dev/sdb,msdos3)'
	search --no-floppy --fs-uuid --set=root 2db9a689-6ffb-411a-a6c9-7b88d99bee2d
	linux16	/boot/memtest86+.bin console=ttyS0,115200n8
}
menuentry "Memory test (memtest86+, experimental multiboot)" {
	insmod part_msdos
	insmod ext2
	set root='(/dev/sdb,msdos3)'
	search --no-floppy --fs-uuid --set=root 2db9a689-6ffb-411a-a6c9-7b88d99bee2d
	multiboot	/boot/memtest86+_multiboot.bin
}
menuentry "Memory test (memtest86+, serial console 115200, experimental multiboot)" {
	insmod part_msdos
	insmod ext2
	set root='(/dev/sdb,msdos3)'
	search --no-floppy --fs-uuid --set=root 2db9a689-6ffb-411a-a6c9-7b88d99bee2d
	multiboot	/boot/memtest86+_multiboot.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Linux Mint 16 Cinnamon 64-bit, 3.11.0-12-generic (/dev/sda1) (on /dev/sda1)" --class gnu-linux --class gnu --class os {
	insmod part_msdos
	insmod ext2
	set root='(/dev/sda,msdos1)'
	search --no-floppy --fs-uuid --set=root e6a33cfa-8669-45f7-8aec-b75c02bb8cef
	linux /boot/vmlinuz-3.11.0-12-generic root=UUID=e6a33cfa-8669-45f7-8aec-b75c02bb8cef ro quiet splash $vt_handoff
	initrd /boot/initrd.img-3.11.0-12-generic
}
menuentry "Linux Mint 16 Cinnamon 64-bit, 3.11.0-12-generic (/dev/sda1) -- recovery mode (on /dev/sda1)" --class gnu-linux --class gnu --class os {
	insmod part_msdos
	insmod ext2
	set root='(/dev/sda,msdos1)'
	search --no-floppy --fs-uuid --set=root e6a33cfa-8669-45f7-8aec-b75c02bb8cef
	linux /boot/vmlinuz-3.11.0-12-generic root=UUID=e6a33cfa-8669-45f7-8aec-b75c02bb8cef ro recovery nomodeset
	initrd /boot/initrd.img-3.11.0-12-generic
}
### 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  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###

User avatar
austin.texas
Level 20
Level 20
Posts: 12055
Joined: Tue Nov 17, 2009 3:57 pm
Location: at /home

Re: *Edit* How to safely remove OS on hdb?

Post by austin.texas » Mon Feb 03, 2014 9:24 am

In my humble opinion, you should leave the Sparky grub on sdb, and install grub to sda using Mint 16.
That way, if one hard drive decides to die on you, you can always boot with the other.

Installing the Mint 16 grub to sda is simple, just boot into Mint and run

Code: Select all

sudo grub-install /dev/sda
Mint 18.2 Cinnamon, Quad core AMD A8-3870 with Radeon HD Graphics 6550D, 8GB DDR3, Ralink RT2561/RT61 802.11g PCI
Linux Linx 2018

aikidouke

Re: *Edit* How to safely remove OS on hdb?

Post by aikidouke » Mon Feb 03, 2014 10:19 am

That makes sense. I just dont have much hdd space and would rather just use the second for storage. Now that I think about it, there isnt anything keeping me from using the second for storage. Ok so new question.

Grub is on hda as well, in the /boot dir.

If I wanted to list Mint as the first/default OS, would I just edit the order that operating system choices appear in the grub config file I posted above? I beleive that if dont pay attention to the boot process, grub loads sparky by default, so I would like to just load LM by default. Would I have to do anything other than change the order?

I'm not at home right now, but I would save a backup before editing and have live disks to get me in if I screwed up.

User avatar
austin.texas
Level 20
Level 20
Posts: 12055
Joined: Tue Nov 17, 2009 3:57 pm
Location: at /home

Re: *Edit* How to safely remove OS on hdb?

Post by austin.texas » Mon Feb 03, 2014 12:16 pm

You can manually edit those files, but I don't ever do that any more after discovering the excellent Grub Customizer program by Daniel Richter. That program will make everything you want to do easier - including ordering which OS to load first, how much delay, etc.

An overview:
http://ubuntuforums.org/showthread.php?t=1664134

This PPA contains the latest release of Grub Customizer.
sudo add-apt-repository ppa:danielrichter2007/grub-customizer
sudo apt-get update
sudo apt-get install grub-customizer
Mint 18.2 Cinnamon, Quad core AMD A8-3870 with Radeon HD Graphics 6550D, 8GB DDR3, Ralink RT2561/RT61 802.11g PCI
Linux Linx 2018

User avatar
Flemur
Level 14
Level 14
Posts: 5373
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: *Edit* How to safely remove OS on hdb?

Post by Flemur » Mon Feb 03, 2014 1:00 pm

You can manually edit those files, but I don't ever do that any more after discovering the excellent Grub Customizer program by Daniel Richter.

Being toodumb to understand why grub has to be so complicated - weird syntax, multiple files, etc - I find it much easier to just use "legacy grub" (v0.9x or so) and edit its very simple 'menu.lst' file:

Code: Select all

default     0   # 0 = first one.
timeout     2
# hiddenmenu
color       white/black red/white
#
title       Mint 16 sda1
uuid        aaf11104- ....
kernel         /boot/vmlinuz-3.11.0-12-generic root=/dev/sda1 rootfstype=ext4 raid=noautodetect ro
initrd      /boot/initrd.img-3.11.0-12-generic
#
...
Each OS gets 4 simple lines. Order in the menu, default OS and colors are obvious and easy to change.
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
Mint 18.3 Xfce/fluxbox/pulse-less
Xubuntu 17.10/fluxbox/pulse-less

aikidouke

Re: [SOLVED] How to safely remove OS on hdb?

Post by aikidouke » Tue Feb 04, 2014 10:01 am

Marking this as solved. I knuckled up and forgot that grub was actually running from hard drive B. I installed the recommended grub editor and it works like a charm, but I'm not editing the correct grub, so next time I reboot, I will install that same editor (or similar) in the other distro and go from there.

Post Reply

Return to “Installation & Boot”