Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[gentoo-user] About ready to move /usr, /var and /home to LVM.

102 views
Skip to first unread message

Dale

unread,
Apr 12, 2012, 4:00:02 PM4/12/12
to
Howdy,

Well, it appears we got the init thingy working. I'm about ready to
move things around since one of my drives is about full and I need a
spare to move things around with. I use cp -a to copy things while
booted from a USB stick do hicky. So far, that has always worked and is
pretty fast. I do have a question tho.

When I copy this over, do I still need to copy over null, console and
such to /dev? I know I don't need everything in /dev but do recall
needing those in the past. Has this changed since I'm using the init
thingy? Am I forgetting one? I thought there was three.

Anything else that could be a gotcha? I plan to move this twice. Once
to the spare drive, repartition the OS drive then copy things back over
again. It's been a while and with LVM about to be used, I hope it is
the last time.

Thanks.

Dale

:-) :-)

--
I am only responsible for what I said ... Not for what you understood or
how you interpreted my words!

Miss the compile output? Hint:
EMERGE_DEFAULT_OPTS="--quiet-build=n"

Nikos Chantziaras

unread,
Apr 12, 2012, 4:10:02 PM4/12/12
to
On 12/04/12 22:49, Dale wrote:
> Howdy,
>
> Well, it appears we got the init thingy working. I'm about ready to
> move things around since one of my drives is about full and I need a
> spare to move things around with. I use cp -a to copy things while
> booted from a USB stick do hicky. So far, that has always worked and is
> pretty fast. I do have a question tho.
>
> When I copy this over, do I still need to copy over null, console and
> such to /dev? I know I don't need everything in /dev but do recall
> needing those in the past. Has this changed since I'm using the init
> thingy? Am I forgetting one? I thought there was three.
>
> Anything else that could be a gotcha? I plan to move this twice. Once
> to the spare drive, repartition the OS drive then copy things back over
> again. It's been a while and with LVM about to be used, I hope it is
> the last time.

Make sure this is really what you want. If *any* of the disks in the
LVM goes bad, you lose everything, not just the data on that single disk.

Dale

unread,
Apr 12, 2012, 4:20:02 PM4/12/12
to
< dale goes to figure out a way around this one. >

Thanks for that. I hadn't thought about that. If I tie two drives
together, the file system spans both drives. One dies, the whole thing
is broken as you say. Makes sense.

< scratches chin > I think I can still make this work tho. Yea, I got
a idea. It wasn't my original plan but this should work. Sure glad you
mentioned that though. THANKS MUCH !!!

Michael Mol

unread,
Apr 12, 2012, 4:30:02 PM4/12/12
to
This is why I do LVM on top of a RAID device.

--
:wq

Florian Philipp

unread,
Apr 12, 2012, 5:10:03 PM4/12/12
to
Am 12.04.2012 21:49, schrieb Dale:
> Howdy,
>
> Well, it appears we got the init thingy working. I'm about ready to
> move things around since one of my drives is about full and I need a
> spare to move things around with. I use cp -a to copy things while
> booted from a USB stick do hicky. So far, that has always worked and is
> pretty fast. I do have a question tho.
>
> When I copy this over, do I still need to copy over null, console and
> such to /dev? I know I don't need everything in /dev but do recall
> needing those in the past. Has this changed since I'm using the init
> thingy? Am I forgetting one? I thought there was three.
>

So, you are not just moving /usr /var and /home but also the rest of
root? In that case it is best to do something like
mount --bind / /mnt/real_root
cp -a /mnt/real_root/* /mnt/new_root

mount --bind binds only the root file system, not any other or temporary
file systems mounted on top of it (like udev, /dev/pts, etc.). That
allows you to copy your static /dev file system (as created by untaring
the stage3).
signature.asc

Florian Philipp

unread,
Apr 12, 2012, 5:30:03 PM4/12/12
to
Am 12.04.2012 22:16, schrieb Michael Mol:
> On Thu, Apr 12, 2012 at 4:09 PM, Dale <rdale...@gmail.com> wrote:
>> Nikos Chantziaras wrote:
>>> On 12/04/12 22:49, Dale wrote:
>>>> Howdy,
>>>>
>>>> Well, it appears we got the init thingy working. I'm about ready to
>>>> move things around since one of my drives is about full and I need a
>>>> spare to move things around with.
>>>>
[...]
>>>>
>>>> Anything else that could be a gotcha? I plan to move this twice. Once
>>>> to the spare drive, repartition the OS drive then copy things back over
>>>> again. It's been a while and with LVM about to be used, I hope it is
>>>> the last time.
>>>
>>> Make sure this is really what you want. If *any* of the disks in the
>>> LVM goes bad, you lose everything, not just the data on that single disk.
>>>
>>
>> < dale goes to figure out a way around this one. >
>>
>> Thanks for that. I hadn't thought about that. If I tie two drives
>> together, the file system spans both drives. One dies, the whole thing
>> is broken as you say. Makes sense.
>>
>> < scratches chin > I think I can still make this work tho. Yea, I got
>> a idea. It wasn't my original plan but this should work. Sure glad you
>> mentioned that though. THANKS MUCH !!!
>
> This is why I do LVM on top of a RAID device.
>

Or if you are short on disk space, you can also use LVM to mirror just
/home.

signature.asc

Neil Bothwick

unread,
Apr 12, 2012, 6:40:02 PM4/12/12
to
On Thu, 12 Apr 2012 14:49:10 -0500, Dale wrote:

> Anything else that could be a gotcha? I plan to move this twice. Once
> to the spare drive, repartition the OS drive then copy things back over
> again.

There's no need for the second copy. Create the VG on the spare drive and
copy everything over. Then you can reboot into the system. Now you can
remove the old partitions from the main drive and create a single PV in
the space freed (reboot after repartitioning to make sure you're using
the new partition table.

Then add the new PV to the VG you are using and use pvmove to transfer
everything from the spare drive to the main one. You can use the system
while doing this, so there is only half the downtime compared with doing
two copies.


--
Neil Bothwick

Some cause happiness wherever they go. Others whenever they go.
signature.asc

Dale

unread,
Apr 12, 2012, 9:00:01 PM4/12/12
to
I got backups of most important stuff but my almost full disk is videos.
LOTS of videos. I even found Gilligans Island. lol

Right now, I have a 160Gb which is for the OS itself, a 250Gb which is
what I plan to copy to and back from and a 750Gb for the videos. I plan
to buy a 2Tb or so drive as soon as I can. Buggers are pricey for me.
I want to get a good one since I have no way to back that up, yet. I
plan to later.

Dale

unread,
Apr 12, 2012, 9:10:02 PM4/12/12
to
Right now I have this:

/
/boot
/home
/usr/portage
/var

I'm going to make a backup of /home before I do anything. Just in case.
I also plan to unmount my drive with the videos too.

Good idea. May give this a try. See what all I can break here in a
bit. lol

Dale

unread,
Apr 12, 2012, 9:10:02 PM4/12/12
to
Neil Bothwick wrote:
> On Thu, 12 Apr 2012 14:49:10 -0500, Dale wrote:
>
>> Anything else that could be a gotcha? I plan to move this twice. Once
>> to the spare drive, repartition the OS drive then copy things back over
>> again.
>
> There's no need for the second copy. Create the VG on the spare drive and
> copy everything over. Then you can reboot into the system. Now you can
> remove the old partitions from the main drive and create a single PV in
> the space freed (reboot after repartitioning to make sure you're using
> the new partition table.
>
> Then add the new PV to the VG you are using and use pvmove to transfer
> everything from the spare drive to the main one. You can use the system
> while doing this, so there is only half the downtime compared with doing
> two copies.
>
>


Florian has a good idea too. Dang, both of these sound good. Well, I
got to think on this one. ;-)

Dale

unread,
Apr 12, 2012, 9:30:02 PM4/12/12
to
Dale wrote:
> Howdy,
>
> Well, it appears we got the init thingy working. I'm about ready to
> move things around since one of my drives is about full and I need a
> spare to move things around with. I use cp -a to copy things while
> booted from a USB stick do hicky. So far, that has always worked and is
> pretty fast. I do have a question tho.
>
> When I copy this over, do I still need to copy over null, console and
> such to /dev? I know I don't need everything in /dev but do recall
> needing those in the past. Has this changed since I'm using the init
> thingy? Am I forgetting one? I thought there was three.
>
> Anything else that could be a gotcha? I plan to move this twice. Once
> to the spare drive, repartition the OS drive then copy things back over
> again. It's been a while and with LVM about to be used, I hope it is
> the last time.
>
> Thanks.
>
> Dale
>
> :-) :-)
>


One more question. Currently /usr is on / and that is the way it was
when I built the init thingy. Do I need to rebuild the init thingy so
that it knows /usr is on a separate partition and will mount it or will
it know that when it reboots?

Thanks again for all the help. Already headed off a couple problems.

Matthew Marlowe

unread,
Apr 13, 2012, 1:00:02 AM4/13/12
to
fyi, as someone who has played around quite a bit with most of the
ways to configure a home workstation, I find the best config currently
is:

Dedicated Fast Enterprise 2TB drive -> /, swap, and /boot (ext4)
Six 2TB Reliable SATA Drives in RAID10 -> /home (ext4 with appropriate
chunksize/etc)
Two 2TB Reliable SATA Drives in LVM VG -> /archive, other lvm volumes
I can afford to lose and may need to change sizes for.

No worrying about any bootup complications/initrd or seperate /usr or
/var on workstation, all the important personal data is on reliable
storage, lots of free space for big projects. Backups are on separate
disks from data.
Ext4 over RAID seem happier without lvm. Maybe a few years down the
road btrfs will be complete, I'll be able to switch to that.

Only complications of above is a) careful monitoring of boot disk, b)
with so many drives, chassis needs good air flow/power, and c) unless
/tmp or /var put on lvm, all gentoo compiles are limited by i/o of
boot disk (this isn't a problem for me now, but perhaps when I upgrade
to faster cpus with more cores..).
--
Matthew Marlowe
ma...@professionalsysadmin.com
https://www.twitter.com/deploylinux
1-805-857-9144

Paul Colquhoun

unread,
Apr 13, 2012, 4:10:01 AM4/13/12
to
Actually, that is not necessarily true. When you create the logical volume
you can specify that it is mirrored onto multiple physical drives, assuming
you have enough space on more than one drive.

See the "-m, --mirrors Mirrors" option in 'man lvcreate'

--
Reverend Paul Colquhoun, ULC. http://andor.dropbear.id.au/~paulcol
Before you criticize someone, you should walk a mile in their shoes.
Then, when you do, you'll be a mile away, and you'll have their shoes.

William Kenworthy

unread,
Apr 13, 2012, 6:10:02 AM4/13/12
to
Not necessarily so ... you can remove a failed drive and only lose the
data on that drive - the data on the other drives is usually accessible.
If a drive is in the process of failing you have more options to move
the data to another drive. If you dont have lvm ... the data on that
drive is toast anyway.

Downside, is you have to be aware that you are using LVM and respond
accordingly ... go at it the wrong way and it will be you who have lost
the data (on the whole set of disks), not LVM. Non LVM is simpler, but
the gain in flexibility offsets that enormously.

I have used LVM for years now, and have had failed drives, failing
drives and add/remove drives and have resized partitions quite a few
times over that period - without losing everything. Yes, I have
sometimes lost data on a drive before I could move it off ... but I look
at it from the point of view that without LVM, I would not have had a
chance to save what I did manage to get.

BillK

Dale

unread,
Apr 13, 2012, 11:00:03 AM4/13/12
to
I have ran into a issue here. I copied everything over to sdb, my temp
drive. When I try to boot it, it still boots from sda which is the
primary drive. I can not get it to boot from the copy. I did update
the fstab file to point to the new sdb partitions, I use labels for that
and they have different names. I also edited grub and told it root was
sdb2. When I boot, everything mounted is sda.

I tried chrooting in and building a init thingy, still boots to sdb.

What gives here?

Name Flags Part TypeFS Type [Label] Size (MB)
-------------------------------------------------------------------
sdb1 Primary ext2 [boot-250g] 197.41
sdb2 Primary ext4 [root-250g] 74998.11
sdb5 Logical ext4 [home-250g] 50001.48



LABEL=boot-250g /boot ext2 defaults 1 2
LABEL=root-250g / ext4 defaults 0 1
LABEL=home-250g /home ext4 defaults 0 2


Those are from the copy. Here is grub:

title=Initramfs-new_drive
root (hd0,0)
kernel /bzImage-3.3.1-1 root=/dev/sdb2 init=/sbin/init nox
initrd /initramfs-3.3.1-1-tmp.img

I have done this in the past and it worked but not now. Is this the
init thingy mounting sda stuff and then Gentoo carries on from there?
If so, how do I tell the init thingy to point to sdb stuff?

Thoughts?

cov...@ccs.covici.com

unread,
Apr 13, 2012, 11:20:02 AM4/13/12
to
I had a bad drive, and I tried to use pvmove, but it stopped when it got
an error and would not tell me the file it had trouble with nor would
it move any data past that point -- is there a better way to recover
such data? I simply used the backup to get my data back, rather than
lvm.

--
Your life is like a penny. You're going to lose it. The question is:
How do
you spend it?

John Covici
cov...@ccs.covici.com

Dale

unread,
Apr 13, 2012, 11:30:01 AM4/13/12
to
Matthew Marlowe wrote:
> fyi, as someone who has played around quite a bit with most of the
> ways to configure a home workstation, I find the best config currently
> is:
>
> Dedicated Fast Enterprise 2TB drive -> /, swap, and /boot (ext4)
> Six 2TB Reliable SATA Drives in RAID10 -> /home (ext4 with appropriate
> chunksize/etc)
> Two 2TB Reliable SATA Drives in LVM VG -> /archive, other lvm volumes
> I can afford to lose and may need to change sizes for.
>
> No worrying about any bootup complications/initrd or seperate /usr or
> /var on workstation, all the important personal data is on reliable
> storage, lots of free space for big projects. Backups are on separate
> disks from data.
> Ext4 over RAID seem happier without lvm. Maybe a few years down the
> road btrfs will be complete, I'll be able to switch to that.
>
> Only complications of above is a) careful monitoring of boot disk, b)
> with so many drives, chassis needs good air flow/power, and c) unless
> /tmp or /var put on lvm, all gentoo compiles are limited by i/o of
> boot disk (this isn't a problem for me now, but perhaps when I upgrade
> to faster cpus with more cores..).
>


That would work IF I could afford all those drives. Right now, I have
three and one of them was given to me by another Gentoo user. I did
find a security system that has a 500Gb drive that I may use. Videos on
a drive made for videos should work fine. lol

Also, I have a Cooler Master case with lots of fans, large ones too.

Dale

unread,
Apr 13, 2012, 4:40:02 PM4/13/12
to
OK. I thought of something else to try. I created a new grub entry.
This is a plain entry with no init thingy at all. It looks like this:

title Gentoo no init tmp drive
kernel (hd0,0)/bzImage-3.3.1-1 root=/dev/sdb2 nox

Simple but it still boots the sda drive instead of the sdb drive. What
am I missing here? I looked in dmesg, the root=/dev/sdb2 line is in
there so grub passes it on.

This is weird. I need ideas folks. I'm running out of things to try.

Stefan Schmiedl

unread,
Apr 13, 2012, 5:30:01 PM4/13/12
to
Dale,

Friday, April 13, 2012, 10:35:43 PM, you wrote:

>> I have ran into a issue here. I copied everything over to sdb, my temp
>> drive. When I try to boot it, it still boots from sda which is the
>> primary drive. I can not get it to boot from the copy. I did update
>> the fstab file to point to the new sdb partitions, I use labels for that
>> and they have different names. I also edited grub and told it root was
>> sdb2. When I boot, everything mounted is sda.
>>
>> Those are from the copy. Here is grub:
>>
>> title=Initramfs-new_drive
>> root (hd0,0)
>> kernel /bzImage-3.3.1-1 root=/dev/sdb2 init=/sbin/init nox
>> initrd /initramfs-3.3.1-1-tmp.img

if you want to boot from /dev/sdb, why do you tell grub
to use (hd0,0), which usually maps to /dev/sda1?

I'd expect to see root (hd1,0) in there somewhere.

Depending on boot flags and BIOS settings, you might still
be using the MBR on /dev/sda.

When I migrated a client's data over to a new disk a while
ago, I basically used "tar cf - /sda | tar xf - -C /sdb" and
then switched SATA cables before rebooting. The former /dev/sdb
became /dev/sda and everything was fine.

s.

>>
>> I have done this in the past and it worked but not now. Is this the
>> init thingy mounting sda stuff and then Gentoo carries on from there?
>> If so, how do I tell the init thingy to point to sdb stuff?
>>
>> Thoughts?
>>
>> Dale
>>
>> :-) :-)
>>


D> OK. I thought of something else to try. I created a new grub entry.
D> This is a plain entry with no init thingy at all. It looks like this:

D> title Gentoo no init tmp drive
D> kernel (hd0,0)/bzImage-3.3.1-1 root=/dev/sdb2 nox

D> Simple but it still boots the sda drive instead of the sdb drive. What
D> am I missing here? I looked in dmesg, the root=/dev/sdb2 line is in
D> there so grub passes it on.

D> This is weird. I need ideas folks. I'm running out of things to try.

D> Dale

D> :-) :-)




--
Stefan Schmiedl
EDV-Beratung Schmiedl, Berghangstr. 5, D-93413 Cham
im Büro: 09971 9966 989, am Handy: 0160 9981 6278

"This is why Science and Mathematics are still much fun:
You discover things that seem impossible to be true
and then get to figure out why it's impossible for them not to be."

-- Vi Hart: Spirals, Fibonacci, and Being a Plant, Part 3

Alan McKinnon

unread,
Apr 13, 2012, 9:30:01 PM4/13/12
to
On Fri, 13 Apr 2012 11:12:55 -0400
cov...@ccs.covici.com wrote:

> I had a bad drive, and I tried to use pvmove, but it stopped when it
> got an error and would not tell me the file it had trouble with nor
> would it move any data past that point -- is there a better way to
> recover such data? I simply used the backup to get my data back,
> rather than lvm.

You can use an (expensive) data recovery expert.

What you ran into is a failing drive. You couldn't get the data off
because the drive didn't work, and that has nothing to do with LVM
whatsoever.

LVM is not a data security tool.
LVM is not a backup tool.
LVM does not cover your ass.

All that LVM does is make it easy to manipulate file system volumes,
and to easily make volumes larger than a single disk.

You still have to take all the same precautions to protect your data
that you have done without LVM.

--
Alan McKinnnon
alan.m...@gmail.com

Dale

unread,
Apr 13, 2012, 11:50:01 PM4/13/12
to
I tried changing the root line and it still booted sda. Also, note that
I also tried a grub entry that doesn't even have a root line. It just
points directly to sdb.

From what I have always been told, the root line points to grub not the
root partition of the OS. Those are two different things. Correct me
if I am wrong here. That's the way I have always been told.

I'm using grub legacy here.

Gregory Shearman

unread,
Apr 14, 2012, 12:50:02 AM4/14/12
to
In linux.gentoo.user, Dale wrote:
> I have ran into a issue here. I copied everything over to sdb, my temp
> drive. When I try to boot it, it still boots from sda which is the
> primary drive. I can not get it to boot from the copy. I did update
> the fstab file to point to the new sdb partitions, I use labels for that
> and they have different names. I also edited grub and told it root was
> sdb2. When I boot, everything mounted is sda.

Did you actually install grub onto your MBR by either:

# grub-install --no-floppy /dev/sdb

or

# grub

grub> root (hd1,0)
grub> setup (hd1)
grub> quit

-------------------------------------------------------------------------

You didn't actually write down these steps. Are you assuming that we
know you've done that?

--
Regards,
Gregory.

Stefan Schmiedl

unread,
Apr 14, 2012, 2:30:01 AM4/14/12
to
Dale,

Saturday, April 14, 2012, 5:46:44 AM, you wrote:

D> Stefan Schmiedl wrote:
>> I'd expect to see root (hd1,0) in there somewhere.

D> I tried changing the root line and it still booted sda. Also, note that
D> I also tried a grub entry that doesn't even have a root line. It just
D> points directly to sdb.

D>From what I have always been told, the root line points to grub not the
D> root partition of the OS. Those are two different things. Correct me
D> if I am wrong here. That's the way I have always been told.

That is correct, "root (hdx,y)" points to partition y on drive x, where
the kernel is to be found, i.e. the root path for the "kernel" line.
The kernel uses its root=/dev/whatever to set up the root for the linux
environment.

D> I'm using grub legacy here.

me too. And the last time I tried, changing the root line made grub boot
from the other disk. Have you tried editing this line in grub's editor
during boot?

s.

Dale

unread,
Apr 14, 2012, 6:40:03 AM4/14/12
to
In the past, I never had to install grub to sdb. As long as grub is
installed to one drive, I can boot a OS from any drive. I did this when
I used to have Mandrake and Gentoo installed. I had Mandrake installed
on sda and Gentoo on sdb. I only had one /boot partition which was on
sda1. It had the kernel for both Mandrake and Gentoo in it and sda1 was
used for both.

So, has something changed that if I want to boot from a second drive I
have to install grub to its MBR first? When the BIOS finishes and loads
grub, doesn't it always load from the first drive? If that is true,
doesn't it ignore the MBR on the second drive? It can't load both MBRs
right?

This isn't making sense. I have done this many times in the past with
no problems but now something is different. I need help figuring out
what.

Dale

unread,
Apr 14, 2012, 6:50:02 AM4/14/12
to
Yep, it failed many times with a file not found error. I have a copy of
/boot there but it is just a copy of sda. In the past, I have had one
/boot and booted two different Gentoo OSs with no problem.

This is what I don't get, when I point the root=/dev/sda2, it should
point to that and load the fstab file there to mount the rest. For some
reason, it goes back to sda even when told not to.

This is confusing me. When grub is pointed to something, it should go
there and error out if it is not the correct one such as pointing to the
wrong partition.

This is weird.

kwk...@hkbn.net

unread,
Apr 14, 2012, 7:20:02 AM4/14/12
to
Yes, if you want to boot from another drive, that drive needs to have
a usable MBR (or GPT equivalent).

The BIOS (or UEFI) dictates which MBR to load first, and GRUB doesn't
come into it until BIOS found it and loaded it. This is usually done
in the "boot sequence" config option in BIOS, although it can be
temporarily overridden at boot time by pressing a suitable key.

> This isn't making sense. I have done this many times in the past with
> no problems but now something is different. I need help figuring out
> what.

There are many ways this can go wrong. Most probably BIOS boot loading
sequence has changed (e.g. if you plug in a USB stick and save boot
sequence where the USB stick is tried first, then what happened when
you remove the stick and reboot is anybody's guess, because the BIOS
will try to outsmart you in guessing what that invalid first boot
device should have been). Or maybe you had /dev/sdb disk as the first
boot disk all along, the previous absence of a bootloader means BIOS
tried the next one silently...

My own safety net is to have /dev/sda1 and /dev/sdb1 pretty much the
same, except the grub.conf has a difference of a useless title line to
indicate which disk it was.

> Dale
>
> :-) :-)
>

Kerwin.
signature.asc

Dale

unread,
Apr 14, 2012, 8:00:02 AM4/14/12
to
Well, I installed grub to the second drives MBR. I even changed the
BIOS to see that drive as the main or first drive. It still boots the
old drive. I looked in dmesg and saw where it is supposed to point to
the tmp drive and it still boots the old drive even tho it is told not to.

Let's see, boot a CD, just do a reinstall from scratch and call it a
day. This is ridiculous when you can't tell a boot loader to boot the
second drive and it actually do it. Heaven forbid if I had two Linux
OSs on here.

kwk...@hkbn.net

unread,
Apr 14, 2012, 9:30:02 AM4/14/12
to
On Sat, 14 Apr 2012 06:52:20 -0500
Dale <rdale...@gmail.com> wrote:

> Well, I installed grub to the second drives MBR. I even changed the
> BIOS to see that drive as the main or first drive. It still boots the
> old drive. I looked in dmesg and saw where it is supposed to point to
> the tmp drive and it still boots the old drive even tho it is told
> not to.
>
> Let's see, boot a CD, just do a reinstall from scratch and call it a
> day. This is ridiculous when you can't tell a boot loader to boot the
> second drive and it actually do it. Heaven forbid if I had two Linux
> OSs on here.
>
> :-) :-)
>

It sounds like GRUB made the MBR on /dev/sdb to use /dev/sda1 as its
root, so maybe something like

# grub --no-floppy
grub> find /boot/grub/stage1
(hd0,0)
(hd1,0)

Then making GRUB install on /dev/sda pointing to /dev/sda1

grub> device (hd0) /dev/sda
grub> root (hd0,0)
grub> setup (hd0)


and now install on /dev/sdb pointing to /dev/sdb1

grub> device (hd0) /dev/sdb
grub> root (hd0,0)
grub> setup (hd0)

Then you can quit GRUB by issuing

grub> quit

The point being that once you put in the line "device (hd0) /dev/sdb",
GRUB will *think* that (hd0) refers to the disk /dev/sdb, so the next
command "root (hd0,0)" just means the first partition on this disk
will serve as /boot, rather than (hd1,0) which points to 1st partition
on the *other* disk, which is possibly where GRUB got confused.

Kerwin.
signature.asc

Florian Philipp

unread,
Apr 14, 2012, 10:40:02 AM4/14/12
to
Am 14.04.2012 13:52, schrieb Dale:
> kwk...@hkbn.net wrote:
>> On Sat, 14 Apr 2012 05:32:01 -0500
>> Dale <rdale...@gmail.com> wrote:
>>
>>> Gregory Shearman wrote:
>>>> In linux.gentoo.user, Dale wrote:
>>>>> I have ran into a issue here. I copied everything over to sdb, my
>>>>> temp drive. When I try to boot it, it still boots from sda which
>>>>> is the primary drive. I can not get it to boot from the copy. I
>>>>> did update the fstab file to point to the new sdb partitions, I
>>>>> use labels for that and they have different names. I also edited
>>>>> grub and told it root was sdb2. When I boot, everything mounted
>>>>> is sda.
>>>>
>>>> Did you actually install grub onto your MBR by either:
>>>>
[...]
>>>
>>> In the past, I never had to install grub to sdb. As long as grub is
>>> installed to one drive, I can boot a OS from any drive.
>>>
[...]
>>>
>>> So, has something changed that if I want to boot from a second drive I
>>> have to install grub to its MBR first?
>>>
[...]
>>
>> Yes, if you want to boot from another drive, that drive needs to have
>> a usable MBR (or GPT equivalent).
>>
[...]
>
> Well, I installed grub to the second drives MBR. I even changed the
> BIOS to see that drive as the main or first drive. It still boots the
> old drive. I looked in dmesg and saw where it is supposed to point to
> the tmp drive and it still boots the old drive even tho it is told not to.
>
> Let's see, boot a CD, just do a reinstall from scratch and call it a
> day. This is ridiculous when you can't tell a boot loader to boot the
> second drive and it actually do it. Heaven forbid if I had two Linux
> OSs on here.
>
> :-) :-)
>

As we are out of rational ideas, have you tried unplugging the old disk?
You don't need it for booting at the moment, right? AS SATA is
hot-plugin capable, you can re-insert it later.

Regards,
Florian Philipp

signature.asc

Dale

unread,
Apr 14, 2012, 8:30:01 PM4/14/12
to
Well, if I unplug it, how am I going to change the partitions and copy
the OS back over to it? I have not tested the hot plug thingy yet.
Yea, it is supposed to work but . . .

I have done this many times before and never took the sides off the
computer. Has someone broken grub?

Dale

Peter Humphrey

unread,
Apr 14, 2012, 10:10:02 PM4/14/12
to
On Friday 13 April 2012 15:51:07 Dale wrote:

> Here is grub:
>
> title=Initramfs-new_drive
> root (hd0,0)
> kernel /bzImage-3.3.1-1 root=/dev/sdb2 init=/sbin/init nox
> initrd /initramfs-3.3.1-1-tmp.img

Your "init=" parameter points to (hd0,0)/sbin/init because of your "root
(hd0,0)" line. I think that's what you need to fix. It should say
"init=(hd1,0)/sbin/init" if I've read this thread aright.

> Is this the init thingy mounting sda stuff and then Gentoo carries on
> from there? If so, how do I tell the init thingy to point to sdb stuff?

By specifying "initrd (hd1,0)/initramfs-3.3.1-1-tmp.img"

I hope I've got this right - it's late at night here.

--
Rgds
Peter

Dale

unread,
Apr 15, 2012, 1:20:01 AM4/15/12
to
Peter Humphrey wrote:
> On Friday 13 April 2012 15:51:07 Dale wrote:
>
>> Here is grub:
>>
>> title=Initramfs-new_drive
>> root (hd0,0)
>> kernel /bzImage-3.3.1-1 root=/dev/sdb2 init=/sbin/init nox
>> initrd /initramfs-3.3.1-1-tmp.img
>
> Your "init=" parameter points to (hd0,0)/sbin/init because of your "root
> (hd0,0)" line. I think that's what you need to fix. It should say
> "init=(hd1,0)/sbin/init" if I've read this thread aright.
>

I have changed the root line to hd1,0 and it still boots sda. Other
settings result in a failure. It doesn't even try to boot.

>> Is this the init thingy mounting sda stuff and then Gentoo carries on
>> from there? If so, how do I tell the init thingy to point to sdb stuff?
>
> By specifying "initrd (hd1,0)/initramfs-3.3.1-1-tmp.img"
>
> I hope I've got this right - it's late at night here.
>


But the kernel I want to use is on sda1. The OS is on sdb tho.

I'm going to do this another way. I'm going to boot a stick thingy and
just copy it that way. It takes longer but at least it works. Someone
has borked grub tho. This worked just a few years ago. All I changed
back then was the root=/dev/sd** to whatever you want to boot. Now it
acts like it is hard coded to never change once booted. I just hope the
thing boots after I change things around.

May backup my packages first. ;-)

pk

unread,
Apr 15, 2012, 5:40:02 AM4/15/12
to
On 2012-04-15 07:16, Dale wrote:

Here's some linkies for you:
Grub2:
https://www.gnu.org/software/grub/manual/html_node/Device-map.html

Grub1:
https://www.gnu.org/software/grub/manual/legacy/Device-map.html

Best regards

Peter K

pk

unread,
Apr 15, 2012, 5:40:02 AM4/15/12
to
On 2012-04-15 07:16, Dale wrote:

> I have changed the root line to hd1,0 and it still boots sda. Other
> settings result in a failure. It doesn't even try to boot.

What does your 'device.map' file say the sdb drive is mapped to? You
usually find the 'device.map' file in /boot/grub for both grub1 and
grub2... not sure which one you use (haven't followed this thread, sorry).

> But the kernel I want to use is on sda1. The OS is on sdb tho.

Hm... did you mean to write 'sdb1' (your /boot partition as mentioned
earlier in the thread) or do you mean that you want to boot a kernel
located in sda1 and still use sdb1 as your /boot partition? I don't see
how the last part would work...

You need to tell grub where your / (root) partition are named (by grub
convention). You find out what hdX maps to what drive (sdX) through grub
or the 'device.map' file that should have been created when you set up grub.

HTH

Best regards

Peter K

Stroller

unread,
Apr 15, 2012, 6:40:01 AM4/15/12
to

On 15 April 2012, at 01:18, Dale wrote:
>> …
>> As we are out of rational ideas, have you tried unplugging the old disk?
>> You don't need it for booting at the moment, right? AS SATA is
>> hot-plugin capable, you can re-insert it later.
>
> Well, if I unplug it, how am I going to change the partitions and copy
> the OS back over to it? I have not tested the hot plug thingy yet.
> Yea, it is supposed to work but . . .

Just boot the computer from the new disk without the old one in, to start with.

Something may suddenly make sense when you do so.

Stroller.

Dale

unread,
Apr 15, 2012, 6:50:02 AM4/15/12
to


OK. Just picking a random reply so this is not just for Peter K.

This opened a HUGE can of worms. I made CERTAIN I have backups of
things like /home and multiple backups of my .mozilla directory. After
that, I booted the USB stick thingy. It's the sysrescue one. Anyway.
I repartitioned sda to like I wanted, including putting all but / and
/boot on LVM. I did the usual file system creations and mounting. Then
transferred everything over. ALL that went well enough. Might I also
add, it is much faster on SATA. ;-) I edited fstab, grub.conf and all
that to look for the updated things. I had my ducks beak to tail.

Reboot.

Uh oh !!!! Crap hits the fan, BIG TIME. That thing is still looking
for the old partition sda3 for / just like when I was trying to boot off
the sdb drive. This thing had errors everywhere. The kernel loaded but
everything else failed, miserably. Heart sinks. Lots of chin
scratching. Then some banging head on wall. Then I booted the stick
thingy again. I had a brain fart. Who here remembers me saying I tried
to use the init thingy that the kernel builds itself and couldn't get it
to work? Let's see those hands please. Yea, that sucker was still
there. I forgot to remove it since it didn't work. < slaps forehead >

This explains a LOT of the problems I was having with dracut too.
Basically, dracut and the kernel built init thingy was duking it out
behind the scenes. We didn't know that.

My fix was to rebuild the kernel with the kernel built init thingy
disabled. I still got a couple errors tho but it did boot pretty well.
May have a new thread for that, if google don't help.

How's that for a head slapper?

Alex Schuster

unread,
Apr 15, 2012, 7:00:02 AM4/15/12
to
Peter Humphrey writes:

> On Friday 13 April 2012 15:51:07 Dale wrote:
>
>> Here is grub:
>>
>> title=Initramfs-new_drive
>> root (hd0,0)
>> kernel /bzImage-3.3.1-1 root=/dev/sdb2 init=/sbin/init nox
>> initrd /initramfs-3.3.1-1-tmp.img
>
> Your "init=" parameter points to (hd0,0)/sbin/init because of your "root
> (hd0,0)" line. I think that's what you need to fix. It should say
> "init=(hd1,0)/sbin/init" if I've read this thread aright.

Hmmm, this can't be true. The (hdx,y) notation is a Grub thing, but
those kernel parameters go to the kernel who does not understand this
notation. That's why there is the root=/dev/sdb2 argument, instead of
root=(hd1,1). Once the kernel knows where the root partition is, other
file arguments are relative to this.

Wonko

Dale

unread,
Apr 15, 2012, 8:10:01 AM4/15/12
to
See my other reply. It's a eye opener. lol

pk

unread,
Apr 15, 2012, 10:00:02 AM4/15/12
to
On 2012-04-15 12:42, Dale wrote:

> Uh oh !!!! Crap hits the fan, BIG TIME. That thing is still looking

So the computer blew up? ;-)

> How's that for a head slapper?

A good one I'd say? ;-)

Glad you got it sorted.

Best regards

Peter K

Dale

unread,
Apr 15, 2012, 11:20:02 AM4/15/12
to
pk wrote:
> On 2012-04-15 12:42, Dale wrote:
>
>> Uh oh !!!! Crap hits the fan, BIG TIME. That thing is still looking
>
> So the computer blew up? ;-)


I think it was my brain. If it was the puter, it would have been more
stuff. lol


>
>> How's that for a head slapper?
>
> A good one I'd say? ;-)
>
> Glad you got it sorted.
>
> Best regards
>
> Peter K
>
>


The funny thing is this, I was thinking about installing fresh. Just dd
the drive and start over. Guess what tho, I saved the kernel config.
It would likely have been looking for sda3 . . . again. Something would
have hit the fan then for sure. ROFL

Sure does explain a LOT tho. I bet that was some of the dracut issues
too. I don't plan to test the theory but bet it was.

Now to sort out the minor boot up errors.

J. Roeleveld

unread,
Apr 16, 2012, 9:00:01 AM4/16/12
to

On Sat, April 14, 2012 4:28 pm, Florian Philipp wrote:

<SNIPPED>

> As we are out of rational ideas, have you tried unplugging the old disk?
> You don't need it for booting at the moment, right? AS SATA is
> hot-plugin capable, you can re-insert it later.

Be careful here, not all SATA-controllers/ports on mainboards are hotplug
capable. I have a mainboard that becomes really unstable when I try to
hot(un)plug a harddisk.
It runs perfectly fine as long as I switch the computer off before
swapping harddrives.

--
Joost

Dale

unread,
Apr 16, 2012, 10:00:01 AM4/16/12
to
According to the manual, mine is. Given my luck, I don't want to try
it. ;-)

Dale

J. Roeleveld

unread,
Apr 17, 2012, 1:40:02 AM4/17/12
to

On Mon, April 16, 2012 3:47 pm, Dale wrote:
> J. Roeleveld wrote:
>>
>> On Sat, April 14, 2012 4:28 pm, Florian Philipp wrote:
>>
>> <SNIPPED>
>>
>>> As we are out of rational ideas, have you tried unplugging the old
>>> disk?
>>> You don't need it for booting at the moment, right? AS SATA is
>>> hot-plugin capable, you can re-insert it later.
>>
>> Be careful here, not all SATA-controllers/ports on mainboards are
>> hotplug
>> capable. I have a mainboard that becomes really unstable when I try to
>> hot(un)plug a harddisk.
>> It runs perfectly fine as long as I switch the computer off before
>> swapping harddrives.
>
> According to the manual, mine is. Given my luck, I don't want to try
> it. ;-)

If the manual says it is, then probably it will be.

I have 2 mainboards I tried it with that don't mention either way for
hotswap in the manuals.
One gets unstable, the other works perfectly.

The last mainboard I bought actually has an option in the BIOS where I can
specify per SATA-port which are to support hotswap or not ;)

--
Joost

Dale

unread,
Apr 17, 2012, 2:50:02 AM4/17/12
to
I need to look again. Now that I think about it, I think only a couple
of mine support it. I just plan to cut mine off and be safe, unless the
house is on fire. lol
0 new messages