View previous topic :: View next topic |
Author |
Message |
holmis n00b


Joined: 16 Mar 2003 Posts: 72 Location: Sweden
|
Posted: Fri Apr 02, 2004 9:13 pm Post subject: Does cfdisk always destroy data? |
|
|
I am confused about the behavior of cfdisk:
I have two partitions on this hard drive (both 2GB, (/dev/hda1 and /dev/hda2 in Linux lang). Now I want to split the second partition into more partitions but without touching the first one (hda1).
Can this be done with cfdisk, or will cfdisk destroy the data on /dev/hda1 as well even if I don't touch it? |
|
Back to top |
|
 |
Earthwings Bodhisattva


Joined: 14 Apr 2003 Posts: 7753 Location: Germany
|
Posted: Fri Apr 02, 2004 9:24 pm Post subject: Re: Does cfdisk always destroy data? |
|
|
holmis wrote: | I am confused about the behavior of cfdisk:
I have two partitions on this hard drive (both 2GB, (/dev/hda1 and /dev/hda2 in Linux lang). Now I want to split the second partition into more partitions but without touching the first one (hda1).
Can this be done with cfdisk, or will cfdisk destroy the data on /dev/hda1 as well even if I don't touch it? |
(c)fdisk won't touch your data at all. It touches the partition table however so it's easy to loose all data on the entire disk if you're not able to recover a working partition table in case something is screwed up. Always make backups of important data before playing with fdisk and co.
Resizing partitions goes like this: Get a resizing tool that relocates the data, resize the partition. Sometimes you've got to adjust the partition table with (c)fdisk afterwards (delete partition, create new with *same starting adress* and the new size). If everything goes ok, you've got some new space you can create new partitions within. If something goes wrong, try to repair or use your backup. If you didn't do a backup, ...  |
|
Back to top |
|
 |
holmis n00b


Joined: 16 Mar 2003 Posts: 72 Location: Sweden
|
Posted: Fri Apr 02, 2004 9:32 pm Post subject: |
|
|
Ok, but I don't care about the second partition, so I would prefer to do this:
1). Delete /dev/hda2 partition.
2). Create some new partitions on the space that was left by the old /dev/hda2.
If I do this with cfdisk, will the data on /dev/hda1 be lost? |
|
Back to top |
|
 |
Earthwings Bodhisattva


Joined: 14 Apr 2003 Posts: 7753 Location: Germany
|
Posted: Fri Apr 02, 2004 9:41 pm Post subject: |
|
|
If you do it right, no. If you do it wrong, yes. Sorry for the useless answer, but it depends on you typing the right commands. The idea how to do it is alright of course. |
|
Back to top |
|
 |
holmis n00b


Joined: 16 Mar 2003 Posts: 72 Location: Sweden
|
Posted: Fri Apr 02, 2004 9:43 pm Post subject: |
|
|
(I'm on a phone line, so I'll disconnect now and have a look at this thread again tomorrow. Thanks for the reply Earthwings, I am still a bit confused though. I might try this tomorrow and report the result in case some other guy would like to know....) |
|
Back to top |
|
 |
revertex l33t


Joined: 23 Apr 2003 Posts: 806
|
Posted: Sat Apr 03, 2004 6:53 am Post subject: |
|
|
cfdisk is a pretty safe and stable program, you can delete your second partition without touch the first one then in the free space you can create a new partitions.
Format partitions will lose all data in partition to be formated, but if you delete a partition then recreate a partition in the same place your data will say there, without lose anything.  |
|
Back to top |
|
 |
Regor Guru


Joined: 06 Aug 2002 Posts: 545 Location: 39° 2' 48" N, 120° 59' 2" W
|
Posted: Sun Apr 04, 2004 5:35 am Post subject: |
|
|
To be safe, you should make a backup of your MBR first. That way if you do end up writing a messed up partition table, you can recover your existing one.
Code: | dd if=/dev/hda of=backup.mbr bs=512 count=1 | will make the backup. Put it someplace safe that's not on your hard drive. This is one of the few things floppies are still good for.
If you mess up and need to recover, then boot rescue media and restore with: Code: | dd if=backup.mbr of=/dev/hda | You'll have to adjust the path to the backup to whatever media it resides on. _________________ Sometimes the appropriate response to reality is to go insane.
-Philip K. Dick, Valis |
|
Back to top |
|
 |
holmis n00b


Joined: 16 Mar 2003 Posts: 72 Location: Sweden
|
Posted: Sun Apr 04, 2004 8:41 am Post subject: |
|
|
Yes, now I know it works. I tried with cfdisk and it didn't destroy any data on /dev/hda1 in my case (the one I didn't touch).
Backing up the MBR might be a good idea, yes. Will try that out next time. |
|
Back to top |
|
 |
revertex l33t


Joined: 23 Apr 2003 Posts: 806
|
Posted: Sun Apr 04, 2004 12:07 pm Post subject: |
|
|
Nice tip Regor!  |
|
Back to top |
|
 |
|