You are not logged in.

#1 2008-10-25 21:18:43

icetonic
Member
From: Germany
Registered: 2008-10-21
Posts: 104

[SOLVED] How to change partition device node name?

I changed partitions in the past a lot and I don't know why but my very  first partition is recognized as /dev/sda3 instead of /dev/sda1.. That is really annoying.. Is there a way to change the partition from sda3 to sda1 ?

Last edited by icetonic (2008-10-29 19:32:49)

Offline

#2 2008-10-25 21:57:04

ChoK
Member
From: France
Registered: 2008-10-01
Posts: 346

Re: [SOLVED] How to change partition device node name?

you can use fdisk
don't forget to use it on a unmounted device


Ah, good taste! What a dreadful thing! Taste is the enemy of creativeness.
Picasso
Perfection is reached, not when there is no longer anything to add, but when there is no longer anything to take away.
Saint Exupéry

Offline

#3 2008-10-26 18:42:36

icetonic
Member
From: Germany
Registered: 2008-10-21
Posts: 104

Re: [SOLVED] How to change partition device node name?

Thank you for your answer.
I looked at all possible fdisk options but didn't know what to do... Partitioning is a serious thing, so I don't want to break anything... Could you tell me how exactly to do this?

Offline

#4 2008-10-26 18:57:44

Onwards
Member
From: Pakistan
Registered: 2007-04-18
Posts: 108

Re: [SOLVED] How to change partition device node name?

AFAIK, one can't rename sda3(3rd primary partition) to sda1(1st primary partition) using fidsk, w/o deleting them first (means this process isn't non-destructive). There is an option to 'fix the disk order' though in 'extra functionality menu'. You may try fiddling with sfdisk, but that's pretty scary stuff neutral

Last edited by Onwards (2008-10-26 18:58:19)

Offline

#5 2008-10-26 19:18:07

icetonic
Member
From: Germany
Registered: 2008-10-21
Posts: 104

Re: [SOLVED] How to change partition device node name?

Re-creating the partition is impossible for me... Where to move my 150 GB of data? I have no other hard drive and that partition is taking 3/4 of the space of that one...

fdisk said that everything is fine when I tried to "fix the disk order" and doing hardcore experiments with my partition table on my own not knowing what I'm doing is too hard and a too high risk for me... Thats why I ask if someone knows how to do it smile

Here is the entry for the partition in normal mode:

/dev/sda3               1       33218   266823553+   7  HPFS/NTFS

Here in expert mode:

 1 00   0   0    0   0   0    0          0          0 00
 2 00   0   0    0   0   0    0          0          0 00
 3 00   1   1    0 254  63 1023         63  533647107 07

Is it normal that I have 2 empty first lines and that my sda3 begins at 63 (while the other view says that it begins at 1)  ?

Here my sudo sfdisk -l:

Festplatte /dev/sda: 38913 Zylinder, 255 Köpfe, 63 Sektoren/Spur
Einheit = Zylinder von 8225280 Bytes, Blöcke von 1024 Bytes, Zählung beginnt bei 0

   Gerät  boot. Anfang   Ende  #Zyl.    #Blöcke   Id  System
/dev/sda1          0       -       0          0    0  Leer
/dev/sda2          0       -       0          0    0  Leer
/dev/sda3          0+  33217   33218- 266823553+   7  HPFS/NTFS
/dev/sda4      33218   38912    5695   45745087+   5  Erweiterte
                Ende: (c,h,s) erwartet (1023,254,63) gefunden (1022,254,63)
/dev/sda5      33218+  33705     488-   3919828+  82  Linux Swap / Solaris
/dev/sda6      33706+  36301    2596-  20852338+  83  Linux
/dev/sda7      36302+  37607    1306-  10490413+  83  Linux
/dev/sda8      37608+  38912    1305-  10482381   83  Linux

Sorry that its German, well I think it's understandable and Leer means Empty ;-)

Last edited by icetonic (2008-10-26 19:26:12)

Offline

#6 2008-10-27 17:13:18

ChoK
Member
From: France
Registered: 2008-10-01
Posts: 346

Re: [SOLVED] How to change partition device node name?

You should use sectors as unit, it's the actually written place on the disk.
note where your partition begins and where it ends.

It shouldn't go wrong if you follow those steps (write the partitions only if the disk is unmounted)

sudo fdisk /dev/sda
p     //print the partition table
u    //switch to sector
p   //reprint the new partition table


Now for the fun
Note where a partition begins and end in sectors

delete all partitions using the "d" command
and recreate them with the correct beginning and end.

NOW make sure it is unmounted
w   //write the new partition table and quit

If you don't use UUID in your /etc/fstab modify the reference accordingly



Some info about the partitions (not relevant to your problem, you don't have to repartition) wrote:

There is atleast 64 sectors free between logic partitions, primary ones are contiguous.
the table of =the partition is ust a description of the disk layout,
you can reboot with everything read-only to see if it works, if it don't you can modify your partition table again

You can have a partition bigger than your filesystem, (you can hot-resize with resize2fs)
having a filesystem bigger than your partition is a bad idea ( I messed up my partition table when installing Arch xD well)

Do you think it's worth a wiki entry?

Last edited by ChoK (2008-10-27 20:08:26)


Ah, good taste! What a dreadful thing! Taste is the enemy of creativeness.
Picasso
Perfection is reached, not when there is no longer anything to add, but when there is no longer anything to take away.
Saint Exupéry

Offline

#7 2008-10-27 17:43:51

icetonic
Member
From: Germany
Registered: 2008-10-21
Posts: 104

Re: [SOLVED] How to change partition device node name?

Hey... thank you very much for the detailed guide... I tried it before you edited it - unfortunately it doesn't work... when I wanted to delete the 1st partition fdisk gave a warning that partition 1 is kinda empty (what's true) and didn't do anything...

Now, I don't really understand your updated version: What start and end points to use when recreating?
I mean - when I note the start and end sectors, when recreating - should I simply subtract 63 from each? (or does the count begin with 1 so then subtract 62?) or what to do? And wouldn't my filesystems break anyway, because they are laying then not inside the partition borders? I mean

|--------|--------------------|-- <- (new) Partitions
--|--------|--------------------| <- Filesystems

And wouldn't it be enough if I'd delete just my sda3 and create it so that it is recognized as the first one? Wouldn't be the other partition numbers be adjusted automatically?

A wiki entry would be great - but first I ask you to make it more clear to me and I think when I finally will understand it, all the people using the wiki will as well smile

Last edited by icetonic (2008-10-27 18:01:27)

Offline

#8 2008-10-27 18:32:31

Mektub
Member
From: Lisbon /Portugal
Registered: 2008-01-02
Posts: 647

Re: [SOLVED] How to change partition device node name?

Perhaps ypu could use a 'gparted' from a LiveCD or use the gparted livecd itself:

http://gparted.sourceforge.net/livecd.php

Booting from CD your disk is quiet and I see no reason not to be alble to delete the first 2 partitions.

I dont remember if gparted reorders your partition names, but thats easy: boot, call fdisk and use the commands:

x (extra functionality)
f (fix partition order)

Mektub


Follow me on twitter: https://twitter.com/johnbina

Offline

#9 2008-10-27 18:40:21

icetonic
Member
From: Germany
Registered: 2008-10-21
Posts: 104

Re: [SOLVED] How to change partition device node name?

GParted from Ubuntu LiveCD was the first thing I tried before posting big_smile

And tell me please - how to delete partitions that don't really exist? I think it's, as ChoK says, a matter of the right start/end sector. There is no 1 or 2 partition. And no program showed me something before sda3. And that is my problem. That it IS sda3 and not sda1...

Offline

#10 2008-10-27 20:27:42

ChoK
Member
From: France
Registered: 2008-10-01
Posts: 346

Re: [SOLVED] How to change partition device node name?

Okay I edited the post, sorry about confusing you

A table of partition just describe the way data on a disk will be separated
deleting a partition in it just means that the data will, for the disk, not exist anymore (though physically it will still be here)

As your data doesn't exist at all it's ok to delete this partition
just

follow the steps on my precedent post

sudo fdisk /dev/sda will give you an fdisk interface
note the beginning and end sector of each partition
the d command will prompt you "which partition would you like to delete"
do it for every partition

now rebuild the partition table in the correct order using the "n" command
it will ask you the beginning and end sector for each partition, just copy the same numbers

the changes actually happen only when you do the "w" (write) command so don't fear trying to see what everything does
make sure that your /dev/sda is not mounted and write when everything is okay
change your fstab, i suggest adding the options ro (read-only) for the first time reboot

reboot everything should work

about the data, changing the partition table doesn't affect them at all
It's the filesystem that holds the data, only way for it to get corrupted is having a file system bigger than the partition and write something in it. You are not resizing the partition so it's okay

from wikipedia wrote:

Partition recovery

When a partition is deleted, in general, only its partition table entry is removed from a table; and although the data is no longer accessible, it still remains on the disk until being overwritten. Specialized recovery utilities, (such as TestDisk and gpart), can locate lost file systems and recreate a partition table which includes entries for these recovered file systems. However, some disk utilities may also overwrite a number of beginning sectors of a partition they delete. For example, if Windows Disk Management (Windows 2000/XP, etc.) is used to delete a partition, it will overwrite the first sector (relative sector 0) of the partition before removing it. It may be possible to restore a FAT32 or NTFS partition if a backup boot sector is available.

About parted, i didn't try gparted but parted and qparted doesn't support some attributes like resize_inode and some ext_attr
even for just a partition renaming ....

edit : grammar ....

Last edited by ChoK (2008-10-27 20:32:41)


Ah, good taste! What a dreadful thing! Taste is the enemy of creativeness.
Picasso
Perfection is reached, not when there is no longer anything to add, but when there is no longer anything to take away.
Saint Exupéry

Offline

#11 2008-10-27 20:40:50

icetonic
Member
From: Germany
Registered: 2008-10-21
Posts: 104

Re: [SOLVED] How to change partition device node name?

ChoK wrote:

Okay I edited the post, sorry about confusing you
As your data doesn't exist at all it's ok to delete this partition
edit : grammar ....

What do you mean with this? I have a LOT of data big_smile

However, thank you, I'll try it today or tomorrow smile

Offline

#12 2008-10-27 20:52:01

ChoK
Member
From: France
Registered: 2008-10-01
Posts: 346

Re: [SOLVED] How to change partition device node name?

Lol, I was talking about /dev/sda1 and /dev/sda2 smile
I wonder how you ended up with that though, is it a laptop? is there some shadow manufacturer restore partition or something (it would be really twisted to see it this way oO)?


Ah, good taste! What a dreadful thing! Taste is the enemy of creativeness.
Picasso
Perfection is reached, not when there is no longer anything to add, but when there is no longer anything to take away.
Saint Exupéry

Offline

#13 2008-10-27 21:06:43

icetonic
Member
From: Germany
Registered: 2008-10-21
Posts: 104

Re: [SOLVED] How to change partition device node name?

Its not a laptop... And the only thing there was was a recovery partition for the preinstalled Vista....
I don't know myself why it was that way... I partitioned a lot... first with Paragon (I used it mainly because I thought that GParted can't manage NTFS), then (after it broke 0,1% of my inodes on my Ubuntu partition while moving) with GParted... I deleted windows, merged and split partitions, after deleting Ubuntu I changed a lot again... Maybe one of those programs did something strange...

But man - THANK YOU! It worked smile
I deleted just my data partition, but let the extended stay sda4 (because I like having the extended one at the end, and in the extended is all the linux stuff... I thought - linux likes when you have many partitions and in the extended there can be up to 16 and that way all linux system partitions (home is for me system as well^^) are kinda grouped... Today I learned something again (that partitions and file systems are completely independent... I always thought, that partitions are fixed containers for file systems... I didn't know that a file system can be smaller than a partition or such things... so thank you for this extra information  smile

However - It's time to make a wiki entry smile I never thought it would be so simple (I imagined everything much more complicated that is maybe why I didn't understand at first what you wanted me to do)

Btw - I never found a solution for this problem by googleing (or I just used wrong keywords although I tried a lot) - if you'd write a wiki page for it, it would be unique in the web smile

Last edited by icetonic (2008-10-27 21:16:06)

Offline

#14 2008-10-27 21:46:07

ChoK
Member
From: France
Registered: 2008-10-01
Posts: 346

Re: [SOLVED] How to change partition device node name?

I learn all about this when installing Arch.

I tried to resize the Kubuntu partition I had, but Qtparted and parted (didn't tried the gparted one) keep saying "your partition has attributes not supported" or something like that (it was partition created by ubuntu livecd Oo), I didn't want to mess up everything so I gathered a great deal of doc about the tools available.

End of story, I resize my partition messed up because fdisk displayed block size and tune2fs block size are different,
Luckily all my important data are on my external hard drive. Finally complete reinstall of Kubuntu and partitioning too.

On a whim I tried Archlinux and like it smile  and maybe live happily ever after.
edit : forgot to say that I was actually on the way to install gentoo, the distribution that I used before going in China, and buying a laptop there

Last edited by ChoK (2008-10-27 21:47:38)


Ah, good taste! What a dreadful thing! Taste is the enemy of creativeness.
Picasso
Perfection is reached, not when there is no longer anything to add, but when there is no longer anything to take away.
Saint Exupéry

Offline

#15 2008-10-27 21:56:08

icetonic
Member
From: Germany
Registered: 2008-10-21
Posts: 104

Re: [SOLVED] How to change partition device node name?

My installation process was rather simple... I had just to download my WLAN stick firmware... My first Arch installation was parallel to Ubuntu just to see what Arch is like and how to install it, then, after about a week, I decided to change completely... No real problems...

Ah, and maybe you even know how to convert my NTFS partition to ext3 without data loss?
(Ok ok, just kidding, I know the answer - "get another harddrive, move your data, delete your NTFS partition, create a new ext3 partition, move your data back...
But atm I don't have an extern HD...)
The only thing annoying in NTFS is, that it doesn't support unix rights and... its the last piece of "Software" from Redmond big_smile

Offline

#16 2008-10-27 22:10:30

ChoK
Member
From: France
Registered: 2008-10-01
Posts: 346

Re: [SOLVED] How to change partition device node name?

Yeah permission in NTFS .... you cannot run anything on windows without having admin privileges

In linux you can mount ntfs with the umask option to restrict the rights

Most annoying things about NTFS ?
"Failed to mount '/dev/xxxx: Operation not supported.
Access is denied because the NTFS journal file is unclean. Choices are:
A) Shutdown Windows properly.
B) Click the 'Safely Remove Hardware' icon in the Windows taskbar
    notification area before disconnecting the device.
C) Use 'Eject' from Windows Explorer to safely remove the device.
D) If you ran chkdsk previously then boot Windows again which will
    automatically initialize the journal.
E) Submit 'force' option (WARNING: This solution it not recommended).
F) ntfsmount: Mount the volume read-only by using the 'ro' mount option.
Mount failed.

(ntfs-3g throw the same kind of error but this one is very funny smile

Last edited by ChoK (2008-10-27 22:10:50)


Ah, good taste! What a dreadful thing! Taste is the enemy of creativeness.
Picasso
Perfection is reached, not when there is no longer anything to add, but when there is no longer anything to take away.
Saint Exupéry

Offline

#17 2008-10-28 13:13:26

icetonic
Member
From: Germany
Registered: 2008-10-21
Posts: 104

Re: [SOLVED] How to change partition device node name?

Not having windows I have nothing to deny access to my NTFS partition or using the journal big_smile

And I mean per-file right settings... Not the rights for mounting... I mean every even new script is executable and there is no need for chmod +x... So to say. all files are 777... Thats annoying but not a problem, I'm the only one who has access to my computer big_smile

However - NTFS on a (now) linux only PC is a little pointless...


And yeah - if you write a wiki entry - please post here the link - I want to link from my blog to it big_smile

Last edited by icetonic (2008-10-28 13:15:54)

Offline

Board footer

Powered by FluxBB