Re: recovering data from a preceding installation of Fedora..

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/17/2014 10:12 PM, Angelo Moreschini wrote:
thanks to you both
I was able to copy the data I was interested

Very happy to hear that, Angelo! We're glad to help!

A bit of research shows that on older systems (e.g. F17-19), the first
user was given a default UID and GID of 500. In F20 and later, I think
it defaults to 1000. Endless fun for porting files back and forth.

"Give me consistency or give me something else!"

On Wed, Dec 17, 2014 at 8:03 AM, Robin Laing <MeSat@xxxxxxxxxxxxxxx
<mailto:MeSat@xxxxxxxxxxxxxxx>> wrote:

    On 2014-12-16 10:31, Rick Stevens wrote:

        On 12/16/2014 09:05 AM, Angelo Moreschini wrote:

            Hi,

            I I had to re install Fedora on my computer, I did it and
            now I have to
            restore the data from the old installation.

            Using an external support for the disc ("USB to SATA / IDE
            converter") I
            can access the old drive, and using Nautilus to see all the
            data that I
            would recover, but I do not have permission to copy them (on
            the disk
            where I made the new installation of Fedora).

            I tried to mount the partition (where the data is recorded
            that I want
            to recover), but the directories and the data that I have
            not mounted
            directly readable ... So I can not make the transfer of data
            that I
            need ...

            What is the correct way to conduct this operation ???


        It is most likely that your user ID and group ID (UID and GID) are
        different on the new installation than they were on the old one. As
        a result, you'll need to do the mount and copy operations as the
        root
        user and convert the UID/GID of the files you're copying from
        the old
        installation to the UID and GID of your account on the new system.

        To find your current UID/GID, log into the new system and issue the
        command "id". Example:

              [rick@localhost ~]$ id
              uid=1000(rick) gid=1000(rick) groups=1000(rick),10(wheel)

        So I'm user ID 1000 and group ID 1000. Now, as the root user, mount
        your drive and use the "cp -an" command to copy the files from
        the old
        drive to wherever you need them (the "-n" part will keep you from
        overwriting existing files on the new system). If you really want to
        stomp on everything, omit the "n" (e.g. "cp -a" only). Also keep in
        mind that this will NOT copy hidden files or directories (those that
        start with a ".", such as ".bashrc" and the like). Those you have to
        copy individually or use a tool such as "rsync" or "find".

        Once you're done with that, again as root, try using:

              chown -R youruserID:yourgroupID /path/to/new/files

        to change the UID and GIDs of the files at "/path/to/new/files"
        to your
        new IDs (that you got from the "id" command).

        That's it in a nutshell. There may be better ways to do it and
        you'll
        have to adapt these instructions to fit your particular case.
        ------------------------------__------------------------------__----------
        - Rick Stevens, Systems Engineer, AllDigital
        ricks@xxxxxxxxxxxxxx <mailto:ricks@xxxxxxxxxxxxxx> -
        - AIM/Skype: therps2        ICQ: 22643734            Yahoo:
        origrps2 -
        -
             -
        -       "I'd explain it to you, but your brain might explode."
              -
        ------------------------------__------------------------------__----------




    If you have copies of the /etc/passwd and /etc/groups files, then
    you have an option to move your users to the new machine and then it
    makes it much easier to restore files.


     >From a file that I have used for years.  UGIDLIMIT was 500 in the
    original.




    First create a tar ball of old uses (old Linux system). Create a
    directory:
    # mkdir /root/move/
    Setup UID filter limit:
    # export UGIDLIMIT=1000
    Now copy /etc/passwd accounts to /root/move/passwd.mig using awk to
    filter out system account (i.e. only copy user accounts)
    # awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534)'
    /etc/passwd > /root/move/passwd.mig
    Copy /etc/group file:
    # awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534)'
    /etc/group > /root/move/group.mig
    Copy /etc/shadow file:
    # awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534) {print
    $1}' /etc/passwd | tee - |egrep -f - /etc/shadow > /root/move/shadow.mig


    Make a backup of /home and /var/spool/mail dirs:
    # tar -zcvpf /root/move/home.tar.gz /home
    # tar -zcvpf /root/move/mail.tar.gz /var/spool/mail



    # mkdir /root/newsusers.bak
    # cp /etc/passwd /etc/shadow /etc/group /etc/gshadow /root/newsusers.bak

    Now restore passwd and other files in /etc/
    # cd /path/to/location
    # cat passwd.mig >> /etc/passwd
    # cat group.mig >> /etc/group
    # cat shadow.mig >> /etc/shadow
    # /bin/cp gshadow.mig /etc/gshadow

    Please note that you must use >> (append) and not > (create) shell
    redirection.

    Now copy and extract home.tar.gz to new server /home
    # cd /
    # tar -zxvf /path/to/location/home.tar.gz

    Now copy and extract mail.tar.gz (Mails) to new server /var/spool/mail
    # cd /
    # tar -zxvf /path/to/location/mail.tar.gz

    Now reboot system; when the Linux comes back, your user accounts
    will work as they did before on old system:
    # reboot

    Please note that if you are new to Linux perform above commands in a
    sandbox environment. Above technique can be used to UNIX to UNIX OR
    UNIX to Linux account migration. You need to make couple of changes
    but overall the concept remains the same.



    --
    Free, full feature astronomy program at
    http://www.stellarium.org

    Free Office Suite at
    http://www.libreoffice.org

    --
    users mailing list
    users@xxxxxxxxxxxxxxxxxxxxxxx <mailto:users@xxxxxxxxxxxxxxxxxxxxxxx>
    To unsubscribe or change subscription options:
    https://admin.fedoraproject.__org/mailman/listinfo/users
    <https://admin.fedoraproject.org/mailman/listinfo/users>
    Fedora Code of Conduct: http://fedoraproject.org/code-__of-conduct
    <http://fedoraproject.org/code-of-conduct>
    Guidelines: http://fedoraproject.org/wiki/__Mailing_list_guidelines
    <http://fedoraproject.org/wiki/Mailing_list_guidelines>
    Have a question? Ask away: http://ask.fedoraproject.org





--
----------------------------------------------------------------------
- Rick Stevens, Systems Engineer, AllDigital    ricks@xxxxxxxxxxxxxx -
- AIM/Skype: therps2        ICQ: 22643734            Yahoo: origrps2 -
-                                                                    -
-  Memory is the second thing to go, but I can't remember the first! -
----------------------------------------------------------------------
--
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org




[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux