Find the answer to your Linux question:
Results 1 to 8 of 8
I don't think it is, as the scenario is slightly weird, and the chances of something going wrong probably too high to make it appealing, but since I have the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jun 2010
    Posts
    8

    Installing debian from debian, is that even possible?


    I don't think it is, as the scenario is slightly weird, and the chances of something going wrong probably too high to make it appealing, but since I have the eternal noob complex I decided to ask.

    So this is the situation. I had debian in a hdd on a laptop, removed the hdd, put a new one, installed windows (I didn't want, but I had to) and left the space of the old hdd + 20GB to put debian again.

    I want my debian back, but I don't want to cause any problem with the windows installation because it can be extremely painful to go through it again. I have my old debian in a hdd and will soon get a hdd case to connect it with usb, that would let me even to boot using the usb.

    So far I thought of having a list of installed packages in the old debian, reinstall them all, copy the home folders and some configuration files, like cups and some stuff, maybe the whole /etc (I'd have to check the contents of /etc I don't know at this moment if something should be kept in the new installation)

    But probably you know better ways to do the same. Dunno.

    Thank you in advance.

  2. #2
    Just Joined!
    Join Date
    Mar 2010
    Posts
    79
    I have done something like that with rsync and usb-stick.
    The laptop had no internet connection (stoneage-style) and i needed to do an install in VirtualBox, copy it on the stick and from the stick on the laptop.

    That was the structure (somehow).
    The old hdd in the laptop and booted.
    Run:
    Code:
    mount /dev/sdd1 /media/backup
    rsync -auv -n --delete-after \
    --exclude="/home/user_fritz/[a-zA-Z0-9]*" \
    --exclude="/home/user_fritz/.VirtualBox/*" \
    --exclude="/home/user_karl/[a-zA-Z0-9]*" \
    --exclude="/proc/*"  \
    --exclude="/lost+found/*" \
     --exclude="/dev/*" \
      --exclude="/mnt/*" \
     --exclude="/media/*" \
     --exclude="/sys/*" \
     --exclude="/tmp/*"\
     / /media/backup >dry.txt
    If that works remove -> " -n " and -> " >dry.txt" and run it. It should work and it should also use the hidden configs of the users but not the visible data.

    Replace the hard-disk and boot a live-cd
    Mount the stick and mount the partition you want Debian to be installed on.
    Lets assume its
    Code:
    mount /dev/sdc1 /media/backup # the stick
    mount /dev/sda3 /media/restore #the hard-disk
    Then do
    Code:
    rsync -auv /media/backup/* /media/restore
    That command might be wrong, rsync is a bit tricky.

    Once that finished we need grub:
    Code:
    mount -t dev /media/restore/dev
    mount -o proc /proc /media/restore/proc
    mount -t sys /media/restore/sys
    chroot /media/restore
    grub-install /dev/sda
    In this example its /dev/sda.
    Edit menu.lst and add the entry for WinXP or, with grub2, run 'update-grub'
    Edit /etc/fstab according to the new layout.

    Umount and reboot
    Code:
    umount /media/restore/{sys,proc,dev}
    umount /media/restore
    umount /media/backup
    reboot
    If X doesn't start do "rm -r .Xauthority " in your home directory

    ------------------------------------------------------------------------------------------------------------------------------
    I wrote this down from the top of my head. It might contain errors, and they might burn the house down. Its a lots of words, but the whole process is a simple
    Code:
    a)copy the stuff from hdd-old to usb-stick and that from usb-stick to new hdd and
    b) reinstall grub
    c) eventually editing some files
    Clonezilla (for example) is said to do the same and way more comfortable.

    If it was me i would wait till i was able to boot the old hdd from usb.
    Greetings

  3. #3
    Just Joined!
    Join Date
    Jun 2010
    Posts
    8
    Yes, I definitively will wait until I have the case, I was asking in advance.

    Then I suppose I can just boot from the old hdd, rm everything but /boot on the new debian installation and cp the whole hdd but /boot.

  4. #4
    Just Joined!
    Join Date
    Mar 2010
    Posts
    79
    Quote Originally Posted by Trylks View Post
    Yes, I definitively will wait until I have the case, I was asking in advance.

    Then I suppose I can just boot from the old hdd, rm everything but /boot on the new debian installation and cp the whole hdd but /boot.
    I don't know if i understand you correct.
    If you boot from the old hdd you may mount the new hdd (the partition) and run rsync
    (exclude some stuff) and reinstall grub.

    If you want to do that do a bit of training with rsync. It is always good for a surprise.
    I had a look at Clonezilla and i for one would need to train it too (while others say its pretty easy).

    The main command to copy a complete install over to a mounted partition would be:
    mount /dev/sdd1 /media/backup
    Code:
    rsync -auv --delete-after \
    --exclude="/proc/*"  \
    --exclude="/lost+found/*" \
     --exclude="/dev/*" \
      --exclude="/mnt/*" \
     --exclude="/media/*" \
     --exclude="/sys/*" \
     --exclude="/tmp/*"\
     / /media/backup
    If you remove the whole exclude the command looks quite easy
    Code:
    rsync -auv --delete-after / /media/backup
    It rsyncs (copies) the whole installation (-> /) to /media/backup
    It excludes the system stuff you don't needs
    It uses -a : archive, that is keeps the ownership and so
    it uses -v: update, if you run it several times, as a backup, it only copies stuff which has changed
    it uses -v: verbose
    It --delete-after: well, that makes sure that stuff which changed on the source is in sync with the target
    --delete-after and -u are not really necessary if you just run it once.
    You don't need those stuff, thats the whole thing.

    There is also rsnapshot, but i don't know it. There also might be better tools to do the job.
    Good luck

  5. #5
    Just Joined!
    Join Date
    Jun 2010
    Posts
    8
    The idea was not to reinstall grub, which is something I never did and may be hard, but to install Debian, the minimum installation, that will install grub for me. Then all I need to do is keep the /boot directory.

    rsync may be better than rm + cp but I don't know why. I would also remove the --delete-after. It's always good to have a backup and I can delete everything manually anytime.

    I'm not really interested in doing a backup of my old HDD, I want my new linux installation to be just like the old one. So:

    ownership is needed, but I think cp keeps it.
    the system stuff: is needed AFAIK, it's the most important part, probably.
    About running it several times, I hope not to be switching disks to install more OSes regularly, specially because there aren't so many of them, I hope not to run it several times.

    Maybe I was not clear in the description.

    I have a computer. I had linux in the hdd, but I had to install windows too. So I put a new HDD, I installed windows and left room for linux, I got +20GB for linux, since it is a bigger hdd and despite of the disk used by windows linux still gains some space. I want to use that free space to put linux again, but now with dual boot (linux + windows), that's the only difference wrt the previous linux installation, that I keep in a hdd and will soon be able to boot from a usb case.

  6. #6
    Just Joined!
    Join Date
    Mar 2010
    Posts
    79
    The idea was not to reinstall grub, which is something I never did and may be hard, but to install Debian, the minimum installation, that will install grub for me. Then all I need to do is keep the /boot directory.
    Ok, i think i got it now (it was in the middle of the night...).
    You want to a) first do a usual install and b) copy the old install but keep the grub.

    You can use the rsync-command i told you and also "--exclude /boot/"
    Just add it to the excludes.

    If you got a VirtualBox you may run some tests. Start with easy stuff.
    Search for "nadir +rsync site:forums.debian.net" Lots of people have given me good advice.
    I did it very often (from hard-disk to laptop, from hard-disk to hard-disk; from hard-disk to VirtualBox and the other way around, and so on). It does work

    If i recall correct cp is said to have some drawbacks. I did it with cp too, as for some reason i had no rsync available, and it did work too. Make sure to use -a (like in archive).

    Re-installing grub is not really hard. The web offers lots of info, but mainly its what i said above
    (or at minimum something similar). You may also do it from the Debian-installation-CD, choose "expert" and then "repair", answer the questions and choose "re-install grub".

    Might be you run into little problems, but nothing which can't get solved.
    It it goes south you simply to the whole copy (via rsync or whatever) again until you got it sorted.

    good luck, its sure an operation of sweaty hands.

  7. #7
    Linux Newbie
    Join Date
    Jan 2007
    Location
    Arizona
    Posts
    139

    Wouldn't it be simpler to...

    Wouldn't it be simpler to dd-rescue the Debian installation from the old hard drive into an image, use the Parted Magic cd to restore that image onto the partition of the new drive, boot into that restored Debian and then reinstall GRUB?

  8. #8
    Just Joined!
    Join Date
    Jun 2010
    Posts
    8
    I just found that I need special drivers for my new HDD, all I know by now is that it's sata and 500GB. I found that trying to install Debian from the CD.

    So I am using my old HDD and I haven't time to search info and work on this a this moment.

    I hope that for the time I can try again Debian has included support for my new HDD in the installation CD, that would be really helpful. If not, then I'll fin the way to install debian in that HDD, I'll copy the home folder and I'll re-install the packages as soon as I miss them. I can remember I configured samba, cups and added some fonts to the system, so I'll keep those and if I don't miss anything else in a few months whatever else is out of the home folder will be lost.

    In the next installation, I'll put links to those files and folders in the root "home" (/root), so that all I have to do is copy that too (and then link it again). Unless you recommend me a better practice.

    So I'll try in a far future (3 months) and I'll probably have to come back because I'll probably have many questions.

    Thank you very much for all the help
    Last edited by Trylks; 07-19-2010 at 08:22 PM. Reason: I forgot to say

Posting Permissions

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