You are not logged in.
My root directory is mounted as read only, and I have somehow misplaced my home directory. Here is what I think happened, and why I believe it is reversible...
I was editing /etc/fstab and I made a typeing error, used a period instead of a comma, which caused my /home directory to become lost. On the next boot a home directory was created for me on my root partition. After changeing this period into a comma, I noticed that my home directory was now located on the same partition as my root directory, when before it was located on a much larger, seprate partition.
I used the following command to move /home back to its orginal partition.
mv /home /home.bak
mkdir /home
mount -t ext4 /dev/sda4 /home
cp -a /home.bak/* /home
I edited /etc/fstab so that /home was assigned to /dev/sda4 and commented out the line that contained the orignal destination of my /home directory.
After a reboot, slim had thrown a "Failed to execute login command" error at me, so I uncommented the orignal /etc/fstab entry and commented out the new entry I had just made. I ran "mv /home.bak /home" and rebooted.
I was presented with a new error, this time about /etc/mtab, so I changed /dev/sda3 to /dev/sda4 in mtab so that sda4 pointed to /home. Upon the next reboot I noticed that my root directory had been mounted as read only, I ran "mount -n -o remount,rw /" and rebooted, but root was still mounted as read only.
After failing to reverse my error in mtab, I had given up hope and ran "rm -rf /*". To my supprise, my real home directory appeared in the list of items to be deleted, fortunately however, my root directory was still mounted as read only, so nothing was actually deleted, as far as I could tell. The reason I haven't simply reinstalled Arch is because I noticed that my files hadn't disappeared, instead they were located in /.home for some reason.
Would someone please point me in the right direction so that I could repair the damage I've caused?
Last edited by ShawnB391 (2010-06-20 01:45:28)
Offline
1) There is almost always no need to edit mtab. See man mount for what it is.
2) What in the worlds is in your fstab? Post it here.
3) Is your user's home /home/$user or just /home ?
aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies
Offline
mv /home /home.bak
mkdir /home/
No problem here, but I assume this was done with root privileges. Did this work? If so It was not mounted read only.
mount -t ext4 /dev/sda4 /home
Did this work? Or did it pitch an error?
cp -a /home.bak/* /home
If there were no errors, you now have all the files that were in /home before you moved it in /dev/sda4/home (/home in the file system) plus all the files that were there originally -- provided they did not get overwritten by the above command.
edited /etc/fstab so that /home was assigned to /dev/sda4 and commented out the line that contained the orignal destination of my /home directory.
After a reboot, slim had thrown a "Failed to execute login command" error at me, so I uncommented the orignal /etc/fstab entry and commented out the new entry I had just made. I ran "mv /home.bak /home" and rebooted. .
After either reboot, I do not believe your home directory was mounted. The second reboot probably caused the stub directory /home of your root file system to no longer be empty. This means you cannot mount anything there (the directory you are mounting to has to be empty [in Linux -- some Unix systems no]
I was presented with a new error, this time about /etc/mtab, so I changed /dev/sda3 to /dev/sda4 in mtab so that sda4 pointed to /home. Upon the next reboot I noticed that my root directory had been mounted as read only, I ran "mount -n -o remount,rw /" and rebooted, but root was still mounted as read only.
I have no idea what this will do. As has been stated by fsckd [great nym for this thread] -- Don't do that.
After failing to reverse my error in mtab, I had given up hope and ran "rm -rf /*". To my supprise, my real home directory appeared in the list of items to be deleted, fortunately however, my root directory was still mounted as read only, so nothing was actually deleted, as far as I could tell. The reason I haven't simply reinstalled Arch is because I noticed that my files hadn't disappeared, instead they were located in /.home for some reason.
Ouch, my brain hurts. DO NOT EVER run rm -rf /* unless your really really really don't want any files on your file system and are deliberately trying to destroy your file system just because you can. Now, how do you know what it tried to delete [What "list" are you referring to ??] How do you know what it did or did not erase on / ? Did it run to completion? Did it complain about being read only?
I believe that your home partition is safe, but could not be mounted because the /home directory in the root file system had junk in it. I think you may have done something to cause the system to be unable to find your /home partition (UUID changed, /dev identifier changed, etc..)
In fighting with this you may or may not have borked your root file system, So you may end up reinstalling Arch -- again, maybe not.
In addition to the requests from fsckd, please also provide the output of sudo fdisk -l and ls -l /dev/sd*
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Offline
When in doubt, run df in a terminal and you will see the different partitions that are mounted. In your case you want to know what is mounted on /home. If /home does not show, it means that nothing is attached to /home. Next make sure that /home is empty by using mv and then creating a new /home. Edit your fstab so you mount the partition you want to /home. Test your fstab by running "mount /home" and then df. Once you are satisfied, copy the contents of your backed up /home over to your new /home. Reboot to make sure everything works. If it still doesn't, then show your fstab and the other info that have been requested.
Offline
Maybe you can post your fstab and fdisk ?!
# fdisk -l
Last edited by igndenok (2010-06-17 08:04:00)
Ask, and it shall be given you.
Seek, and ye shall find.
Knock, and it shall be opened unto you.
Offline
Thank you to everyone who replied, and I apologize for the delay in my response.
The error that was causing my root directory to be mounted as read only was located in fstab. When I had uncommented a line beginning with UUID I had deleted a U by mistake. I logged into root, ran mount -n -o remount,rw /, added the missing U into fstab, saved and rebooted.
When I log into my user account through the command line I receive the error "No directory, logging in with HOME=/"
When I log into root from the command line and run ls "home" is the only folder/file listed. Home contains "shawn" and inside of that folder are all of my files.
Slim throws an error at me when trying to log into either shawn or root "Failed to execute login command"
No problem here, but I assume this was done with root privileges. Did this work? If so It was not mounted read only.
mount -t ext4 /dev/sda4 /home
Yes, as far as I could tell, this worked. I did not receive an error.
Did this work? Or did it pitch an error?
cp -a /home.bak/* /home
I also believe that this worked without error.
Ouch, my brain hurts. DO NOT EVER run rm -rf /* unless your really really really don't want any files on your file system and are deliberately trying to destroy your file system just because you can.
At the time, I had given up hope. I ran this code because I could see no better time to "test" it. Fortunately though, my root file system was mounted as read only, and the error output contained the file names of my home directory.
fstab
# <file system> <dir> <type> <options> <dump> <pass>
devpts /dev/pts devpts defaults 0 0
shm /dev/shm tmpfs nodev,nosuid 0 0
#/dev/cdrom /media/cd auto ro,user,noauto,unhide 0 0
#/dev/dvd /media/dvd auto ro,user,noauto,unhide 0 0
#/dev/fd0 /media/fl auto user,noauto 0 0
UUID=19e03428-205b-49bd-8a6740410ac1ccad /boot ext2 defaults 0 1
UUID=1fb21e29-499b-4513-9261-2814c2956b23 / ext4 defaults 0 1
UUID=1fbee3df-f244-4a72-985a-1b12e0a9bcf4 swap swap defaults 0 0
UUID=3d993058-6631-4e13-b258-345e24a8ef2c /home ext4 defaults 0 1
fdisk -l
Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225200 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 300 2305327* 82 Linux swap / Solaris
/dev/sda3 301 1046 12418245 83 Linux
/dev/sda4 1047 14593 102390277* 83 Linux
df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda3 12223224 11510032 92280 100% /
udev 10240 172 10068 2% /dev
shm 966800 0 966800 0% /dev/shm
/dev/sda1 101086 13695 82172 15% /boot
/dev/sda4 100782004 9879688 85782804 11% /home
ls -l /dev/sd*
brw-rw---- 1 root disk 8, 0 Jun 19 10:16 /dev/sda
brw-rw---- 1 root disk 8, 1 Jun 19 10:16 /dev/sda1
brw-rw---- 1 root disk 8, 2 Jun 19 10:16 /dev/sda2
brw-rw---- 1 root disk 8, 3 Jun 19 10:16 /dev/sda3
brw-rw---- 1 root disk 8, 4 Jun 19 10:16 /dev/sda4
Offline
When I log into my user account through the command line I receive the error "No directory, logging in with HOME=/"
When I log into root from the command line and run ls "home" is the only folder/file listed. Home contains "shawn" and inside of that folder are all of my files.
What is the current directory when running ls here? As it was surely not /, I see no reason why you can't move the contents of $PWD/home to /home to restore the directory structure.
Offline
Solved with a quick mv /root/home/shawn /home/
I made things alot more complicated than they needed to be...
Thank you to everyone who helped me fix my mistakes
Last edited by ShawnB391 (2010-06-20 01:47:27)
Offline