LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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!

Notices


Reply
  Search this Thread
Old 10-20-2004, 11:08 PM   #1
rioguia
Member
 
Registered: Jun 2002
Posts: 411

Rep: Reputation: 30
accidentally renamed my root " / " directory


I accidentally renamed my root " / " directory by typing this command cd //
all my file systems displayed as follows
[root@host/]#
[boot/]#
[etc/]#

I need help. When my machine booted it said operating system not found.
 
Old 10-20-2004, 11:19 PM   #2
goofyheadedpunk
Member
 
Registered: Aug 2003
Distribution: Arch Linux
Posts: 140

Rep: Reputation: 15
Congratulations, that is the coolest OS breakage I have ever seen. However I'm going to guess that's not much consolation.

cd does nothing besides change directories so, barring a terrible bug in cd, you didn't rename your / . As to what actually happened, I have no clue. At least not yet. If you have the ability could you try and mount your hard drives using some sort of liveCD, and also could you explain exactly what happens in the boot procedure? Does the machine post, and then the BIOS complains that it can't find a MBR ( or Operating System in some cases )?

If that's the case you might try reinstalling your boot loader with your distribution's install disk.

But that's a wild guess. I'd feel much better knowing if you can mount your hard drives with a liveCD first.
 
Old 10-20-2004, 11:29 PM   #3
rioguia
Member
 
Registered: Jun 2002
Posts: 411

Original Poster
Rep: Reputation: 30
just burned a fedora core rescue disk

i get all the bios displays and ram checks, then is simly says
no operating system found."

i am going to try to mount it now. i have the rhce book and am going over the recovery options. any thoughts would be appreciated.

Last edited by rioguia; 10-20-2004 at 11:35 PM.
 
Old 10-20-2004, 11:31 PM   #4
darthtux
Senior Member
 
Registered: Dec 2001
Location: 35.7480° N, 95.3690° W
Distribution: Debian, Gentoo, Red Hat, Solaris
Posts: 2,070

Rep: Reputation: 47
So you renamed them and then rebooted *before* finding a solution? Your only hope is to do as goofyheadedpunk said and use a live-cd. Try knoppix. It will mount your partitions under /mnt/hdx and you can go in and attempt to fix what is wrong.
 
Old 10-20-2004, 11:34 PM   #5
darthtux
Senior Member
 
Registered: Dec 2001
Location: 35.7480° N, 95.3690° W
Distribution: Debian, Gentoo, Red Hat, Solaris
Posts: 2,070

Rep: Reputation: 47
Re: just burned a fedora core rescue disk

Quote:
Originally posted by rioguia
i am going to try to mount it now. i have the rhce book and am going over the recovery options. any thoughts would be appreciated.
If it will boot a kernel off the cd in recovery mode then you need to mount your root partition. From your command line above, it looks like you renamed the directores with a trailing slash /. You need to rename them to remove it.
 
Old 10-20-2004, 11:44 PM   #6
rioguia
Member
 
Registered: Jun 2002
Posts: 411

Original Poster
Rep: Reputation: 30
clarification

i am at the rescue prompt.
fdisk -l /dev/hda looks normal
device boot start end block id system
dev/hda1 * 1 14 105808+ 83 Linux

are you saying that each directory needs to be renamed as follows:

mv // /
mv root/ root
mv boot/ boot
etc.
 
Old 10-20-2004, 11:48 PM   #7
darthtux
Senior Member
 
Registered: Dec 2001
Location: 35.7480° N, 95.3690° W
Distribution: Debian, Gentoo, Red Hat, Solaris
Posts: 2,070

Rep: Reputation: 47
If ls says
//
etc/
then, yes you need to rename them like you said.
 
Old 10-20-2004, 11:53 PM   #8
rioguia
Member
 
Registered: Jun 2002
Posts: 411

Original Poster
Rep: Reputation: 30
step by step

step 1.
chroot /mnt/sysimage

step 2.
df (to see what the file system looks like)

step 3.
mv boot/ boot
 
Old 10-21-2004, 12:07 AM   #9
rioguia
Member
 
Registered: Jun 2002
Posts: 411

Original Poster
Rep: Reputation: 30
swap supposed to mount under rescue?

device boot start end block id system

device boot start end block id system
dev/hda1 * 1 14 105808+ 83 Linux
dev/hda2 15 691 5118120 83 Linux
dev/hda3 692 5224 34269480 83 Linux
dev/hda4 5225 5310 650160 F win95 (I think this is just a disk geometry error that was noted during the install)
dev/hda5 5225 5310 650160 82 SWAP


chroot /mnt/sysimage
df (to see what the file system looks like)

Filesystem 1-K blocks Used Available Use% Mount
dev/hda3 33731664 9150260 22867932 29% /
dev/hda1 102454 6127 91037 7% /boot
none 33731664 9150260 22867932 29% /dev/shm (psuedo file type for shared memory)
dev/hda2 5037736 192144 4589688 5% /home


I don't see anything related to dev/hda4 or dev/hda5 (SWAP). If four is just a glitch, is dav/hda5 swap supposed to mount under rescue?

Last edited by rioguia; 10-21-2004 at 12:36 AM.
 
Old 10-21-2004, 07:08 AM   #10
rioguia
Member
 
Registered: Jun 2002
Posts: 411

Original Poster
Rep: Reputation: 30
please help! remounting disk as /dev/hdb

i have added a new install on a new hard drive hda and have placed my older linux system on hdb.

i want to copy my data to hda but i am betting lots of complaints that linux is trying to mount the old file systems by duplicate names for the current operating system.

Does FDISK allow me to fix this problem. if so, how?
 
Old 10-21-2004, 07:34 AM   #11
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,784

Rep: Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937
Quote:
I don't see anything related to dev/hda4 or dev/hda5 (SWAP). If four is just a glitch, is dav/hda5 swap supposed to mount under rescue?
FYI:
hda4 is (was) an extended partition. In a nutshell it is a container for logical partitions and its purpose is for creating more then four partitions. The extended partition as well as swap does not show up via df nor is it mounted.

I assume your running either Redhat or Fedora. The OS uses partition labels in the fstab to identify the filesystems. Since you have multiple partitions with the same label the OS does not know which to use. Use the tune2fs command to relabel the old partitions to something else.
 
Old 10-21-2004, 07:50 AM   #12
rioguia
Member
 
Registered: Jun 2002
Posts: 411

Original Poster
Rep: Reputation: 30
une2fs -L /mnt/hdb1/boot /mnt/hdb1/boot_old?

Thanks. This looks great.
DESCRIPTION tune2fs allows the system administrator to adjust various tunable filesystem parameters on Linux ext2/ext3 filesystems.

-L volume-label
Set the volume label of the filesystem. Ext2 filesystem labels can be at most 16 characters long; if volume-label is longer than 16 characters, tune2fs will truncate it and print a warn- ing. The volume label can be used by mount(8), fsck(8), and /etc/fstab(5) (and possibly others) by specifying LABEL=volume_label instead of a block special device name like /dev/hda5.


so i want to rename the volume label hdb's /boot partition to /boot_old

EXAMPLE????
tune2fs -L /mnt/hdb1/boot /mnt/hdb1/boot_old




:

Last edited by rioguia; 10-21-2004 at 07:52 AM.
 
Old 10-21-2004, 07:51 AM   #13
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,634

Rep: Reputation: Disabled
I don't understand.

1st: Your system now complains about duplicate names, which signals in my opinion, that your old directories were NOT renamed?!? Then something else causes this abnormal behaviour (and, furthermore, as stated above, "cd" can't rename).

2nd: Why don't you simply rename the directories back like
Code:
   man mv to make sure of the options:
       R for recursive (subdirectories)
       d for directories only

mv -Rd '*/' *
? ?

Last edited by JZL240I-U; 10-21-2004 at 07:53 AM.
 
Old 10-21-2004, 07:57 AM   #14
rioguia
Member
 
Registered: Jun 2002
Posts: 411

Original Poster
Rep: Reputation: 30
Remove the replacement drive?

Are you saying that oly the root " / " was changed (i.e. became "/ /" and that this will make all the file directories back to the old structure?

EXAMPLE
1. remove the replacement drive.
2. reboot the old drive with the rescue disk
3. at the prompt
mv -Rd '*/' *
4. reboot adn operating system will be found.
 
Old 10-21-2004, 08:02 AM   #15
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,634

Rep: Reputation: Disabled
Yes, that's what I meant. Make sure of the options, though... .

BUT: cd doesn't rename...

Experts to the fore: Is it possible to cd "above" / ?

Last edited by JZL240I-U; 10-21-2004 at 08:05 AM.
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
"bad interpreter : no such file or directory" when configure "flex" acer_peri Linux - Software 10 11-10-2010 01:19 AM
newbie question: whats the difference between "su root", "su" and "su -&quo mojarron Slackware 9 12-07-2009 04:08 PM
what is the difference between "/" root directory and "/root" directory? augustus123 Linux - General 4 11-20-2004 05:22 PM
HELP! - root directory "/" 100% CAPACITY JM_Fraser Linux - Software 11 11-28-2003 03:41 PM
"Linux From Scratch" forum renamed? Dark_Helmet LQ Suggestions & Feedback 3 09-03-2003 09:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:41 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration