Welcome to Linux Forums!

With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.

Linux Forum ArticlesLinux ForumsLinux Forum DownloadsLinux HostsFree MagazinesJobs
Home|Register|FAQ|Member List|Calendar|Unanswered Posts|Forum Rules|Today's Posts|Advanced Search|
SEARCH FOR IN
Go Back   Linux Forums > GNU Linux Zone > Misc
Reload this Page Moving root to a logical volume
Linux Forums
Linux Forums
Welcome To The Linux Forums!
Welcome to Linux Forums. We pride ourselves in being one of the largest Linux communities on the web, we encourage you to REGISTER on our forums and participate in the community. There are over 150,000 members ready to answer your questions. JOINING US today will allow you to make new posts, get support, send messages to other members and submit downloads to our downloads directory and many other great features!

Misc Any questions or Linux discussion that does not fit in any of the other technical areas.

Reply
 
Thread Tools Display Modes
Old 05-29-2008   #11 (permalink)
Trusted Penguin
 
smolloy's Avatar
 
Join Date: Apr 2005
Location: CA, but from N.Ireland
Posts: 2,061
Just as a note for anyone else who might be trying this scheme.

Be careful with Ubuntu updates.

A recent update installed a new kernel, and, during the installation procedure, it over-wrote my menu.lst. Now that was my fault, since it asked me for permission to overwrite it, and I said yes (I'd forgotten that I had my own version of it), so on next reboot I was back on my old /dev/sda3 version of Ubuntu. Lucky I'd left that partition alone!!

Fixing it was easy -- I just had to edit menu.lst again. The kernel installation had made a backup at menu.lst~, so I could copy the relevant entries from there. If I had have wiped the /dev/sdsa3 partition with my original installation on it I would have had to use a liveCD to fix the new menu.lst.

So, if you follow this procedure, be aware that a kernel update can break things!
__________________
Registered Linux user #388328 || Registered LFS user #15880
AMD 64 X2 4600+ :: 2X1GB DDR2 800 :: GeForce 9400 GT 512MB :: ASUS M2N32 Deluxe :: 4X250GB SATAII
Need instant help? Try us on IRC -- #linuxforums on freenode
smolloy is offline   Reply With Quote
Old 05-29-2008   #12 (permalink)
Linux Guru
 
Join Date: Oct 2007
Location: Bristol, UK
Posts: 1,568
Interesting ... did the update not retain the old kernel & old kernel boot options to allow you to boot with the old kernel & fix things that way? and did the kernel update put the new kernel in the right place?
Jonathan183 is offline   Reply With Quote
Old 05-29-2008   #13 (permalink)
Trusted Penguin
 
smolloy's Avatar
 
Join Date: Apr 2005
Location: CA, but from N.Ireland
Posts: 2,061
Since I did the update on my regular installation, it installed the kernel on my logical volume (just as it should), but it overwrote menu.lst and used the wrong root location. For some reason it "remembered" my original root location (which I hadn't deleted yet), and so tried to boot from there. Since the new kernel wasn't there, booting crashed.

On the next reboot, I chose the old kernel from the grub menu, and it booted properly -- but it booted to my old root partition. Once I figured that out, I edited menu.lst to point to the right place, and rebooted with the new kernel.

The lesson here is to pay attention to any questions the update manager asks you, and not just click OK because you're in a rush to get to bed and couldn't be bothered thinking about the question!
__________________
Registered Linux user #388328 || Registered LFS user #15880
AMD 64 X2 4600+ :: 2X1GB DDR2 800 :: GeForce 9400 GT 512MB :: ASUS M2N32 Deluxe :: 4X250GB SATAII
Need instant help? Try us on IRC -- #linuxforums on freenode
smolloy is offline   Reply With Quote
Old 05-29-2008   #14 (permalink)
Bigtomrodinator
 
bigtomrodney's Avatar
 
Join Date: Nov 2004
Location: Sunny South-East of Ireland
Posts: 5,177
I'm really sorry I'm only seeing this thread, this is pretty interesting stuff. Tell me, when you copied your system over did you just use cp or did you go the tar or rsync route to preserve permissions? Or was it the case because root owned everything anyway that it didn't matter?

I had some fun migrating to LVM a year or so back and then again when installing Ubuntu as the livecd didn't support LVM.
__________________
In the land of the blind, the night vision users are laughing at the king

Registered Linux user #378740

New members read here / Forum Rules
bigtomrodney is offline   Reply With Quote
Old 05-29-2008   #15 (permalink)
Linux Guru
 
Join Date: Oct 2007
Location: Bristol, UK
Posts: 1,568
Quote:
Originally Posted by smolloy View Post
Since I did the update on my regular installation, it installed the kernel on my logical volume (just as it should), but it overwrote menu.lst and used the wrong root location. For some reason it "remembered" my original root location (which I hadn't deleted yet), and so tried to boot from there. Since the new kernel wasn't there, booting crashed.

On the next reboot, I chose the old kernel from the grub menu, and it booted properly -- but it booted to my old root partition. Once I figured that out, I edited menu.lst to point to the right place, and rebooted with the new kernel.

The lesson here is to pay attention to any questions the update manager asks you, and not just click OK because you're in a rush to get to bed and couldn't be bothered thinking about the question!
I just did the update myself ... it did not prompt me ... it just wrote the new menu.lst. I think the case for the defense is that the options it updated are in a section with just the Ubuntu entries ... starts with
Code:
## ## End Default Options ##
... and ends with ...
### END DEBIAN AUTOMAGIC KERNELS LIST

# This is a divider, added to separate ...
Quote:
Originally Posted by bigtomrodney View Post
Tell me, when you copied your system over did you just use cp or did you go the tar or rsync route to preserve permissions? Or was it the case because root owned everything anyway that it didn't matter?
If the first post in the thread is correct then cp -upr was used so I think permissions should have been preserved.

It looks as though anything in the grub menu.lst section is seen as fair game. Something I will keep in mind for future.
Jonathan183 is offline   Reply With Quote
Old 05-29-2008   #16 (permalink)
Trusted Penguin
 
smolloy's Avatar
 
Join Date: Apr 2005
Location: CA, but from N.Ireland
Posts: 2,061
Quote:
Originally Posted by Jonathan183 View Post
I just did the update myself ... it did not prompt me ... it just wrote the new menu.lst. I think the case for the defense is that the options it updated are in a section with just the Ubuntu entries ... starts with
Code:
## ## End Default Options ##
... and ends with ...
### END DEBIAN AUTOMAGIC KERNELS LIST

# This is a divider, added to separate ...
So perhaps if I add my new options after the "DEBIAN AUTOMAGIC KERNELS" line it will be preserved on the next update?

Quote:
Tell me, when you copied your system over did you just use cp or did you go the tar or rsync route to preserve permissions? Or was it the case because root owned everything anyway that it didn't matter?
As Jonathan183 said I used cp -pr as root from a liveCD. Seems like that was enough to adequately preserve permissions.
__________________
Registered Linux user #388328 || Registered LFS user #15880
AMD 64 X2 4600+ :: 2X1GB DDR2 800 :: GeForce 9400 GT 512MB :: ASUS M2N32 Deluxe :: 4X250GB SATAII
Need instant help? Try us on IRC -- #linuxforums on freenode
smolloy is offline   Reply With Quote
Old 05-30-2008   #17 (permalink)
Linux Guru
 
Join Date: Oct 2007
Location: Bristol, UK
Posts: 1,568
It looks as though when you do an update to the kernel a script
Code:
/usr/sbin/update-grub
is called, don't ask how long it took to track this down instead of reading it in the menu.lst file comments!

This script will create a new menu.lst file from a template it has in the script if menu.lst does not exist. It will also replace the menu.lst files and wait for it ...
Code:
# Make sure we use the standard sorting order
LC_COLLATE=C
# Magic markers we use
start="### BEGIN AUTOMAGIC KERNELS LIST"
end="### END DEBIAN AUTOMAGIC KERNELS LIST"

startopt="## ## Start Default Options ##"
endopt="## ## End Default Options ##"
Grab a cup of coffee cos this script with comments is 1452 lines long:drown:. The script uses the war & peace in the menu.lst file comments to determine how it updates the file, extracts and replaces relevant parts etc. I think the old root was identified because you will have kopt set to it in the menu.lst file ... something like this
Code:
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
##      kopt_2_6_8=root=/dev/hdc1 ro
##      kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=UUID=929c7eed-350b-4b3a-9c32-3c666480366e ro 
... I started working through the script ... looked back at the grub menu.lst file and the penny dropped by the way the magic marker lines are at about line 470 in the script.
Jonathan183 is offline   Reply With Quote
Old 05-30-2008   #18 (permalink)
Trusted Penguin
 
smolloy's Avatar
 
Join Date: Apr 2005
Location: CA, but from N.Ireland
Posts: 2,061
Wow! Great work Jonathan183!! Have a banana

That is indeed quite a long script. I really like the idea that it hides the setup code in the menu.lst comments -- quite ingenious! It looks like all I have to do is change kopt to point at the right drive, and everything will be fine on the next update.

Thanks again!
__________________
Registered Linux user #388328 || Registered LFS user #15880
AMD 64 X2 4600+ :: 2X1GB DDR2 800 :: GeForce 9400 GT 512MB :: ASUS M2N32 Deluxe :: 4X250GB SATAII
Need instant help? Try us on IRC -- #linuxforums on freenode
smolloy is offline   Reply With Quote
Old 05-30-2008   #19 (permalink)
Linux Guru
 
Join Date: Oct 2007
Location: Bristol, UK
Posts: 1,568
I had one of those moments ... I just had to know how the dam thing worked. From my brief look at the code it seems to be expecting uuid references so I was going to go back and look at partitions I've resized and put the corrected uuid in menu.lst
Jonathan183 is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
 

Free Magazines
Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe
Systems Management News, the newspaper for IT systems administration and data center managers!
Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe
The Enterprise Newsweekly
eWeek is the essential technology information source for builders of e-business.
subscribe
Oracle Magazine
Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe
Total Telecom
Total Telecom is "The Economist of the communications industry".
subscribe
More free magazines »



All times are GMT. The time now is 10:48 AM.




© 2000 - 2008 - All Rights Reserved - Property of  MAS Media

Content Relevant URLs by vBSEO 3.2.0