Jump to content

Moving partitions


Recommended Posts

Ok, so I wanna move my windoze partitions off onto a different hard drive. Here's my current drive setup, as it appears in diskdrake:

 

hda:

| Win98 | WinXP | Win Share | / | /home | swap |

 

hdb:

| unused NTFS | /Backup |

 

So here's what I wanna do. Take hdb, install windows on that. But then I need to expand my / and /home partitions once I remove the three windows partitions. The windoze partitions are a total of 100GB, my / is about 40GB, and my /home is around 60GB. So I was wondering, is there any way I could delete the win partitions and then copy the / to near the front, so I'd have something like this:

 

| copy of / | unused | / | /home |

 

And then run the installer again and set it to use the copy of / as / and not to format, then delete the original /, copy the /home up, and run the installer again, giving me something like this:

 

| / | unused | /home | unused |

 

And then simply resize them. Hope you can understand what I'm saying...but basically I wanna resize them, and since they're at the end and you can't change where a partition starts (right?), I wanna move them up so I can then resize them to what I want. How hard would this be? Could I just use diskdrake to create the new partitions, and then dd to copy everything over? Would dd work when the partition is currently mounted, or would I have to use a live CD or something? And most importantly...is there any easier way to do what I want?

Link to comment
Share on other sites

ehh...I really don't wanna download anything else. Besides, I'm using up enough discs with my backups :)

Would my dd method at least work? (Even if it is slightly retarded...lol)

Link to comment
Share on other sites

a note of warning, when deleting/adding partition you can

end up changeing their number, hda6 becomes hda5.

Have the rescue mode ready to change /etc/fstab

and /boot/grub/menu.lst

 

As far as dd is concerned there are tutorials.

You can slot and move partition this way if you have enough room

There is a resizefs function in linux, but this is only once you have

dd something into a partition of different size from the source

It is all risky still

 

my experience is that drakdisk is too clever for its sake

and can confuse cfdisk.

I agree a live distro may be easier

 

PS: dd works from the rescue console mode of the install cd/dvd of mandy

Link to comment
Share on other sites

I had a similar issue in the past, I needed to expand my root partition for lack of space, so I took the oportunity and switched to a bigger hard disk, and then moved the entire system there. What I did was first create the partitions on the new disk, then boot from a live cd (I used mandrake move) and copy the content to their corresponding partitions, modify lilo.conf and fstab according to the changes and finally install lilo to the new hard disk.

Link to comment
Share on other sites

ahh...see, I was just gonna run the installer again to re-create lilo.conf and fstab. Your way would be a lot quicker though, huh? :P

 

Yea...I been using this thing for...year and a half now I think...and I still don't know what I'm doing. haha

Link to comment
Share on other sites

Woo! Got the root partition moved up, after much pain. Used mandriva move to copy it back with dd, then ended up just running the installer again, changing the mount points, and telling it to not format. I tried just changing fstab and the grub config, but it didn't work...dunno why, I'm not too familiar with how those files work, so...doesn't surprise me any that I screwed it up. But anways, now I just gotta move my /home up a bit, and that shouldn't be too hard.

Link to comment
Share on other sites

sorry to hear it did not as well as you planned

tried just changing fstab and the grub config, but it didn't work...dunno why

Maybe if you post them and explain what you did somebody

can help you to learn how to do it.

I did say it was risky. But it is an opportunity to learn by trial and error.

I really that the main way to learn about moving partition with dd

Link to comment
Share on other sites

I never used dd to move partitions, might have to look into that alternative. Resizing is easy enough, but you just have to know about not moving the start of the partition, else you lose everything.

Link to comment
Share on other sites

>>might have to look into that alternative

I do not know any other way when you want to shuffles

partitions especially if the start of the partition needs moving.

 

There is an excellent thread somewhere called "Learn the dd command"

 

It gets quite interesting when you dd from one partition into another of different size (be it smaller or bigger)

Link to comment
Share on other sites

When I've moved, of course, had to make sure I had enough space, and was basically just using the cp -R command to ensure I got everything out of the old partition into the new one.

 

I had problems trying to get ext3 partitions resized because of the journaling having to be turned off first, and so I've always used reiserfs since, because it just works for resizing and such. Oh, and fdisk for resizing the partition after the file system had been resized.

Link to comment
Share on other sites

I had problems trying to get ext3 partitions resized because of the journaling having to be turned off first

I do not think this would happen with dd and ext3, but do not quote me on this. From small partition into a bigger

partitions being unmounted

dd if=/dev/hd_input of=/dev/hd_output +options

then

resize2fs /dev/hd_output takes care of resizing the file system

(not the partition) including the journal. AFAIK it looks at the inodes etc.

cannot be any problem with the journal, should be clean before dd,

and then it is cloned

Link to comment
Share on other sites

For me, resize2fs complained it was ext3, and the howto's said that you had to change an option to bring it down to ext2. Then resize2fs was complaining because of something else, so in the end I just gave up on that method. I had enough disk space on the drive, that I just created a new partition and then just copied the data across. Then changed the mount points to the new partition, and rebooted to make sure all was OK and then deleted the old one.

 

With reiserfs I didn't have to do anything like what was expect with ext3 by turning off journaling. I just resized. I only use ext3 when I use Red Hat on my systems, since they don't have anything else available other than ext2 by default.

Link to comment
Share on other sites

Um...my original partition was 40GB. I opened diskdrake, created a new 53GB partition (both are ext3), and then used mandriva move and ran 'dd if=/dev/hda5 of=/dev/hda1', and then ran the installer again, telling it to use hda1 as the root partition and not to format. That's it. From what you're saying...it sounds like that shouldn't have worked? haha

 

It gets quite interesting when you dd from one partition into another of different size (be it smaller or bigger)

...didn't for me... :unsure:

 

And I never used resize2fs. I mean, that's probably what diskdrake does, but...didn't have any problems with it.

 

I'm a bit confused about how editing the grub and fstab files would work. I mean, it seems to me that if it's set to boot from hda5, how would editing the files on hda5 make it then start booting from hda1? I did notice in the lilo config (I was using lilo until about halfway through this when I realized I should try grub because lilo always gets screwed up and won't reinstall) that it says to run the command 'lilo' after you edit it...but when I tried that it just sat there for about a half hour and didn't seem to do anything until I finally killed it. I'm guessing that's probably my problem? I'll have to try to get it running right when I move my home partition...

Link to comment
Share on other sites

dd'ing from one partition to another of difference size is not a good idea - you could end up with missing space. This will happen if the original is smaller - if the original is bigger, i have no f'in clue what'd it do - but it wouldn't be good. you should double check the size of your new partition after the dd. i bet it's smaller than you made it. the dd will still succeed, and the data will be there, and everything will appear to work fine, but if the original was smaller than the new partition you'll be missing space. My bet is the new partition now appears to be 40GB instead of the 53GB you made for it.

 

why? because dd does a direct disk copy - partition information and all. it doesn't just copy the files, it copies all the information related to that partition.

 

if you want to just copy files, you should be using good ol' cp with the proper switches.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...