Resize ext3 Partition
Jeff Vian
jvian10 at charter.net
Sun Jan 23 06:58:07 UTC 2005
On Sun, 2005-01-23 at 00:31 -0600, Jeff Vian wrote:
> On Sat, 2005-01-22 at 21:23 -0800, Shane Archer wrote:
> > At 05:04 PM 1/22/2005, you wrote:
> >
> > >If / is that large, what subdirectory is the biggest? Is /home or /opt
> > >in / and not on a separate partition? I would guess you have a LOT of
> > >downloaded stuff there that is bloating / unreasonably large.
> > >
> > >You can easily do a backup of the bulk of the stuff there to get it out
> > >of the way. Maybe put it off onto CDs to recover the space. Then after
> > >reducing the space required, the actual OS part of / should be about 3 -
> > >5 GB instead of the current 38GB. That could be moved to a new
> > >partition in its entirety and by making a small change in grub.conf and
> > >fstab you could boot to the new partiton for your system.
> > >
> > >Once the old / partition is not in use you would be free to do whatever
> > >was needed to resize it.
> >
> > This sounds like the most viable option yet, although I am not familiar
> > with the changes I'd have to make to fstab and grub.conf.
> >
>
> If you do not relocate / you would not need to modify grub.conf. I
> would rather relocate /home than try and relocate / if I were doing it.
>
> > Suppose that I just want to move something like /home or /var to another
> > partition. What changes would I need to make to fstab to make it happen?
> >
>
> 1. create the new partition and format
> 2. mount the new filesystem somewhere. (mount /dev/hdXY /mnt)
> 3. copy all the files from old to new
> cd /home
> cp -a <username> /mnt
>
> Now it gets tricky, because once the filesystem is mounted you cannot
> remove the old files from /home
>
> 4. logout, and log back in as root (you need to not have any files in
> the /home being used)
> 5. edit /etc/fstab and create a line to mount the new filesystem at the
> chosen location
> (/dev/hdXY /home ext3 defaults 1 2) or equivalent.
> 6. delete all the files in the original /home (rm -rf /home/username
> 7. mount the mew /home
> mount -a
I noticed that I failed to unmount /mnt before mounting /home. So do
"umount /mnt" before doing step 7
> 8. verify it mounted properly
> mount
> 9. logout and log back in as your regular user and you are done.
>
> Note that if you have more than one user in /home, the cp command in
> step 3 and the rm command in step 6 will be required for each user.
>
> Also note that it will be a good idea to use the du command to confirm
> what size partition is required before you create it. (du -s /home)
>
>
>
> > The main reason for all of this is because I'd like to copy a 6.5GB
> > database from one of my web servers (hosted elsewhere) to my local machine
> > for testing, and I need to create space for it. If I could just move /var
> > to another partition, that would solve my problem (and hopefully I'd learn
> > more in the process).
> >
>
> Although moving /var would work, it is a system part of the tree and is
> usually much smaller than /home. It also would be tricky to move
> without breaking the system (moving is similar to the example above
> for /home, but it would require booting to rescue mode to do the part
> involving deleting of the old files and getting the new /var mounted)
>
> To see which part of the tree would give you the best benefit and the
> space requirements, a simple "du -s /*" will give you an output that
> will tell you which parts of the tree are heavy and which are not. On
> mine, /home has at least 4 times the space requirements of any other
> branch (in fact it is that much larger than all other branches
> combined). My default install I use (except for /home) fits easily
> within a 10GB partition and has lots of room to grow. For your 6+ GB
> database you may need up to 15 or 20GB to allow extra room but not
> likely more.
>
> I would suspect you will see similar results in space requirements and
> there are advantages to having /home in it's own partition. Mostly, if
> a new install is required, /home does not need to be formated and thus
> your customized data and directory structure does not get wiped out.
>
>
>
> > Thanks,
> >
> > Shane
> >
>
More information about the fedora-list
mailing list