0

I have elementary OS(based on Ubuntu 14.04) installed on my Laptop. I wish to install Windows 10 on my laptop's primary hard disk. I have another external hard disk which I want to use for elementary OS.

I don't wish to loose any data. How would I move Elementary OS on that external hard disk. I still want to make that external drive bootable.

So I can boot from that hard drive when ever I wish to use Elementary OS and Windows

  • Does the external drive already have data on it? – Monomeeth Apr 27 '16 at 19:48
  • @Monomeeth i can empty that hard disk. But I don't want to loose data and configuration of my elementary OS installed on primary laptop's hard disk – Abhimanyu Aryan Apr 27 '16 at 19:49
  • Is removing the internal HDD and replacing it with the currently external HDD an option? – Andrew Morton Apr 27 '16 at 20:35
  • You don't need to do a clone / dd image of linux to have it still work, you could just use cp or rsync etc that copies the files & permissions. I think Windows used to care if it wasn't in the exact same sector of a drive & complain, but linux doesn't mind. But, setting up partitions & grub again can be a hassle, so especially if the new drive is equal or bigger than the old one cloning should work. – Xen2050 Apr 28 '16 at 6:09
2

Then you'll have to clone the whole disk (the primary one, where you currently have elementary OS) into the external disk.

I've always done this with a live USB/CD, so that's what I recommend you to use. Otherwise, the results may be unexpected (thanks @Xen2050 for the heads-up!).

NOTE: This will delete all data on your external HDD.
Also, a backup of your main disk is strongly encouraged.

  1. Identify the /dev/sdX path of both your main and external drives:

    $ sudo fdisk -l
    
  2. Do the cloning using dd:

    $ dd if=/dev/sdX of=/dev/sdY bs=64K conv=noerror,sync
    

    Replacing sdX with your primary disk, and sdY with the external one. Be very sure of that you're writing them correctly, or you could delete/overwrite important stuff!

    The additional parameters (bs and conv) are the recommended ones by Arch Linux's wiki, you can find more information on what they mean there.

  3. Install Windows on your main drive. Feel free to delete all the stuff in it, it should be in your external disk now (though I'd insistently recommend you to check it before, by trying to boot from the external HDD before doing any deletion).

  • so Linux has built in tool to clone hard disk? I was wondering if I had to use clonezilla – Abhimanyu Aryan Apr 27 '16 at 19:58
  • @AbhimanyuAryan Yup. dd is a very powerful low-level tool that allows you to do many other interesting things (such as writing ISO's), by copying (and converting) stuff from one partition/disk/image to another. – Hewbot Apr 27 '16 at 20:01
  • 2
    You should only dd-copy an un-mounted partition/drive, so using a live ISO may be easiest. I like the name Data Destroyer for dd, if you mix up the if & of you'll permanently overwrite your data, so a regular backup of any important files is a good idea first – Xen2050 Apr 28 '16 at 6:04
  • @Xen2050 Absolutely! Sorry, I forgot about that. I've just updated the answer to point that out. – Hewbot Apr 28 '16 at 13:25
1

Without knowing your exact setup, I'd do the following:

  • backup any data on your external drive
  • make a clone of your internal drive to your external drive
  • remove anything you don't want on your cloned external drive

If you're not familiar with cloning a drive, there are a number of paid and free utilities for doing this. Some free options are:

Note: The above approach assumes your external drive is at least as large as your internal one.

Hope this helps. Good luck.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.