Linux - NewbieThis 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!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Hi. I am trying to ghost my / (or root) partition to a different partition, so I can transfer it to an identical PC (so I can apt-get update and test everythig before deploying). Is the /boot folder that appears to have GRUB in it actually the MBR? My limited understanding is that the 446 bytes on a hard drive is the MBR, so that when you do the following, I am actually getting everythig on hda1, even the MBR?
dd if=/dev/hda1 of=/home/testdd1
What I want to do is be able to have two partitions, one for the current version of linux and various apps, as well as a second partition for a new version. I would use dd to transfer my whole partition over to the identical PC and then just change the GRUB to point to the new boot partition right? That way, I could always fall back on the previous partition with just a GRUB change???
Distribution: Debian Etch (w/ dual-boot XP for gaming)
The MBR is the first part of the disk. However, /dev/hda1 is not actually the disk itself, but the first partition on the disk. The MBR is usually outside of any partitions (starts at cylinder 0, head 0, sector 1), so you wouldn't be able to get it in this fashion. There is an option when you install GRUB to install the MBR on a specific partition; if that's what you did and put it on hda1 (i.e. (hd0,0) in grub-speak), then you can get it with your command. However - IIRC, hard drives are hard-coded to look at the physical start of the drive, so there would have to be some sort of MBR there, that pointed at the one on hda1.
This does go beyond my knowledge a little - but something I just tried was changing the if parameter of dd from /dev/hda1 to /dev/hda, so that the entire drive is copied. It seemed to work, though I <Ctrl-C>ed it after a few seconds. I don't know where exactly you could store the image of an entire drive (you'd need a partition bigger than the drive itself)... but if you could find somewhere, this looks like it might work.
bah, sniped - and by whole numbers of minutes, too...[/edit]
Ok. Those 2 replies really made it clear to me. hda is the whole drive with the MBR in the first area... while hda1 is just that one partition. So... if I dd the first partition to say another empty one of sufficient size, I should be able to replicate the whole linux system. Then I could add that as an option to my boot system GRUB right?
I looked in my /boot/grub/menu.lst file and at the end see this:
## ## End Default Options ##
You have to change hd(x,y) to match with root=/dev/hd[z]
If you dd the partition hda1, than hda1 on the other partition or drive has to have the exact same properties. It has to have the exact same number of sectors. Dd cannot adept to a different size! Use a different method if the sizes are not the same:
- mount the root partition read-only
- mount the destination partition
- execute from the toplevel:#: find . -xdev | cpio -pm /path/to/mount
Copy the MBR seperately and dd it back to the other drive.
Note that it is not required to have a primary partition to boot Linux. Hda(0,4) is just as useful or any other designation.
What does the "root (hd0,0)" in the above designate anyway? Does that mean the MBR is located there on this particular drive? The "root=/dev/hda1" seems to be the partition with linux that is booted in this case. Why do they require the first "root (hd0,0)" part?
The (hd0,0) is the location of the partition with the kernel. GRUB enumerates drives and partitions starting at 0, so (hd0,0) is the first partition of the first hard drive (hd0,1) is the 2nd partition of the first hard drive, etc. The root= line is passed directly to the kernel so it knows what to mount as the root partition of the Linux filesystem. The bootloader and the kernel are separate entities, although the bootloader does pass some information to the kernel (such as its command line).You can have a separate /boot partition holding the kernel that is separate from your Linux root partition. You don't appear to do this but many people do. So you must tell the bootloader two things, (1) where the kernel image is located and (2) what to tell the kernel about where the Linux root partition is.