Can I move my Linux installation to another drive?
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Can I move my Linux installation to another drive?
I have my Acer laptop dual booting to XP and PCLinuxOS 2007. XP and Linux share drive C: and I use lilo for booting. The Linux bit works well but recently XP has become very corrupted and needs to be reinstalled.
My laptop HDD is configured as 2 drives (C: and D of 50GB each. Is it possible to move the Linux to D: before reformatting C: (and expect it to be still available after XP is reinstalled)? Or do I have to accept that the XP failure means I have the loss of my Linux installation and need to start again for both OS's?
I'd like to finish up with Linux on D: and XP on C:. Would that work?
You can reinstall XP by only formatting that partition. No reason to lose your linux installation. Just don't go for the option to use the entire drive.
Your question is confusing because you are using DOS labels to describe your hard drive set up when what you really need to know is how your drive is partitioned.
Does your laptop have one or two physical drives?
C: and D: refer to hard drive partitions that Windows can see. Are you realy suggesting that your linux partition is on the same partition that is used by XP? It seems unlikely to me.
I suggest you post the output of fdisk -l so that it is clear what your set up is.
As far as moving the entire linux installation to another is concerned my answer is, yes, it can be done.
Disk /dev/hda: 100.0 GB, 100030242816 bytes
255 heads, 63 sectors/track, 12161 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 1 382 3068383+ 12 Compaq diagnostics
/dev/hda2 * 383 4650 34282710 c W95 FAT32 (LBA)
/dev/hda3 4651 6240 12771675 5 Extended
/dev/hda4 6241 12000 46267200 c W95 FAT32 (LBA)
/dev/hda5 4651 5613 7735266 83 Linux
/dev/hda6 5614 5806 1550241 82 Linux swap / Solaris
/dev/hda7 5807 6240 3486073+ 83 Linux
Disk /dev/sda: 2097 MB, 2097152512 bytes
255 heads, 63 sectors/track, 254 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 255 2047969 c W95 FAT32 (LBA)
Partition 1 has different physical/logical endings:
phys=(253, 254, 63) logical=(254, 245, 56)
Disk /dev/sdb: 2002 MB, 2002255872 bytes
58 heads, 57 sectors/track, 1182 cylinders
Units = cylinders of 3306 * 512 = 1692672 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 1183 1955263+ b W95 FAT32
Disk /dev/sdd: 65 MB, 65536000 bytes
8 heads, 32 sectors/track, 500 cylinders
Units = cylinders of 256 * 512 = 131072 bytes
Device Boot Start End Blocks Id System
/dev/sdd1 * 1 500 63972+ b W95 FAT32
Sorry for the confusion by using DOS labels! I'm still getting to grips with Linux terminology. Basically it's a laptop with an approx 100GB HDD that is split into 2 identical drives using DOS terms. Using Unix terms hda1 is the hidden partition containing a recovery copy of XP. hda5/6/7 are the Unix partitions and the rest are currently XP. In DOS terms hda2/3/4 are for XP with hda4 been the DOS D: drive.
I think it would also help if you told us how your linux is spread across your partitions. Could you post the contents of /etc/fstab.
The truth is that the way your partitions are arranged is a bit of mess with your extended partition in the middle. You will need to work out a strategy to deal with this.
I would suggest
1. format hda4 as ext3
2. copy linux to hda4
3. change /etc/fstab and lilo so that linux is booting onto hda4
4. rewrite your partition table so that you have
hda1 1 382
hda2 383 around 6050 for XP
hda3 6050 6240 swap (the value of 6050 might be giving you more swap than you really need)
hda4 untouched
5. format hda2 for XP
6. Reinstall XP
All this is fraught with danger that you might trash your system so back up any data first.
Many thanks for you time and interest. The disorganised nature of my HDD derives from having XP and 2 DOS drives on a single physical drive. I simply installed PCLinuxOS 2007 from the LiveCD and selected the options that were offered automatically.
However your suggestions on rearranging the various partitions look a very good starting point and I will begin by backing up my data!
I did try to use 'remasterme' on my present PCLinuxOS installation with the intention of producing my own version of the iso file and using that to reinstall. However that didn't go well (it wouldn't work in Konsole but did using Xterm) and the resultant DVD (c.1.5GB) wouldn't boot even though I've burnt iso images before and know what to do). Now my PCLinuxOS User A/c won't start from the HDD and reports kstartupconfig is missing - however the Root account still functions.
The only way you can 'reclaim' any of the drive for XP is to reformat the whole drive and restructure your partitions because hda3 is the extended partition that only encompasses partitions hda4-7. You don't use hda3 the way you use hda2,4,5,7. It just allows you to have more partitions than if you used only 'primary' partitions.
It seems to me that you could just reinstall XP to hda2, where is already is, without touching anything else. I would suggest using NTFS for XP since there is good support for accessing that now too. Why would you want to move your linux installation?
I've decided to have a complete fresh installation of both XP and Linux. Not the easiest or quickest but perhaps the safest. I can then install both OS's where I want them and tidy them up.
All the problems were caused by XP and not Linux. I've learnt my lesson about keeping them both well apart so I can recover XP without destroying my very stable Linux installation in future.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.