Find the answer to your Linux question:
Results 1 to 9 of 9
Hi guys! Here's my situation: I had Ubuntu Studio x64 set with three partitions, swap, /home, and / (respectively) on one IDE HD, with win7b and xp on separate sata ...
  1. #1
    Just Joined!
    Join Date
    Mar 2009
    Location
    NOLA
    Posts
    10

    Red face [SOLVED] create new /home

    Hi guys!
    Here's my situation: I had Ubuntu Studio x64 set with three partitions, swap, /home, and / (respectively) on one IDE HD, with win7b and xp on separate sata hd. Windows bugged out and corrupted my boot sectors, and upon running fixmbr it took hidden liberties to overwrite my /home partition with xp bootloader, and I ended up reformatting the /home partition to ext3.

    After unplugging the windows disk, I successfully reinstalled grub and am left without a working /home. I have a LOT of stuff [drivers, X11, other packages, etc..] installed and configured in my root system, and need to recreate a working /home. I assume I'll need to reinstall all my packages for the new /home/[user], but don't want to lose the system settings for them.. Can anyone help me?

    Many thanks in advance!

  2. #2
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,316
    You don't have to re-install any package but user settings are gone now. User settings are stored in /home/user folder only.
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  3. #3
    Trusted Penguin elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    2,302
    Can you post the output of "fdisk -l" that's a small L and you don't need the quotes
    If we hit that bullseye, the rest of the dominoes will fall like a house of cards. Checkmate! (Zapp Brannigan)


    My new blog. It's probably not as good as I think it is.

  4. #4
    Just Joined!
    Join Date
    Mar 2009
    Location
    NOLA
    Posts
    10
    Quote Originally Posted by elija View Post
    Can you post the output of "fdisk -l" that's a small L and you don't need the quotes
    here's the output
    Code:
    ubuntu@ubuntu:~$ sudo fdisk -l
    
    Disk /dev/sda: 122.9 GB, 122942324736 bytes
    255 heads, 63 sectors/track, 14946 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Disk identifier: 0x0a6885bc
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1               1        1945    15623181    f  W95 Ext'd (LBA)
    /dev/sda2            1946        9349    59472630   83  Linux
    /dev/sda3   *        9350       14946    44957902+  83  Linux
    /dev/sda5               1        1945    15623149+  82  Linux swap / Solaris
    ubuntu@ubuntu:~$
    my Ubuntu install is the only disk I have plugged in right now (I'll tackle xp later)
    /home should be on /dev/sda2, but is now blank

    It's good to know I won't have to reinstall any packages and figured the usr setting are gone - I'm sure I'll have to reconfig the uid for the would-be duplicate uname/pwd once I get /home redone.

    Will the usr-specific config fie/folder structure reconstitute as I use existing packages? (of course after /home gets reconstituted)

  5. #5
    Linux Guru jmadero's Avatar
    Join Date
    Jul 2007
    Location
    California
    Posts
    1,958
    If by "reconstitute" you mean rebuild identically to the way you had it before...no they won't. They'll just put default folders in your /home that have the config stuff (defaults) not the previously set ones.

    Usually configuring is okay, but other stuff could have been lost. If you are just looking at reconfiguring I'd suggest just doing it from scratch and then backing up your home folder after for future use.

    If instead you are talking about other things. Such as documents, etc...(when I tore up my home folder a month or two ago I had my thunderbird set up, 1.1 gigs of email....) I'd recommend spending a bit more time trying to find a solution. One thing to note, if this is the case, STOP WRITING TO THE DISK, as the more you write, the less likely it is that you'll save anything -- it's already pretty unlikely but, the more you write the more chance it'll overwrite the "deleted" stuff
    Bodhi 1.3 & Bodhi 1.4 using E17
    Dell Studio 17, Intel Graphics card, 4 gigs of RAM, E17

    "The beauty in life can only be found by moving past the materialism which defines human nature and into the higher realm of thought and knowledge"

  6. #6
    Just Joined!
    Join Date
    Mar 2009
    Location
    NOLA
    Posts
    10
    can I mount /dev/sda3 and copy over /home from the livedvd, delete the "Ubuntu" user, and create new user as my old username and change the UID in permissions' & groups' config? How do I get the sys to see the new /home as a partition?


    I'm sorry, I meant to say can I mount /dev/sda2 and copy over /home...

  7. #7
    Linux Guru Jonathan183's Avatar
    Join Date
    Oct 2007
    Posts
    2,941
    Does the system boot in recovery mode? if it does then use that to create another account with admin access rights.

    If you can't get in using recovery mode then I'd be tempted to try boot from the live CD, chroot into your existing install and add a user. Give you new user admin rights then restart the system from the hard drive, login as the new user and use that account to delete and recreate the original account using GUI tools.

    ... after you have backed up user data to a pen drive/other disk

  8. #8
    Just Joined!
    Join Date
    Mar 2009
    Location
    NOLA
    Posts
    10

    Talking Eurika! I made success!

    Quote Originally Posted by Jonathan183 View Post
    Does the system boot in recovery mode? if it does then use that to create another account with admin access rights.

    If you can't get in using recovery mode then I'd be tempted to try boot from the live CD, chroot into your existing install and add a user. Give you new user admin rights then restart the system from the hard drive, login as the new user and use that account to delete and recreate the original account using GUI tools.

    ... after you have backed up user data to a pen drive/other disk
    That's sorta what I did- here's my steps (some steps borrowed from the ubuntu 'how to reinstall grub' howto (https://help.ubuntu.com/community/Re...llingWindows):

    1) I booted from liveCD & opened terminal

    in terminal,

    Code:
    sudo su
    
    fdisk -l
    which gave me..

    Code:
    Disk /dev/sda: 122.9 GB, 122942324736 bytes
    255 heads, 63 sectors/track, 14946 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Disk identifier: 0x0a6885bc
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1               1        1945    15623181    f  W95 Ext'd (LBA)
    /dev/sda2            1946        9349    59472630   83  Linux
    /dev/sda3   *        9350       14946    44957902+  83  Linux
    /dev/sda5               1        1945    15623149+  82  Linux swap / Solaris
    2. I created a mount point for root, using /dev/sda3 which had my system files & existing /root directory on it..

    Code:
    mkdir /mnt/root
    
    mount -t ext3 /dev/sda3 /mnt/root
    3. then I made a mount point for proc so I can open dialog between utilities and the kernel for interfacing w/ the new filesystem (not sure that this was required)

    Code:
    mount -t proc none /mnt/root/proc
    4. then I had to bind the devices(/dev) from the hard drive with a working mount point

    Code:
    mount -o bind /dev /mnt/root/dev
    5. at this point I created a new user from the liveCD's menu system>administration>users&groups with identical username & pwd from my old account (i didn't put my 'real name' like i did on the first account, though) and then moved the account to the space that would be /home

    Code:
    mv /home/tofue /media/disk
    where 'tofue' is the new username and 'disk' is what the liveCD recognized as the partition when mounted through nautilus.

    6. I unmounted /media/disk and after reading a little more from my Red Hat Linux Bible, I found the following steps to set up a new file system on the partition that would become /home (/dev/sda2)

    Code:
    mkfs -t ext3 /dev/sda2
    for whatever reason I rebooted.

    during boot, I received errors telling me that there were broken links, and the boot process defaulted me to a terminal. I could have probably finished these next steps without the reboot, but oh well. now I was working directly from my install.

    I didn't have to change /etc/fstab at all, or alter /etc/passwd as (I assume) the uuid of the partition and the uid of the account defaulted to be the same as the old ones. I would have probably had to alter them if I had more than one account, and this one was down the list, or other weird stuff

    7. so all I really had to do next was to mount the new /home drive and be done

    Code:
    mount -t ext3 /dev/sda2 /home
    (I think the first time I typed that, it gave me an error of some sort while under the liveCD, so I ended up creating /home2 as the mount-point >doh!<)


    ###. so I found a command in the good book that lets me see what filesystems are mounted to what devices, bound to what, and all..

    Code:
    df -h
    which gave me..

    Code:
    root@ectotron:~$ df -h
    Filesystem            Size  Used Avail Use% Mounted on
    /dev/sda3              43G  6.2G   34G  16% /
    tmpfs                 4.0G     0  4.0G   0% /lib/init/rw
    varrun                4.0G  224K  4.0G   1% /var/run
    varlock               4.0G     0  4.0G   0% /var/lock
    udev                  4.0G  3.4M  3.9G   1% /dev
    tmpfs                 4.0G  628K  4.0G   1% /dev/shm
    lrm                   4.0G  2.4M  3.9G   1% /lib/modules/2.6.27-11-generic/volatile
    /dev/sda2              57G  181M   54G   1% /home
    /dev/scd0             695M  695M     0 100% /media/cdrom0
    so again, I rebooted. This time it was into my old environment- barren, but there (like comeing home after Katrina hit!)

    and, Eureka, I was done.. though I still haven't cold-booted again to be certain, but I'm sure it's all cured! hehe (watch me eat my words!)

    Thanks guys for all the suggestions, and I hope this helps someone that finds themselves in a similar bind!

  9. #9
    Just Joined!
    Join Date
    Mar 2009
    Location
    NOLA
    Posts
    10

    Red face create new /home

    Ack! I left out a step in the thread http://www.linuxforums.org/forum/ubu...-new-home.html - I actually had to alter /etc/fstab to match the new UUID to /dev/sda2 which was done by

    Code:
    vol_id -u /dev/sda2
    and compare replace the /etc/fstab value using

    Code:
    vim -n /etc/fstab
    could a moderator merge the threads, please

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...