How to rename a partition - Linux

This is a discussion on How to rename a partition - Linux ; I deleted a partition /dev/hda1 using fdisk and modified my fstab and lilo so that next time /dev/hda2 becomes /dev/hda1 (so I thought). In fact, after reboot /dev/hda2 didn't change to hda1 (as I expected) so my question would be ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: How to rename a partition

  1. How to rename a partition

    I deleted a partition /dev/hda1 using fdisk and modified my fstab and
    lilo so that next time /dev/hda2 becomes /dev/hda1 (so I thought). In
    fact, after reboot /dev/hda2 didn't change to hda1 (as I expected) so
    my question would be how can I rename /dev/hda2 to /dev/hda1. If it's
    difficult I guess I can live with partitions starting with /dev/hda2
    but stlll I'd like to understand why renaming is difficult and how to
    reuse /dev/hda1.

    Thank you,
    Andrew

  2. Re: How to rename a partition

    You can have only four primary partitions, that's a given. But the names of partitions 1-4 depend on which slot they occupy in the partition table. Deleting a primary partition just writes zeroes in that slot. The partition table does not require the partitions to be in ascending order, but that's the order most systems create it in. Everything will keep working, if you just point things appropriately. If it's just a thing of convenience I do have one idea, but it would require backing up before attempting, as it's a risky process. Backup each partition you currently have individually.

    Delete the partition table and then create a partition for each you had previously. The size doesn't matter really. Assuming a simple partition table set up you can restore the backed up partition containing your operating system to the first if you like, or a boot partition. A note: Make sure to give enough size to restore the partition. You can resize as you like later, because here we're just getting things in order. Next restore the other partitions to the new ones.
    An example in my set up:
    first drive: sda1:/boot sda2:/ sdb:/home sdc:swap
    The first drive has two primary partitions on a 20gig sata drive, those are /boot and /.
    The second drive is a raided set of two 300gig sata drives set to /home
    the third drive is a small 10gig drive for my swap.
    The reason I use a second drive for my home is because I boot multiple operating systems and have it set up to have that as a universal /home. And the swap on the third drive is for performance and the same as the second drive, for use between operating systems.
    I hope this helps out.

+ Reply to Thread