LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-04-2010, 03:20 AM   #1
judoka
Member
 
Registered: Jul 2009
Distribution: Ubuntu 14.04 LTS, CentOS
Posts: 218

Rep: Reputation: 16
Cool How to reinstall a deleted swap partition?


I had to delete my swap partition in order to reinstall win XP, but now I need to reinstall it. I run Ubuntu 10.04 and read that there is a command $ sudo mkswap /dev/sda1 i have about 19 GB of free unpartitioned space left on the hardrive that I want to make into a swap partition. I'm not sure whether I should use sda1 or if the book uses it as an example and if I use it it could wipe away my existing partition with ubuntu installed on it. Any ideas? Thx and happy Fourth of July!
 
Old 07-04-2010, 03:43 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,848

Rep: Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823
That is just an example - do not do that on your systm.. Create a new partition, change its type to x'82', do a mkswap on that partition and add it to /etc/fstab.
 
Old 07-04-2010, 04:08 AM   #3
judoka
Member
 
Registered: Jul 2009
Distribution: Ubuntu 14.04 LTS, CentOS
Posts: 218

Original Poster
Rep: Reputation: 16
Unhappy Can't Boot Ubuntu after reinstaling win XP. What to do?

I just reinstalled win xp on my second hard drive, but in order to do that i had to erase my swap partition on my first hard drive and make a small win partition. Now windows boots on both hardrives and i can't get to ubuntu. Waht do i do to get to linux?
 
Old 07-04-2010, 04:10 AM   #4
judoka
Member
 
Registered: Jul 2009
Distribution: Ubuntu 14.04 LTS, CentOS
Posts: 218

Original Poster
Rep: Reputation: 16
After installing win XP I lost an ability to boot into Ubuntu. It boots into windows from both hard drives what can i do to fix this ?
 
Old 07-04-2010, 04:28 AM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,848

Rep: Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823Reputation: 1823
Depends on the version of grub - did you upgrade Ubuntu to 10.04, or install it as a fresh install ?.
 
Old 07-04-2010, 05:08 AM   #6
judoka
Member
 
Registered: Jul 2009
Distribution: Ubuntu 14.04 LTS, CentOS
Posts: 218

Original Poster
Rep: Reputation: 16
I installed it as a fresh install.
 
Old 07-04-2010, 05:18 AM   #7
ronlau9
Senior Member
 
Registered: Dec 2007
Location: In front of my LINUX OR MAC BOX
Distribution: Mandriva 2009 X86_64 suse 11.3 X86_64 Centos X86_64 Debian X86_64 Linux MInt 86_64 OS X
Posts: 2,369

Rep: Reputation: Disabled
Visit this web side http:help.Ubuntu.com/community/RecoveringUbuntuAfterinstallingWindows
But as also erase you're swap you also must edit you're fstab /etc/fstab
Because it might be that the boot process will stop waiting for you're swap file to appear .
If you have enough RAM Ubuntu will boot without a swap file if you do not have enough RAM create a knew swap file and change the UUID
 
1 members found this post helpful.
Old 07-04-2010, 05:27 AM   #8
ronlau9
Senior Member
 
Registered: Dec 2007
Location: In front of my LINUX OR MAC BOX
Distribution: Mandriva 2009 X86_64 suse 11.3 X86_64 Centos X86_64 Debian X86_64 Linux MInt 86_64 OS X
Posts: 2,369

Rep: Reputation: Disabled
Why did you ask nearly the same questions twice ?
 
Old 07-04-2010, 11:22 AM   #9
judoka
Member
 
Registered: Jul 2009
Distribution: Ubuntu 14.04 LTS, CentOS
Posts: 218

Original Poster
Rep: Reputation: 16
i thught that you can only see one question per forum and wasn't sure to which forum my question applies.
 
Old 07-04-2010, 12:55 PM   #10
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
I have merged your 2 closely-related threads.

You are correct that you should have one thread per topic---but, when things are related, it's better to keep them together.

Good Luck
 
Old 07-04-2010, 01:03 PM   #11
judoka
Member
 
Registered: Jul 2009
Distribution: Ubuntu 14.04 LTS, CentOS
Posts: 218

Original Poster
Rep: Reputation: 16
OK, thx for the info.
Here is the output form my results.txt file.
I would like to erase the sda2 partition that xp installed and use reinstate the 20GB partition as my swap that i had to erase due to win xp installation. I don't care if xp doesn't work after that I'll jut reinstall it and make the boot drive the 1 TB. How can I erase win partition sda2 and use the 20GB of unpartitioned space that i will have on 750GB drive to make a swap for ubuntu?(i'd like to use the whole 20GB for the swap).

[/#]
[QUOTE]Boot Info Script 0.55 dated February 15th, 2010

============================= Boot Info Summary: ==============================

=> Windows is installed in the MBR of /dev/sda
=> Windows is installed in the MBR of /dev/sdb

sda1: _________________________________________________________________________

File system: ext4
Boot sector type: -
Boot sector info:
Operating System: Ubuntu 10.04 LTS
Boot files/dirs: /boot/grub/grub.cfg /etc/fstab /boot/grub/core.img

sda2: _________________________________________________________________________

File system: ntfs
Boot sector type: Windows XP
Boot sector info: No errors found in the Boot Parameter Block.
Operating System:
Boot files/dirs: /boot.ini /ntldr /NTDETECT.COM

sdb1: _________________________________________________________________________

File system: ntfs
Boot sector type: Windows XP
Boot sector info: No errors found in the Boot Parameter Block.
Operating System: Windows XP
Boot files/dirs:

=========================== Drive/Partition Info: =============================

Drive: sda ___________________ _____________________________________________________

Disk /dev/sda: 750.2 GB, 750156374016 bytes
255 heads, 63 sectors/track, 91201 cylinders, total 1465149168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes

Partition Boot Start End Size Id System

/dev/sda1 2,048 1,426,085,887 1,426,083,840 83 Linux
/dev/sda2 * 1,426,090,050 1,426,298,894 208,845 7 HPFS/NTFS


Drive: sdb ___________________ _____________________________________________________

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes

Partition Boot Start End Size Id System

/dev/sdb1 * 63 204,800,399 204,800,337 7 HPFS/NTFS


blkid -c /dev/null: ____________________________________________________________

Device UUID TYPE LABEL

/dev/loop0 squashfs
/dev/sda1 7fea34b1-c226-43f2-8a9d-1360cfb6a57f ext4
/dev/sda2 F4D8F6D0D8F6905A ntfs
/dev/sda: PTTYPE="dos"
/dev/sdb1 EA40DA0F40D9E27D ntfs
/dev/sdb: PTTYPE="dos"
error: /dev/sdc: No medium found
error: /dev/sdd: No medium found
error: /dev/sde: No medium found
error: /dev/sdf: No medium found

============================ "mount | grep ^/dev output: ===========================

Device Mount_Point Type Options

aufs / aufs (rw)
/dev/sr0 /cdrom iso9660 (ro,noatime)
/dev/loop0 /rofs squashfs (ro,noatime)


=========================== sda1/boot/grub/grub.cfg: ===========================

#
# 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,1)'
search --no-floppy --fs-uuid --set 7fea34b1-c226-43f2-8a9d-1360cfb6a57f
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,1)'
search --no-floppy --fs-uuid --set 7fea34b1-c226-43f2-8a9d-1360cfb6a57f
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-23-generic-pae' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd0,1)'
search --no-floppy --fs-uuid --set 7fea34b1-c226-43f2-8a9d-1360cfb6a57f
linux /boot/vmlinuz-2.6.32-23-generic-pae root=UUID=7fea34b1-c226-43f2-8a9d-1360cfb6a57f ro quiet splash
initrd /boot/initrd.img-2.6.32-23-generic-pae
}
menuentry 'Ubuntu, with Linux 2.6.32-23-generic-pae (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd0,1)'
search --no-floppy --fs-uuid --set 7fea34b1-c226-43f2-8a9d-1360cfb6a57f
echo 'Loading Linux 2.6.32-23-generic-pae ...'
linux /boot/vmlinuz-2.6.32-23-generic-pae root=UUID=7fea34b1-c226-43f2-8a9d-1360cfb6a57f ro single
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.32-23-generic-pae
}
menuentry 'Ubuntu, with Linux 2.6.32-22-generic-pae' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd0,1)'
search --no-floppy --fs-uuid --set 7fea34b1-c226-43f2-8a9d-1360cfb6a57f
linux /boot/vmlinuz-2.6.32-22-generic-pae root=UUID=7fea34b1-c226-43f2-8a9d-1360cfb6a57f ro quiet splash
initrd /boot/initrd.img-2.6.32-22-generic-pae
}
menuentry 'Ubuntu, with Linux 2.6.32-22-generic-pae (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd0,1)'
search --no-floppy --fs-uuid --set 7fea34b1-c226-43f2-8a9d-1360cfb6a57f
echo 'Loading Linux 2.6.32-22-generic-pae ...'
linux /boot/vmlinuz-2.6.32-22-generic-pae root=UUID=7fea34b1-c226-43f2-8a9d-1360cfb6a57f ro single
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.32-22-generic-pae
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
insmod ext2
set root='(hd0,1)'
search --no-floppy --fs-uuid --set 7fea34b1-c226-43f2-8a9d-1360cfb6a57f
linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
insmod ext2
set root='(hd0,1)'
search --no-floppy --fs-uuid --set 7fea34b1-c226-43f2-8a9d-1360cfb6a57f
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
if [ ${timeout} != -1 ]; then
if keystatus; then
if keystatus --shift; then
set timeout=-1
else
set timeout=0
fi
else
if sleep --interruptible 3 ; then
set timeout=0
fi
fi
fi
### 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 ###

=============================== sda1/etc/fstab: ===============================

# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc nodev,noexec,nosuid 0 0
# / was on /dev/sda1 during installation
UUID=7fea34b1-c226-43f2-8a9d-1360cfb6a57f / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=e7c124e0-f4b4-42b2-87fb-6233b55337c7 none swap sw 0 0

=================== sda1: Location of files loaded by Grub: ===================


169.8GB: boot/grub/core.img
398.2GB: boot/grub/grub.cfg
169.8GB: boot/initrd.img-2.6.32-22-generic-pae
3.0GB: boot/initrd.img-2.6.32-23-generic-pae
169.7GB: boot/vmlinuz-2.6.32-22-generic-pae
169.9GB: boot/vmlinuz-2.6.32-23-generic-pae
3.0GB: initrd.img
169.8GB: initrd.img.old
169.9GB: vmlinuz
169.7GB: vmlinuz.old

================================ sda2/boot.ini: ================================

[boot loader]
timeout=1
default=multi(0)disk(0)rdisk(1)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(1)partition(1)\WINDOWS="Microsoft Windows XP Professional" /noexecute=optin /fastdetect
=======Devices which don't seem to have a corresponding hard drive==============

sdc sdd sde sdf
[/#]
 
Old 07-04-2010, 01:04 PM   #12
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
I think syg00 has amply answered the question posted in the thread.

The Ubuntu can be repaired so it will boot as before but in so doing nuking the XP's MBR, thereby making Xp unbootable. Is this want the OP wants now?

The OP has to provide additional information if he/she wants to dual boot the two systems. For a start tell us where are the partitions of Xp and Ubuntu and the disk order in the PC.

Edited after reading Post #11 inserted while I was sending Post #12

The Original Ubuntu's MBR can be restored by

(1) boot up Ubuntu as a Live CD, select a terminal and restored Grub2 by command
Code:
sudo su
mkdir /mnt/sda1
mount /dev/sda1 /mnt/sda1
mount --bind /dev/ /mnt/sda1/dev
grub-install --root-directory=/mnt/sda1 /dev/sda
(2) Edit /mnt/sda1/boot/grub/grub.cfg by command like
Code:
nano /mnt/sda1/boot/grub/grub.cfg
and add these two entries to boot 2 Xp
Code:
menuentry '1st Xp in sda2' {
set root=(hd0,2)
chainloader +1
}
menuentry '2nd Xp in sdb1' {
set root=(hd1,1)
chainloader +1
}
Your boot.ini only suggest one of the Xp in sdb1 is bootable but not both.

Since you have sda2 as the first recognisible partition to Xp installer this becames the "C" drive and caused the installer to drop NTLDR there. Therefore your your sda2 is now effectively the partition holding the Xp's boot loader.

Last edited by saikee; 07-04-2010 at 01:17 PM.
 
Old 07-04-2010, 01:12 PM   #13
judoka
Member
 
Registered: Jul 2009
Distribution: Ubuntu 14.04 LTS, CentOS
Posts: 218

Original Poster
Rep: Reputation: 16
Yes, I want repair Ununtu, and I don't care if that nukes win XP. win xp is booting from sda2 and ubuntu is on sda1 how do i erase sda2 so i can get back to Ubunto and do i do $ sudo mkswap /dev/sda2 to use the 20 GB of unpartitioned space that i have on a hard-drive?(i want to use the whole 20GB for the swap.
 
Old 07-04-2010, 02:18 PM   #14
judoka
Member
 
Registered: Jul 2009
Distribution: Ubuntu 14.04 LTS, CentOS
Posts: 218

Original Poster
Rep: Reputation: 16
I didn't see the above post in time and through gparted erased my sda2 partition on the 750 GB drive. After that I made it into a swap, but when I rebooted the computer it said: "drive error press Alt + Cntrl + Del to restart." I did it and got the same message. Waht I'm going to do now to try to fix this is reinstall ubuntu on 1TB drive, and see if after that i can get to the 750 GB drive where all my files are. Except I don't know how to make it so I boot from 750 GB drive instead of the 1 TB drive because I plan to erase the ubuntu on 1 TB later and don't want to loose the ability to get to 750 GB drive after i erase the 1 TB drive. Is there a way to do that?
 
Old 07-04-2010, 03:10 PM   #15
judoka
Member
 
Registered: Jul 2009
Distribution: Ubuntu 14.04 LTS, CentOS
Posts: 218

Original Poster
Rep: Reputation: 16
OK, just got done reinstalling ubuntu on 1 TB drive, got into 750 GB drive , backed-up all my files and now I'll try to reinstall win xp on the 1 TB drive.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
RHEL3 swap partition marked deleted pbaumgar Red Hat 3 09-20-2009 12:25 AM
Reinstall Solaris Express CE still its partition of type swap not 0xbf zillah Solaris / OpenSolaris 21 12-04-2007 08:53 AM
deleted /boot partition Need to reinstall kernel zoidburg016 Debian 11 04-22-2007 02:50 AM
deleted linux partition adn the boot loader was deleted also,now i have only gnu grub boris199 Linux - Laptop and Netbook 2 01-29-2005 05:53 PM
Specify existing swap partition at boot when reinstall? GeirG Linux - General 2 09-11-2004 08:42 AM


All times are GMT -5. The time now is 10:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration