LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How do I delete OS from disk and grub2? (http://www.linuxquestions.org/questions/linux-newbie-8/how-do-i-delete-os-from-disk-and-grub2-829810/)

DocOlogy 09-01-2010 04:07 PM

How do I delete OS from disk and grub2?
 
Originally, computer had 20GB drive dual boot WinXP and LinuxMint using so-called grub legacy. I upgraded another WinXP machine by cloning its 120GB drive to a new 250GB drive. I put the 120GB in the Linux machine and gparted it to free 40GB. I tried loading Ubuntu 10.04 Studio in 10GB partition. Something went wrong during software unpacking phase and was left with commandline (c/l) 10.04. Kept 10cl in the partition. Tried again in new 10GBpartition to load Ubuntu 9 Studio - success. Grub2 is now new bootloader. Boot options = c/l 10.04, 9 Studio, XP from 120GB, LinuxMint, and XP from 20GB. The 120XP is unbootable (HardwareAbstractionLayer problem I expect). Tried to install 10.04 (regular not studio) over c/l 10.04 but managed to install in addition to i.e. did not overwrite. But otherwise 10gui install is ok. FYI: Grub2 is the initial boot loader however selecting LinuxMint on orig 20GB drive shows grub = legacy in LM (grub -v) term box, the Ubuntus on the 120 show grub 1.9x in term.

I wanted to delete 10cl from disk and grub. Originally intend to gparted->delete partition from U10gui then run grub update but could not because a partition (i.e.10gui) on the target disk was mounted. So I booted into LM and deleted 10cl partitions (ext and swap). That was a bad move! Could not boot machine - grub2 would not boot because 10cl partition was not found. It left me at the "grub rescue" prompt. I wound up reinstalling Linux to the empty partitions.

How do I delete the 10cl o/s from grub and the disk?

Later I will want to delete unbootable 120WinXP o/s from grub and the disk. However, with the WinXp, I will want to keep the data and just delete the o/s.

Thanks in Advance.

aamirnehal 09-01-2010 05:10 PM

simply remove linux...
then insert bootable cd and open dos command prompt.

type this command.

Quote:

c:/>fdisk /mbr
and then press enter.
your grub will be remove.


and then format or install your xp/vista whatever..
thanks

EDDY1 09-01-2010 07:40 PM

PHP Code:

Quote:
c:/>fdisk /mbr 

Does this cormmand work on hd that states i/o error?

I tried to wipe a hd and when it was done that was the end result (i/oerror)
I even tried seagate tools.

yancek 09-01-2010 07:42 PM

You had a 20GB drive with xp and Linux Mint that was working, correct?
You then cloned a 120GB xp install to a 250GB drive.

Quote:

I put the 120GB in the Linux machine and gparted it to free 40GB
Does this refer to the 250GB drive?
You tried to install Ubuntu Studio 10.04 on this drive and it failed?
You tried to install Ubuntu Studeio 9? on this drive and succeeded?

So you are not able to boot the 120GB partition of xp and you are not able to boot the Ubuntu Studio 10.04?

The others do boot?

Quote:

Grub2 is the initial boot loader however selecting LinuxMint on orig 20GB drive shows grub = legacy in LM (grub -v) term box, the Ubuntus on the 120 show grub 1.9x in term.
That would happen if you installed the newer Ubuntu with Grub2 to the mbr of the larger disk and it detected Linux Mint on the other disk and has either a chainloader entry for it or a configfile entry.

Quote:

So I booted into LM and deleted 10cl partitions (ext and swap). That was a bad move! Could not boot machine - grub2 would not boot because 10cl partition was not found. It left me at the "grub rescue" prompt
LM mean Linux Mint? If you deleted the 10cl (Ubuntu Studio 10.04?) partition, you deleted almost all of its Grub files so it can't find them and can't boot.

Quote:

How do I delete the 10cl o/s from grub and the disk?
You just said you already deleted it above?? Your confusing me.
Can you post your current status and use any Linux to post partition information with the command: sudo fdisk -l (lower case Letter L in the command) and post it here.

Mixin Grub2 and Grub Legacy can be problematic but can be done and there are several good tutorials available. I'm not sure exactly what your intentions are at this point.

DocOlogy 09-01-2010 08:51 PM

@ yancek

HTH -

Initially machine had 20gb w/LinuxMint (LM) and WinXp dual booting with no problem.

In a second machine I cloned the 120 to the 250, and moved the 120 from the WinXP machine to the dual boot LM/WinXp.

Gparted the 120 to shrink Win partition (from other machine) and to use the freed space for Ubuntu Linux.

10.04 Studio failed to install gui (don't know what else failed cause I don't function well with command line Linux) but boots to commandline only. 9.10 Studio installed fine along side of the 10.04 install (i.e did not overlay failed 10.04). Side-by-side install was not my intention but I chose the wrong option.

At this point of the story, there are 5 o/s on the machine. On the 120 drive - 10.04 c/l, 9 gui/Studio, busted WinXp; on the 20GB drive LM and working WinXp. Except for WinXp on 120GB (i.e. from other machine) all systems boot to gui or c/l.

I installed 10.04 regular which installed fine and boots to gui (sixth o/s).

I booted to LM and from within there I deleted failed 10.04 Studio partitions. Back to 5 o/s.

I cold booted after deletion. Grub failed with missing partition error. Machine was "locked" (at least to me and my Linux skill level) in "grub rescue" mode. I could not get past that point.

I cold booted machine and reinstalled Linux from cd into previously deleted partition space. Back to 6.

Grub2/Machine has 2 Ubuntu 10.04 (non Studio - i.e. regular), 1 Ubuntu 9 Studio and 1 (unbootable WinXP) on 120 GB drive. Functioning WinXP and LinuxMint on 20GB drive.

Immediate goal - remove 1 of the Ubuntu 10.04 versions from disk and Grub2 cleanly.

DocOlogy 09-02-2010 08:17 AM

Quote:

Originally Posted by aamirnehal (Post 4085379)
simply remove linux...
then insert bootable cd and open dos command prompt.

type this command.



and then press enter.
your grub will be remove.


and then format or install your xp/vista whatever..
thanks

This solution would work "too" well. It would wipe out the 9.x Studio partition and the bad 10.04 partition. I think there ought to be a way to delete a single partition simply and easily and grub would "recover" easily also.

rahulkya 09-02-2010 08:28 AM

first of all try to backup data with a live CD then u can format whole disk or a particular partition ..
linux-mint has gparted might help..

yancek 09-02-2010 05:22 PM

Grub doesn't boot windows, it chainloads them which basically means it points to where the bootloader for windows is or should be. To boot two installations of xp, I believe you will need to make some modifications to the xp boot files. Not a windows user, so am not positive?

To get some accurate information, boot into Ubuntu 10.04 and open a terminal and run this command: sudo fdisk -l ( that is a Lower case Letter L) and post this info here. Make sure both drives are attached before doing this.

See if you have a file /boot/grub/grub.cfg in 10.04.
Reboot and check to see if you have /boot/grub/grub.cfg in 9.10.

Post the contents of the file here as well as info on which install it came from.

DocOlogy 09-02-2010 11:08 PM

Quote:

Originally Posted by yancek (Post 4086437)
To get some accurate information, boot into Ubuntu 10.04 and open a terminal and run this command: sudo fdisk -l ( that is a Lower case Letter L) and post this info here. Make sure both drives are attached before doing this.


Disk /dev/sda: 122.9 GB, 122942324736 bytes
255 heads, 63 sectors/track, 14946 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: 0x32293228

Device Boot Start End Blocks Id System
/dev/sda1 * 1 10963 88060266 7 HPFS/NTFS
/dev/sda2 10964 13971 24161130+ 5 Extended
/dev/sda5 12217 13585 10996461 83 Linux
/dev/sda6 13586 13652 538146 82 Linux swap / Solaris
/dev/sda7 10964 12157 9586688 83 Linux
/dev/sda8 12157 12216 476160 82 Linux swap / Solaris
/dev/sda9 13653 13907 2048256 83 Linux
/dev/sda10 13908 13971 514048+ 82 Linux swap / Solaris

Partition table entries are not in disk order

Disk /dev/sdb: 20.4 GB, 20416757760 bytes
255 heads, 63 sectors/track, 2482 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: 0x8b5b3349

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 1506 12096913+ c W95 FAT32 (LBA)
/dev/sdb2 1507 1944 3518235 c W95 FAT32 (LBA)
/dev/sdb3 1945 2482 4321454+ f W95 Ext'd (LBA)
/dev/sdb5 1945 2116 1376148+ 7 HPFS/NTFS
/dev/sdb6 2116 2459 2759661+ 83 Linux
/dev/sdb7 2460 2482 184716 82 Linux swap / Solaris




Here is the /boot/grub/grub.cfg in 10.04.
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by /usr/sbin/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 recordfail {
set recordfail=1
if [ -n ${have_grubenv} ]; then if [ -z ${boot_once} ]; then save_env recordfail; fi; fi
}
insmod ext2
set root='(hd0,7)'
search --no-floppy --fs-uuid --set 005d8ca0-4f24-410c-8ea1-16ff38116633
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=640x480
insmod gfxterm
insmod vbe
if terminal_output gfxterm ; then true ; else
# For backward compatibility with versions of terminal.mod that don't
# understand terminal_output
terminal gfxterm
fi
fi
insmod ext2
set root='(hd0,7)'
search --no-floppy --fs-uuid --set 005d8ca0-4f24-410c-8ea1-16ff38116633
set locale_dir=($root)/boot/grub/locale
set lang=en
insmod gettext
if [ ${recordfail} = 1 ]; then
set timeout=-1
else
set timeout=10
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Ubuntu, with Linux 2.6.32-24-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd0,7)'
search --no-floppy --fs-uuid --set 005d8ca0-4f24-410c-8ea1-16ff38116633
linux /boot/vmlinuz-2.6.32-24-generic root=UUID=005d8ca0-4f24-410c-8ea1-16ff38116633 ro quiet splash
initrd /boot/initrd.img-2.6.32-24-generic
}
menuentry 'Ubuntu, with Linux 2.6.32-24-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd0,7)'
search --no-floppy --fs-uuid --set 005d8ca0-4f24-410c-8ea1-16ff38116633
echo 'Loading Linux 2.6.32-24-generic ...'
linux /boot/vmlinuz-2.6.32-24-generic root=UUID=005d8ca0-4f24-410c-8ea1-16ff38116633 ro single
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.32-24-generic
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
insmod ext2
set root='(hd0,7)'
search --no-floppy --fs-uuid --set 005d8ca0-4f24-410c-8ea1-16ff38116633
linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
insmod ext2
set root='(hd0,7)'
search --no-floppy --fs-uuid --set 005d8ca0-4f24-410c-8ea1-16ff38116633
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Microsoft Windows XP Professional (on /dev/sda1)" {
insmod ntfs
set root='(hd0,1)'
search --no-floppy --fs-uuid --set eac8151ec814eb19
drivemap -s (hd0) ${root}
chainloader +1
}
menuentry "Ubuntu, Linux 2.6.31-9-rt (on /dev/sda5)" {
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set 5cb0adcc-5642-46d7-af57-a14c83745b4c
linux /boot/vmlinuz-2.6.31-9-rt root=UUID=5cb0adcc-5642-46d7-af57-a14c83745b4c ro quiet splash
initrd /boot/initrd.img-2.6.31-9-rt
}
menuentry "Ubuntu, Linux 2.6.31-9-rt (recovery mode) (on /dev/sda5)" {
insmod ext2
set root='(hd0,5)'
search --no-floppy --fs-uuid --set 5cb0adcc-5642-46d7-af57-a14c83745b4c
linux /boot/vmlinuz-2.6.31-9-rt root=UUID=5cb0adcc-5642-46d7-af57-a14c83745b4c ro single
initrd /boot/initrd.img-2.6.31-9-rt
}
menuentry "Microsoft Windows XP Professional (on /dev/sdb1)" {
insmod fat
set root='(hd1,1)'
search --no-floppy --fs-uuid --set 0a5c-07f1
drivemap -s (hd0) ${root}
chainloader +1
}
menuentry "Linux Mint 9, 2.6.32-22-generic (/dev/sda6) (on /dev/sdb6)" {
insmod ext2
set root='(hd1,6)'
search --no-floppy --fs-uuid --set 27dbc19f-4827-415a-9aa2-829ec991515a
linux /boot/vmlinuz-2.6.32-22-generic root=UUID=27dbc19f-4827-415a-9aa2-829ec991515a ro quiet splash
initrd /boot/initrd.img-2.6.32-22-generic
}
menuentry "Linux Mint 9, 2.6.32-22-generic (/dev/sda6) -- recovery mode (on /dev/sdb6)" {
insmod ext2
set root='(hd1,6)'
search --no-floppy --fs-uuid --set 27dbc19f-4827-415a-9aa2-829ec991515a
linux /boot/vmlinuz-2.6.32-22-generic root=UUID=27dbc19f-4827-415a-9aa2-829ec991515a ro single
initrd /boot/initrd.img-2.6.32-22-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 ###

Quote:

Originally Posted by yancek (Post 4086437)
Reboot and check to see if you have /boot/grub/grub.cfg in 9.10.


Yes there is a grub.cfg in 9.10 Here it is:

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

### BEGIN /etc/grub.d/00_header ###
if [ -s /boot/grub/grubenv ]; then
have_grubenv=true
load_env
fi
set default="0"
if [ ${prev_saved_entry} ]; then
saved_entry=${prev_saved_entry}
save_env saved_entry
prev_saved_entry=
save_env prev_saved_entry
fi
insmod ext2
set root=(hd0,9)
search --no-floppy --fs-uuid --set 5cb0adcc-5642-46d7-af57-a14c83745b4c
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=640x480
insmod gfxterm
insmod vbe
if terminal_output gfxterm ; then true ; else
# For backward compatibility with versions of terminal.mod that don't
# understand terminal_output
terminal gfxterm
fi
fi
if [ ${recordfail} = 1 ]; then
set timeout=-1
else
set timeout=10
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/white
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry "Ubuntu, Linux 2.6.31-9-rt" {
recordfail=1
if [ -n ${have_grubenv} ]; then save_env recordfail; fi
set quiet=1
insmod ext2
set root=(hd0,9)
search --no-floppy --fs-uuid --set 5cb0adcc-5642-46d7-af57-a14c83745b4c
linux /boot/vmlinuz-2.6.31-9-rt root=UUID=5cb0adcc-5642-46d7-af57-a14c83745b4c ro quiet splash
initrd /boot/initrd.img-2.6.31-9-rt
}
menuentry "Ubuntu, Linux 2.6.31-9-rt (recovery mode)" {
recordfail=1
if [ -n ${have_grubenv} ]; then save_env recordfail; fi
insmod ext2
set root=(hd0,9)
search --no-floppy --fs-uuid --set 5cb0adcc-5642-46d7-af57-a14c83745b4c
linux /boot/vmlinuz-2.6.31-9-rt root=UUID=5cb0adcc-5642-46d7-af57-a14c83745b4c ro single
initrd /boot/initrd.img-2.6.31-9-rt
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Microsoft Windows XP Professional (on /dev/sda1)" {
insmod ntfs
set root=(hd0,1)
search --no-floppy --fs-uuid --set eac8151ec814eb19
drivemap -s (hd0) ${root}
chainloader +1
}
menuentry "'Ubuntu, with Linux 2.6.32-21-generic' --class ubuntu --class gnu-linux --class gnu --class os { (on /dev/sda5)" {
insmod ext2
set root=(hd0,5)
search --no-floppy --fs-uuid --set 52922f34-4741-4cad-8d5d-a7db05bc0705
linux /boot/vmlinuz-2.6.32-21-generic root=UUID=52922f34-4741-4cad-8d5d-a7db05bc0705 ro quiet splash
initrd /boot/initrd.img-2.6.32-21-generic
}
menuentry "'Ubuntu, with Linux 2.6.32-21-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os { (on /dev/sda5)" {
insmod ext2
set root=(hd0,5)
search --no-floppy --fs-uuid --set 52922f34-4741-4cad-8d5d-a7db05bc0705
linux /boot/vmlinuz-2.6.32-21-generic root=UUID=52922f34-4741-4cad-8d5d-a7db05bc0705 ro single
initrd /boot/initrd.img-2.6.32-21-generic
}
menuentry "Ubuntu 10.04 LTS, kernel 2.6.32-21-generic (on /dev/sda7)" {
insmod ext2
set root=(hd0,7)
search --no-floppy --fs-uuid --set 14a16a08-f039-42a2-8d0c-41d66210c4ff
linux /boot/vmlinuz-2.6.32-21-generic root=UUID=14a16a08-f039-42a2-8d0c-41d66210c4ff ro quiet splash
initrd /boot/initrd.img-2.6.32-21-generic
}
menuentry "Ubuntu 10.04 LTS, kernel 2.6.32-21-generic (recovery mode) (on /dev/sda7)" {
insmod ext2
set root=(hd0,7)
search --no-floppy --fs-uuid --set 14a16a08-f039-42a2-8d0c-41d66210c4ff
linux /boot/vmlinuz-2.6.32-21-generic root=UUID=14a16a08-f039-42a2-8d0c-41d66210c4ff ro single
initrd /boot/initrd.img-2.6.32-21-generic
}
menuentry "Microsoft Windows XP Professional (on /dev/sdb1)" {
insmod fat
set root=(hd1,1)
search --no-floppy --fs-uuid --set 0a5c-07f1
drivemap -s (hd0) ${root}
chainloader +1
}
menuentry "Linux Mint 9, 2.6.32-22-generic (/dev/sda6) (on /dev/sdb6)" {
insmod ext2
set root=(hd1,6)
search --no-floppy --fs-uuid --set 27dbc19f-4827-415a-9aa2-829ec991515a
linux /boot/vmlinuz-2.6.32-22-generic root=UUID=27dbc19f-4827-415a-9aa2-829ec991515a ro quiet splash
initrd /boot/initrd.img-2.6.32-22-generic
}
menuentry "Linux Mint 9, 2.6.32-22-generic (/dev/sda6) -- recovery mode (on /dev/sdb6)" {
insmod ext2
set root=(hd1,6)
search --no-floppy --fs-uuid --set 27dbc19f-4827-415a-9aa2-829ec991515a
linux /boot/vmlinuz-2.6.32-22-generic root=UUID=27dbc19f-4827-415a-9aa2-829ec991515a ro single
initrd /boot/initrd.img-2.6.32-22-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 ###



Quote:

Originally Posted by yancek (Post 4086437)
Post the contents of the file here as well as info on which install it came from.


I know I am not supposed to because the change will not be permanent but the grub.cfg shows 5 o/s because I gedited the grub.cfg and removed the 6th menuentry.


All times are GMT -5. The time now is 05:34 AM.