fixunix
Tags Register FAQ Members List Social Groups Calendar Search Today's Posts Mark Forums Read

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 ...


Fix Unix > Linux > How to rename a partition

Reply
 
LinkBack Tools
  #1  
Old 11-18-2007, 11:39 PM
Junior Member
 
Join Date: Sep 2009
Posts: 0
Default 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
Reply With Quote
  #2  
Old 09-13-2009, 05:32 PM
Junior Member
 
Join Date: Sep 2009
Posts: 1
Default 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 With Quote
Reply

Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
[PATCH] block: restore original behavior of /proc/partition when there's no partition unix Kernel 1 09-01-2008 07:00 AM
reformat or rename hard disk partition unix Redhat 5 10-07-2007 08:35 AM
[Solution] Resize linux partition with partition magic corrupts GRUB unix Help 0 09-30-2007 02:49 PM
How can i rename a partition with veritas V9 unix Veritas Backup Exec 0 08-20-2003 01:07 PM
Can't rename partition in autoloader unix Veritas Backup Exec 0 06-05-2003 09:19 PM


All times are GMT. The time now is 08:26 AM.