Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Does cfdisk always destroy data?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
holmis
n00b
n00b


Joined: 16 Mar 2003
Posts: 72
Location: Sweden

PostPosted: Fri Apr 02, 2004 9:13 pm    Post subject: Does cfdisk always destroy data? Reply with quote

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
View user's profile Send private message
Earthwings
Bodhisattva
Bodhisattva


Joined: 14 Apr 2003
Posts: 7753
Location: Germany

PostPosted: Fri Apr 02, 2004 9:24 pm    Post subject: Re: Does cfdisk always destroy data? Reply with quote

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, ... :x
Back to top
View user's profile Send private message
holmis
n00b
n00b


Joined: 16 Mar 2003
Posts: 72
Location: Sweden

PostPosted: Fri Apr 02, 2004 9:32 pm    Post subject: Reply with quote

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
View user's profile Send private message
Earthwings
Bodhisattva
Bodhisattva


Joined: 14 Apr 2003
Posts: 7753
Location: Germany

PostPosted: Fri Apr 02, 2004 9:41 pm    Post subject: Reply with quote

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
View user's profile Send private message
holmis
n00b
n00b


Joined: 16 Mar 2003
Posts: 72
Location: Sweden

PostPosted: Fri Apr 02, 2004 9:43 pm    Post subject: Reply with quote

(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
View user's profile Send private message
revertex
l33t
l33t


Joined: 23 Apr 2003
Posts: 806

PostPosted: Sat Apr 03, 2004 6:53 am    Post subject: Reply with quote

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. 8O
Back to top
View user's profile Send private message
Regor
Guru
Guru


Joined: 06 Aug 2002
Posts: 545
Location: 39° 2' 48" N, 120° 59' 2" W

PostPosted: Sun Apr 04, 2004 5:35 am    Post subject: Reply with quote

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
View user's profile Send private message
holmis
n00b
n00b


Joined: 16 Mar 2003
Posts: 72
Location: Sweden

PostPosted: Sun Apr 04, 2004 8:41 am    Post subject: Reply with quote

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
View user's profile Send private message
revertex
l33t
l33t


Joined: 23 Apr 2003
Posts: 806

PostPosted: Sun Apr 04, 2004 12:07 pm    Post subject: Reply with quote

Nice tip Regor! :wink:
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum