Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
fdisk usage on already partitioned drive
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
Jim 232777
n00b
n00b


Joined: 18 Mar 2005
Posts: 40

PostPosted: Sun Jan 29, 2006 3:32 am    Post subject: fdisk usage on already partitioned drive Reply with quote

I don't use fdisk very often, so I'm looking for a "warm fuzzy" about what I need to do. Someone please confirm the following:

Simply put, I can run fdisk to adjust partitioning on a harddrive, and the partitions I don't touch will still have all their data on them.



Comments, other than backup cautions? ;-)

thanks.
_________________
Jim Passmore
Registered Linux User #232777
Back to top
View user's profile Send private message
dmpogo
Advocate
Advocate


Joined: 02 Sep 2004
Posts: 3468
Location: Canada

PostPosted: Sun Jan 29, 2006 4:38 am    Post subject: Re: fdisk usage on already partitioned drive Reply with quote

Jim 232777 wrote:
I don't use fdisk very often, so I'm looking for a "warm fuzzy" about what I need to do. Someone please confirm the following:

Simply put, I can run fdisk to adjust partitioning on a harddrive, and the partitions I don't touch will still have all their data on them.



Comments, other than backup cautions? ;-)

thanks.



Not as easy, in many cases you will destroy the data. In particular, you cannot safely delete any partitions which are part of the extended partition except the last. Also moving where the partition starts with fdisk will probably destroy the data on it.
Plus, you cannot resize partition to the size less than the size of the filesystem on it, without destroying the file system.
And so on.

So it requires a bit of logistitics to readjust existing partitioning, and it includes resizing filesystems first, and perhaps
teporarily copying whole filesystems from one place to another.
Back to top
View user's profile Send private message
Jim 232777
n00b
n00b


Joined: 18 Mar 2005
Posts: 40

PostPosted: Sun Jan 29, 2006 4:50 am    Post subject: Reply with quote

Ahh-I figured there might be some aspects of the issue I wasn't aware of.

Actually, I have an unused portion at the end of the disk that was never assigned when I first set up the system. I couldn't decide how I wanted to assign/format it at the time, and was thinking I could do it later (that would be now).

Is it pretty safe just to go back to fdisk and add the rest of the disk in a new partition?
_________________
Jim Passmore
Registered Linux User #232777
Back to top
View user's profile Send private message
dmpogo
Advocate
Advocate


Joined: 02 Sep 2004
Posts: 3468
Location: Canada

PostPosted: Sun Jan 29, 2006 5:00 am    Post subject: Reply with quote

Jim 232777 wrote:
Ahh-I figured there might be some aspects of the issue I wasn't aware of.

Actually, I have an unused portion at the end of the disk that was never assigned when I first set up the system. I couldn't decide how I wanted to assign/format it at the time, and was thinking I could do it later (that would be now).

Is it pretty safe just to go back to fdisk and add the rest of the disk in a new partition?


Yes, this is fine

Mostly you should avoiid two things

a) Moving the beginnings of the existing partitions. Moving end point is fine, except as in b)

b) Shrinking partitiion to be less than the filesystem on it

This operations will destroy the filesystem on the partition.
If you need to shrink partition, you should fisrt shrink filesystem (a bit smaller size than you need your new partition size be
for safety), then shrink partition to the desired size, then grow file system back to fill all the partition.

If you increase partition size (moving end point, assuming there is the space, i.e no partition starting right next),
you should then grow the filesystem to fill the partition.

Also, you cannot make anything on mounted partition. You should unmount it first. Which makes resising
root partition quite a logistical nightmare (you need to make a copy of the root, chroot there, unmount olf root, etc)
Back to top
View user's profile Send private message
Jim 232777
n00b
n00b


Joined: 18 Mar 2005
Posts: 40

PostPosted: Sun Jan 29, 2006 5:12 am    Post subject: Reply with quote

OK. That's good to hear.

I'm not planning on resizing any partitions, but I am curious--what commands are used to grow and shrink the file systems?

thanks!
_________________
Jim Passmore
Registered Linux User #232777
Back to top
View user's profile Send private message
dmpogo
Advocate
Advocate


Joined: 02 Sep 2004
Posts: 3468
Location: Canada

PostPosted: Sun Jan 29, 2006 5:29 am    Post subject: Reply with quote

Jim 232777 wrote:
OK. That's good to hear.

I'm not planning on resizing any partitions, but I am curious--what commands are used to grow and shrink the file systems?

thanks!


These commands are specific to filesystem type and come with utilities for that filesystem.
For example for ext2/ext3 it is /sbin/resize2fs which is part of sys-fs/e2fsprogs. For Reiser is it
/sbin/resize_reiserfs , part of sys-fs/reiserfsprogs

etc.

You can also look at 'parted' which is more capable than fdisk for work on existing partitions.
But I, somehow, trust it less, since I feel better low-llevel operations of fdisk
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware 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