LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 08-24-2006, 01:15 PM   #1
Jongi
Senior Member
 
Registered: Aug 2003
Distribution: Debian Sid 32/64-bit, F10 32/64-bit
Posts: 1,070

Rep: Reputation: 45
Backup Grub to USB Stick


I once backed up my grub/bootup to floppy. Is it possible to do the same but to a USB stick?
 
Old 08-24-2006, 05:54 PM   #2
J_K9
Member
 
Registered: Nov 2004
Distribution: Slackware 11, Ubuntu 6.06 LTS
Posts: 700

Rep: Reputation: 30
Of course.

How did you install GRUB? If you installed it to your / partition or a separate /boot partition (ie. there's only one OS on the PC, and that is Linux), then all you need to do is copy the entire /boot directory to your USB stick.

If you installed GRUB to the MBR, simply run the following command in a terminal window to back it up to your USB stick (let's assume that it's mounted at /media/usbstick, and that the hard drive it's installed on is hda):
Code:
dd if=/dev/hda of=/media/usbstick/mbr-bkp bs=512 count=1
And then, if you want to restore it:
Code:
dd if=/media/usbstick/mbr-bkp of=/dev/hda bs=512 count=1
Simple as

HTH,

-jk
 
Old 08-25-2006, 02:14 AM   #3
Jongi
Senior Member
 
Registered: Aug 2003
Distribution: Debian Sid 32/64-bit, F10 32/64-bit
Posts: 1,070

Original Poster
Rep: Reputation: 45
And would I be able to boot of the USB stick provided my BIOS allows?
 
Old 08-25-2006, 03:22 AM   #4
J_K9
Member
 
Registered: Nov 2004
Distribution: Slackware 11, Ubuntu 6.06 LTS
Posts: 700

Rep: Reputation: 30
Erm, no, I don't think so, because you're aren't putting the MBR copy into the first block of the USB stick, which is where the MBR would be read from.

What exactly are you trying to do? There may be better solutions
 
Old 08-25-2006, 06:36 AM   #5
Jongi
Senior Member
 
Registered: Aug 2003
Distribution: Debian Sid 32/64-bit, F10 32/64-bit
Posts: 1,070

Original Poster
Rep: Reputation: 45
I'm trying to back up the grub to the usb stick so that if I mess up something with my fiddling i can boot of the usb stick.

I'm pretty sure when i backed up to floppy I was able to boot off it. I no longer have a floppy on my system so I figured maybe the usb stick could serve the same purpose.

EDIT: The main reason for all this is that i want to create a seperate /boot partition and i am pretty sure that things will not go smoothly the first time. So instead of whipping out the FC5 disk and booting in rescue mode, I thought it would be easier to boot from a USB stick seeing as I would not be looking to add the /boot partition at the back end of the existing partitions, ie none of the partitions referenced in files like fstab, menu.lst and grub.conf should change.

Last edited by Jongi; 08-25-2006 at 07:06 AM.
 
Old 08-25-2006, 07:46 AM   #6
J_K9
Member
 
Registered: Nov 2004
Distribution: Slackware 11, Ubuntu 6.06 LTS
Posts: 700

Rep: Reputation: 30
In that case, you can just use the commands above - but, instead of booting from the USB stick, you could just repair the MBR by copying the backup to it... I don't think you would be able to use the "MBR" on the USB stick unless you copied it to the first block on the stick, but then you might corrupt some data on it (if there is any)
 
Old 08-25-2006, 08:17 AM   #7
Jongi
Senior Member
 
Registered: Aug 2003
Distribution: Debian Sid 32/64-bit, F10 32/64-bit
Posts: 1,070

Original Poster
Rep: Reputation: 45
EDIT: The answer to the question was in the 1st reply.

No need to worry about what's on the USB stick. I'd be prepared to lose any info. If it's not possible to boot of it then I guess replacing the MBR like that won't be too much of a hassle.

EDIT2: Though shouldn't making the USB stick bootable be the same as making an external USB HDD bootable?

Last edited by Jongi; 08-25-2006 at 09:05 AM.
 
  


Reply

Tags
backup, grub, stick, usb


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
mount/umount usb stick - PQI Intelligent Stick 2.0 sandbag Linux - Software 5 05-06-2005 11:12 AM
usb stick freeindy Linux - Hardware 2 09-04-2004 12:13 PM
USB problems: Memorex USB stick 256MB and PSX to USB adapter by Radio Shack Knuckles T15 Linux - Hardware 1 05-19-2004 06:58 PM
USB stick Gilion General 6 12-30-2003 04:55 AM
USB-Stick/usb-storage JC_at_LQ Linux - General 2 07-14-2003 06:56 AM


All times are GMT -5. The time now is 01:21 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration