LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   re-install mistake (https://www.linuxquestions.org/questions/linux-newbie-8/re-install-mistake-4175479233/)

fredgrimes 10-01-2013 01:19 PM

re-install mistake
 
Hey all,
I am new to linux and have had to re-install and initially created 3 partitions - root, swap and home - and when I had to reinstall i thought that rather than use the option to use entire disk I would try 'other' as I had stuf in my home directory that I wanted to keep.
I formatted the root partition but left home alone and installed the os,
When I rebooted the ther was nothing in my home directory at all.
So I checked gparted and it was showing /dev/sda1 as 43.57 gb and the rest after a small unallocated gap dev/sda3 extended, dev,sda5 swap and
dev/sda6 ext4 which I assume is my old home folder.
Is there any way to get that old home folder back?
I aqm using mint 15 cinnamon 64 bit and I didn't encrypt any folders

TobiSGD 10-01-2013 01:45 PM

It is pretty easy to get your /home back. Open the file /etc/fstab as root user in a text editor, for example with
Code:

sudo gedit /etc/fstab
Then add this line to the end:
Code:

/dev/sda6        /home                ext4        defaults        1  1
Now reboot the system and you should be fine.

suicidaleggroll 10-01-2013 01:49 PM

Please post the output of "fdisk -l" as root/sudo to confirm, but it sounds like you told the installer to leave the old home partition alone, but didn't tell it to mount that partition anywhere. So now you have two home directories, the old one sitting on its own partition on sda6, and the new one sitting in a directory as part of / on sda1.

Migrating is easy, but you can't do it as your regular user. You'll need to enable the root account, log out as your regular user, and log in as root (either graphically, or preferably by using one of the Ctrl+Alt+F# consoles).

What you do from there is pretty straight forward. If there's nothing you need to save in this new home folder, then just delete everything inside of it, clean it out. Then you'll want to mount sda6 at /home. You should start by doing it manually, and once you verify everything is working you would add it to fstab to auto-mount on boot.

If you have any questions on any of these steps then feel free to ask. But before you start make sure you post the output of "fdisk -l", and it would be a good idea to mount sda6 somewhere and see what's inside to confirm it really is your old home directory before proceeding with the above steps.

fredgrimes 10-01-2013 02:21 PM

2 Attachment(s)
Unfortunately that didn't work
I think it may have been due to the fact that there weere 2 home directories
and when ~I tried to reboot it came up with an error asking me to log in as root
ass there was a problem ( sorry I didn't have a pen to write it down ) and when
i tried to log in it gave another error relating to the home directory and then said
could not update ice something.

Luckily I had renamed the original fstab file reather than overwriting it :)
here are the 2 fstabs:
original:

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda1 during installation
UUID=21d6c514-35ce-4014-b7d3-4f78e588d480 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=f100f677-3a96-452b-a0ca-eb3800e099a3 none swap sw 0 0

and second one:

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda1 during installation
UUID=21d6c514-35ce-4014-b7d3-4f78e588d480 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=f100f677-3a96-452b-a0ca-eb3800e099a3 none swap sw 0 0
/dev/sda6 /home ext4 defaults 1 1

I have just checked disks from the application menu and it shows the swap as in use but the old
home as not in use.

Ihave included screenshots from gparted and disk (hopefully the work)

fredgrimes 10-01-2013 02:30 PM

suididaleggroll
Sorry I didn't the post you made

Here is the result of fdisk -l

Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000a304c

Device Boot Start End Blocks Id System
/dev/sda1 * 2048 91371188 45684570+ 83 Linux
/dev/sda3 91373566 625141759 266884097 5 Extended
/dev/sda5 91373568 114808831 11717632 82 Linux swap / Solaris
/dev/sda6 114810880 625141759 255165440 83 Linux

Disk /dev/sdb: 16.0 GB, 16039018496 bytes
255 heads, 63 sectors/track, 1949 cylinders, total 31326208 sectors
Units = sectors of 1 * 512 = 512 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/sdb1 * 2048 31326207 15662080 7 HPFS/NTFS/exFAT

Disk /dev/sdc: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xa4b57300

Device Boot Start End Blocks Id System
/dev/sdc1 63 625137344 312568641 7 HPFS/NTFS/exFAT

Disk /dev/sdd: 1000.2 GB, 1000204886016 bytes
1 heads, 63 sectors/track, 31008336 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00d7bc16

Device Boot Start End Blocks Id System
/dev/sdd1 * 63 1953520127 976760032+ 7 HPFS/NTFS/exFAT

fredgrimes 10-01-2013 02:58 PM

I have just noticed that for some reason if I plugin the usb thumb drive with the live image
of mint on it after I have already booted, the old home partition gets mounted as well.
Now I am really confused

TroN-0074 10-01-2013 03:15 PM

I would probably do a reinstall if it were my case. But this time when is the time to set partitions select something else like you did before, and click on the existing partitions and choose where you wish them to be mounted and if you wish them to be formated.

select the root partition and choose it to be formate in ext4 and to be use for /
select your old home partition and choose no to be formated, select also to be mounted as /home
for swap the OS will pick it up imediatelly but you can click on it just to make sure.

proceed with the installation, all the settings you had from the previous installation should be there.

Good luck to you

TobiSGD 10-01-2013 03:18 PM

Quote:

Originally Posted by fredgrimes (Post 5038143)
Unfortunately that didn't work
I think it may have been due to the fact that there weere 2 home directories
and when ~I tried to reboot it came up with an error asking me to log in as root
ass there was a problem ( sorry I didn't have a pen to write it down ) and when
i tried to log in it gave another error relating to the home directory and then said
could not update ice something.

May it be possible that you have chosen a different username for your new installation?

suicidaleggroll 10-01-2013 07:30 PM

Quote:

Originally Posted by TobiSGD (Post 5038170)
May it be possible that you have chosen a different username for your new installation?

This is my guess, or the username was associated with a different UID in the new installation. There's nothing difficult amount migrating your /home onto another partition, I do it nearly every time I build a computer (I often set up a separate boot drive and RAID, install everything to / (boot drive) initially, then migrate /home onto the RAID after installation). It's really very straight forward, no need for re-installing the OS.

As I mentioned before, you should mount sda6 somewhere and verify its contents before attempting the migration. This will ensure everything looks the way you expect before you dive in head first with fstab and hope it works.

Get rid of that line you added to fstab, boot back into Mint, and run the following:
Code:

mkdir /mnt/oldhome
mount /dev/sda6 /mnt/oldhome
ls -l /mnt/oldhome
id

This will let you verify that the name and UID of your user in the new install matches what your old home partition expects.


All times are GMT -5. The time now is 08:20 AM.