1 (edited by enortham 2007-06-20 19:38:07)

Topic: [SOLVED] Help Copying a Linux Partition

I have one hard disk laid out as follows:

/dev/sda1 ntfs 73.73 GiB
unallocated   25.41 GiB
/dev/sda2 linux-swap 1.90 GiB
/dev/sda3 ext3 10.75

and would like  to change it to

/dev/sda1 ntfs 73.73 GiB
/copy-of-sda3 ext3 25.41 GiB
/dev/sda2 linux-swap 1.90 GiB
/dev/sda3 ext3 10.75 GiB (Delete after verifying copy)

If I copy /dev/sda3 do I have to manually update the boot loader to point to it's new location? If so, can you recommend any sites that cover the process? Is there anything else I need to watch out for?

Thanks,

Eric

2

Re: [SOLVED] Help Copying a Linux Partition

enortham wrote:

If I copy /dev/sda3 do I have to manually update the boot loader to point to it's new location? If so, can you recommend any sites that cover the process? Is there anything else I need to watch out for?

Thanks,

Eric

It depends on your system !
If your system uses label to boot, when copying sda3 to unallocated place you will get two partitions with the same label, which is really bad. SO you will need to delete the original sda3. But you won't need to update your bootloader.
If your system boots with partition number, I guess you will have to update your bootloader config file, yes !

Larry
GParted-project Admin
Former GParted-LiveCD maintainer (2007)

3

Re: [SOLVED] Help Copying a Linux Partition

I'm running Ubuntu with grub and I think grub uses partition numbers.

Regarding the labels, if I copy one partition to the same disk it will copy the label also. So if I do the copy and don't want to blow away my old partition yet can I just relabel the old partition?

4

Re: [SOLVED] Help Copying a Linux Partition

enortham wrote:

So if I do the copy and don't want to blow away my old partition yet can I just relabel the old partition?

Yes :
# e2label /dev/sdX new_label
will set new_label to the /dev/sdX partition

Larry
GParted-project Admin
Former GParted-LiveCD maintainer (2007)

5 (edited by enortham 2007-06-20 19:37:21)

Re: [SOLVED] Help Copying a Linux Partition

gparted renames the new partition automatically. In my case the new partition was automatically named /dev/sda4. Regardless I ran e2label to try and change the labels so that the new would be sda3 and the old sda4. e2label exited successfully but didn't change the label names.

After that I just changed the boot loader line for the partition from

root            (hd0,2)

to

root            (hd0,3)

and everything started up and appears to be working properly.

6

Re: [SOLVED] Help Copying a Linux Partition

label name is not partition number !
e.g. :

Disk /dev/sde: 6007 MB, 6007356928 bytes
255 heads, 63 sectors/track, 730 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sde2   *           1         730     5863693+   b  W95 FAT32
[root@ws043 ~]# e2label /dev/sde2
SITES
[root@ws043 ~]#

Larry
GParted-project Admin
Former GParted-LiveCD maintainer (2007)

7 (edited by enortham 2007-06-20 20:17:22)

Re: [SOLVED] Help Copying a Linux Partition

Sorry I don't think I was clear on that last response although let me just make sure I understood correctly. I assumed the labels were /dev/sda3 and /dev/sda4. I ran e2label /dev/sda3 /dev/sda5 and then checked parted and nothing changed. It seems that grub and ubuntu only care about the numbers and not the labels.

8

Re: [SOLVED] Help Copying a Linux Partition

enortham wrote:

I assumed the labels were /dev/sda3 and /dev/sda4

No : label is label and number is number smile
/dev/sdX is a partition number
/ or /boot, or /home, /larryt are labels.
Well, e2label only works with ext file system, it is diffrent for fat, ntfs, swap, and ... others fs.

Larry
GParted-project Admin
Former GParted-LiveCD maintainer (2007)