Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I was monkeying around on my computer at home through ssh trying to set up my system to redo LFS (Linux From Scratch). I had a partition that was not in use, so I decided to break it up into 3 smaller partitions.
Details:
4 Primary partitions
/dev/hda1 was going to be my / LFS partition
/dev/hda2 Temporary / host system (Slackware 10.2)
/dev/hda3 Not being used
/dev/hda4 Swap
So I used cfdisk to break hda3 into 3 smaller partitions (hda5, hda6, hda7), since it would only let me add one more primary partition, I set the new 3 to logical. When I attempted to use ‘mkfs.ext2’ to create the file system, it was complaining about not being able to determine the size of the partition. After a little reading online, I found out that some older versions of fdisk could require a reboot after creation.
After I ran ‘init 6’ and waited a bit to reconnect, my computer was no where to be found. Are there any known problems with having over a cretin number of partitions? Or perhaps with having logical partitions in the middle of my disk?
I just want to know what kind of nasties I can expect when I get back home, and hopefully how to fix it (yes I have a boot disk). Sorry I can’t be more specific but I’m writing this from work since I probably won’t have internet when I get home.
Oh yeah, on other thing, I know the problem is related to the partitions because I had just successfully rebooted right before running cfdisk.
Thanks for your time! Hopefully someone can share their knowledge in the next 2 hours, otherwise I will check back tomorrow.
First recommendation. Download Knoppix and burn it to a CD before you go home. That way you can boot Knoppix and access the internet from your assumedly non-bootable home system.
Brave one, are you, ... repartitioning and rebooting remotely. May the force be with you!
Brave one, are you, ... repartitioning and rebooting remotely. May the force be with you!
If by brave you mean stupid, then you're probably right
Quote:
First recommendation. Download Knoppix and burn it to a CD before you go home. That way you can boot Knoppix and access the internet from your assumedly non-bootable home system.
My life would be much easier if I had a CD burner here at work. Once I get my computer running That's going to be the first thing I do (for future disasters.
Ironically, I usually have a partition with slackware on it for disaster recovery (the one I deleted). I guess this method doesn't work as well as I though it would.
Anyways, I'm not to much at a loss since all my important data is on a separate drive and all I lost was a temporary install anyways. Hopefully I can do this without reinstalling, but not the end of the world if I do.
I would like to know what I did wrong though so i doesn't happen again. Any ideas? I guess it's hard to say until I see what happened when I get home. I'll post back with what I find out.
I actually did that right before I rebooted to see if the cfdisk changes took. It looked a little like this:
/dev/hda1 ext2
/dev/hda2 ext3
/dev/hda4 swap
/dev/hda5 linux
/dev/hda6 linux
/dev/hda7 linux
I don't remember the block locations but I do remember that the last three were located betwen hda2 and hda4. Unfortunatly, once I get a change will probably mean after I have reformated/reinstalled which means I won't have the opertunity to see what went wrong. I will try to avoid the reinstall just for the learning experience.
Any ideas? I guess it's hard to say until I see what happened when I get home.
Bingo! No telling until you get a look at it.
My recommendation: Do not quickly turn to a simple reinstall. While this may be the fastest way to recover, you now have a golden opportunity to practice recovery techniques. If you somehow royally hosed your partition table, see what you can do to manually reconstruct it. Play with the "gpart" program if that seems feasible. If you somehow got your partitions "renumbered" in Linux's viewpoint, you may need to create a new initrd. This happened to me. I snuck in a new logical partition "ahead of" some existing ones, so they got renumbered. I knew to change things in /etc/fstab, but it was not immediately obvious to me that I also needed to create a new initrd. Best to practice this now while you're on this non-critical recovery quest.
I snuck in a new logical partition "ahead of" some existing ones, so they got renumbered.
Sounds familure ..oh wait, that's exactly what I did
Quote:
Best to practice this now while you're on this non-critical recovery quest.
Very good advice, I plan on making this a learning experience.
I'm going to try and boot from a boot floppy when I get home. I don't know much about initrd, anything I should know before I give it a shot? I'll try and do a little reading before I go home, but it will be hard to search google form a boot floppy.
p.s. - If your partitions were renumbered, you will also need to edit grub's menu.lst (or the lilo equivalent - I don't use lilo so I don't know what that "equivalent" is).
Distribution: Distribution: RHEL 5 with Pieces of this and that.
Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700
Rep:
Just a thought here:
I see no exteneded partition which is what the logical partitions are held in.
If it is at /dev/hda3 then the /dev/hda4 still a primary partition?
This is where I am not sure but I think if /dev/hda3 is an extened partition the the following ones after that should be logical. I think the primary swap partition in the middle is throwing the drive out of sync. Just a guess. It would be a good think to know.
I know how to update lilo and my fstab, but what I don't know off the top of my head is
a) how do I find out what the new partition numbering is (will another (fdisk -l after the reboot show the correct #'s)
b) What do I need to update in initrd (or will this be pretty self explanitary like the fstab?)
Thanks for your quick replies. It's greatly apprecieated!
...drkstr
**edit**
I don't actually even know where the initrd config file is. Will I find it somehwere like /etc/initrd.conf? And once I find it, do I just need to replace the old partition # with the new one, or is there a little bit more to it then that?
root=device-name
Specifies the device to be used as the normal root file system. For LOADLIN this is a command line option. For LILO this is a boot time option or can be used as an option line in the LILO configuration file /etc/lilo.config. The device specified by the this option must be a mountable device having a suitable root file-system.
Am I to understand this correctly that there is no initrd config file? I just need to update my boot loader?
I don't know much about initrd, anything I should know before I give it a shot?
Here's a brief synopsis of my problem and solution, from my logbook (I keep written records to help out my aging memory!) This may or may not help you, but then again, it just may! I surely cannot say what I did was the technical correct thing to to, but it worked for me.
Here's the edited (shortened) transcribe from my logbook.
Code:
BEFORE repartition: swap = hda6, / = hda7, /boot = hda8
AFTER: swap = hda7, / = hda8, /boot = hda9
Before I rebooted (too late for you on this step...)
(1) Edited /etc/fstab and fixed partition numbers
(2) Edited /boot/grub/menu.lst and fixed partition references.
You can go back and fix this part by booting Knoppix.
Rebooted. Error: something about grub not finding it's menu.lst.
From grub> prompt, entered "configfile (hd0,8)/grub/menu.lst"
Then boot continued,but died with kernel panic about not finding an ext3 filesystem on hda7.
Booted Knoppix.
$ su -
# mount /dev/hda8 /mnt/hda8
# mount /dev/hda9 /mnt/hda9
# mv /mnt/hda9/initrd.img-2.6.14-1-686 to BAK.img
# ln -s /mnt/hda8/lib/modules/2.6.14 /lib/modules/2.6.14
# ln -s /mnt/hda8/lib/modules/2.6.14-1-686 /lib/modules/2.6.14-1-686
# mkinitrd -r /dev/hda8 \
-d /mnt/hda8/etc/mkinitrd \
-o /mnt/hda9/initrd.img-2.6.14-1-686 \
2.6.14-1-686
# rm /lib/modules/2.6.14
# rm /lib/modules/2.6.14-1-686
# umount /dev/hda9
# umount /dev/hda8
Rebooted from harddrive, not Knoppix
Got grub> prompt again
Entered "configfile (hd0,8)/grub/menu.lst"
Boot continued!
Complained about LVM last mount time in the future - ignored
(I'll fix it later - due to differing timezones on my system and Knoppix default)
REBOOT WORKED!
From within my harddrive booted system (yea!), recreated initrd
again so I wouldn't have a less than ideal Knoppix copy.
# mkinitrd -o /boot/initrd.img-2.6.14-1-686 2.6.24-1-686
Next,
# grub-install /dev/hda9
Rebooted again. PERFECT boot!!!
Hmm, well as it turns out, I some how managed to delete the wrong partition (the root host system) and proceeded to break it into smaller logical partitions. Although I'm not sure how I managed to do this because I double checked which partition was the correct one (hda3) before doing it. I also don't understand how I was able to run multiple commands after wiping the drive out.
WHen I got back, I was able to boot to a slackware install CD which kind of works like a knopix in a way (but very limited). Running 'fdisk -l showed' showed that it was /dev/hda2 as an empty "Linux" partition (IE unformatted), and when I mounted /dev/hda3, it was empty.It did not show any of the 3 logical partitions I had created.
I might have just not been going about recovering it right, because I'm still finding it hard to belive I deleted the wrong partition. I remember very clearly that it was /dev/hda3 I didn't need. I guess I might of just hit the wrong thing without realizing it.
Anyways, towards the end of the night, I gave up trying to figure it out and reinstalled. Lucky I have all my important system scripts and .conf files in a slackware package on a separate drive so restoring was not to time consuming.
thanks for the help! maybe I will do better next time.
...drkstr
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.