View Full Version : After installation problem - adding /home back to fstab
spaceballs
Oct 11th 2010, 08:04 PM
Hi!
Thanks again for being an awesome site. I tried to delete an earlier thread as I came across an install disk and decided it would be helpful to do a clean install.
I got an error during installation when I tried to use my previous /home partition as my /home partition without formatting on my new install. I believe this is a bug...but we can figure out that later.
So my install was successful, and right now, the current /home directory just sits on the / partition. How do I fix this so that my previous /home partition is now mounted correctly as /home and added to the fstab in a proper way?
Thanks for your help!
kyonides
Oct 11th 2010, 08:30 PM
An easy way would be something like this added to /etc/fstab
/dev/sda3 /home ext3 errors=remount-ro 0 1
You may need to change sda3 to sda5 or sdb3 or whatever your partition should be.
If you prefer to use the UUID instead of the /dev option, run blkid to get the specific one for that partition.
oshunluvr
Oct 11th 2010, 08:52 PM
Couple of things here -
Just so I'm straight on the issue: you have a /home partition that you used during a previous install that is not being mounted as /home and you want to do that? If you have nothing much in the way of files in your /home thats under root just:
Edit /etc/fstab adding the /home partition
Log out
hit Alt-f1 and log in
do "sudo mount -a"
hit alt-f7 and log back in.
should be good to go.
There will be config files left behind and hidden in /home under /, but it's not a ton of data. If you need to want to delete or access them, use the live cd is the easiest way. Boot to it and mount your / partition, rename /home to something else and create a new /home and reboot back to your install.
spaceballs
Oct 11th 2010, 09:03 PM
Thanks for chiming in oshunluvr. Thank again for your help on all the RAID stuff a few weeks back. It looks like I have to hit you up again for some advice/help.
Keep in mind, the last time I backed up was about 2 weeks ago. I think I might have lost some data - but not too much.
Previously, when we were messing with my RAID stuff, I had set up my 2nd hard drive to be identical - and did a full backup then. Back then, my primary drive was /dev/sda and my second was /dev/sdb.
During the install, I had asked for /dev/sda to be my main drive as before, and had asked for /dev/sdb to be formatted [this is where I messed up]. I did like you just mentioned and added my /home partition back, but stuff didn't look quite right. The time stamps looked a little bit old. My heart started pounding as I realized that my previous /dev/sdb has become my /dev/sda and my original /dev/sda is now formatted.
Now, the formatting was done by the install utility. Nothing has been written back since then. I do have a copy of my previous MBR. Is it possible to copy the MBR [or something like that] back to the old drive and get everything back the way it was?
Or am I screwed?
spaceballs
Oct 11th 2010, 10:03 PM
Ok...used test disk to go through the old disk. It looks like everything is still there - at least the filenames are.
Is there anything I should be careful with?
oshunluvr
Oct 11th 2010, 11:15 PM
Funny, I just went through something similar this weekend. I had 2tb of video at risk and didn't lose a frame. ;D
You can rewrite the MBR if you still have the file:
dd if=PATHTOFILE of=/dev/sda
this assumes you have the 512b whole MBR and not just the partition table, which only 64b.
I had more problems than just a deleted partition - I had overlapping partitions that I had to fix.
Try restoring the old MBR first. If that doesn't work right away - don't panic. Until you overwrite the data there's a very good chance we can still get to your data.
If this fails, examine the disk with "testdisk" - it will run a while but may very likely find your partition(s) for you. Post back and I'll give more details if needed.
oshunluvr
Oct 11th 2010, 11:18 PM
Basically, if testdisk can find the partition geometry - cylinders, heads, starting sector, ending sector...
you can use fdisk to recreate your partition table manually. Then, you run file check on the restored partitions to verify all is well - but run with the --check option. You don't want anything written at this stage.
spaceballs
Oct 11th 2010, 11:44 PM
Linux 0 1 1 242 254 59 3903728
Linux 0 1 1 242 254 59 3903728
Linux Swap 243 0 1 3889 254 40 58589032
Linux 3890 0 1 34283 254 61 488279608
Linux 3890 0 1 34283 254 61 488279608
Linux 34284 0 1 121600 254 58 1402747600
Linux 34284 0 1 121600 254 58 1402747600
OK. The testdisk analyzer is still running, but these are all of the partitions. I went through earlier, and it looks like the filenames are in tact. So basically, I should just be able to write this down into the partition table [same thing as the MBR, right?], remount everything, and I should be solid, right?
Can you give me some more direction about recreating my partition table using fdisk and then checking the restored partitions? Thank you a lot!
oshunluvr
Oct 12th 2010, 12:07 AM
Looks like you've got double listings. I see these four partitions;
start end size in sectors
Linux 0 1 1 242 254 59 3903728
Linux Swap 243 0 1 3889 254 40 58589032
Linux 3890 0 1 34283 254 61 488279608
Linux 34284 0 1 121600 254 58 1402747600
I appears they're all primary? What is the output of sudo fdisk -l /dev/sda
spaceballs
Oct 12th 2010, 12:21 AM
sudo fdisk -l /dev/sdb is from the disk that is having trouble. This is the one that used to be /dev/sda on my previous installation.
$ sudo fdisk -l /dev/sdb
Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/sdb doesn't contain a valid partition table
But, since you asked, from /dev/sda [which used to be /dev/sdb and contains a backup from a couple of weeks ago]:
$ sudo fdisk -l /dev/sda
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00040b2b
Device Boot Start End Blocks Id System
/dev/sda1 * 1 243 1951866 83 Linux
/dev/sda2 244 3890 29294527+ 82 Linux swap / Solaris
/dev/sda3 3891 34284 244139805 83 Linux
/dev/sda4 34285 121601 701373802+ 83 Linux
I guess what I would like to do is get /dev/sdb up and running again, and if possible, make it my primary hard drive - like it used to be. However, I guess I could rsync them together again and it wouldn't make that much difference.
spaceballs
Oct 12th 2010, 01:14 AM
Disk /dev/sdb - 1000 GB / 931 GiB - CHS 121602 255 63
Partition Start End Size in sectors
* Linux 0 1 1 242 254 63 3903732
P Linux Swap 243 0 1 3889 254 63 58589055
P Linux 3890 0 1 34283 254 63 488279610
P Linux 34284 0 1 121600 254 63 1402747605
Just finished running the analyze part of testdisk and this is the output.
spaceballs
Oct 12th 2010, 05:15 AM
After running testdisk, I let it try to write the partition table, and it worked!
Now...and this is more minor. What is the best way to sort of back up my current hard drive with the more recent files from the other hard drive? I think that it might only be a handful of files, but I want to be sure before moving on.
Thanks again for all of your help.
oshunluvr
Oct 12th 2010, 10:24 AM
Great! that was easy :D whew! and you're right, I got confused with all the drive switching... lol
As far as your last post: I'm confused again. It sounds like you have some files you've updated on one drive and you want to duplicate them on the other one so they're both the same. Is that right?
Before you do anything, I'd take the time to verify your file systems are all OK. I assume you're still using ext4? If so, fsck will check your partitions.
I'm sure there's some zippy utility out there that will locate your newer files for you. Do you know what date/time you would consider new enough to at least look at? If so the find utility works great. You can use kfind from the GUI or find at the command line and get a list of what files have been modified since whenever. Then review and copy those you deem worthy.
spaceballs
Oct 12th 2010, 01:42 PM
Got it. Thanks for your help. fsck did fine.
Tell me one more thing. How can I make it so that this doesn't happen again? What makes one particular hard drive sda one time and sdb another? I would really like to sort that out. Thanks!
oshunluvr
Oct 12th 2010, 02:41 PM
I wish I had a good answer. Usually, the bios determines the drive order and most modern bios's (bioii ?) will have the ability to re-arrange this as you see fit.
Many OS's and/or installers will assign sda to the first drive it sees, which might not be the first drive in the bios. Often it's the drive you booted to or possibly even the drive you ask it to install to. I'm not really sure how to control it.
I just tried to do a new install of 10.10 and it identified my drives as sda, sde, sdf, sdg for no apparent reason.
Since we have identical drives (in my case 4), it can get tricky. All I can say is proceed very slowly. I use partition labels on many of my partitions, which the kubuntu installer sees so I am sure which is which. Another solution is to not use the exact same partitioning scheme on both drives.
dibl
Oct 12th 2010, 02:52 PM
I believe (you can do the experiment) that new BIOSs read the SATA bus one connector at a time, and sequence the drives accordingly. In other words, which motherboard connector you plug into is part of the answer.
As far as keeping the partitions straight, this is the whole "question" that is answered by UUID -- the problem that the advent of hot-pluggable storage devices totally destroyed the /dev/hdx model of partition enumeration. Using labels is also a pretty good idea -- I do that too. So, using /etc/fstab, you can mount partitions "by-UUID" or "by-label" and keep your permanent filesystems straight.
But using RAID introduces another layer of complexity -- oshunluvr can be the expert on that. :P
oshunluvr
Oct 12th 2010, 03:30 PM
only if you use that term loosely... ;)
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.