Help - Search - Members - Calendar
Full Version: Partitioning HD [solved]
MandrivaUsers.org > Advanced Topics > Other Linux and Unix Distributions
mystified
I don't have enough space on / in Debian so I wanted to create a new /usr partition from /home. I booted into Mandriva One, went to mcc and disk partitioning. Clicked on /home, unmounted it and then clicked on resize and it told me that partition was not resizable. Any ideas?
pmpatrick
You can try PartedMagic, a specialized livecd featuring a nice graphical partitioning tool, gparted:

http://partedmagic.com/

It may not work either, but at least it's a small download.
ianw1974
The easier way to resize it is boot in single mode and then do it from the command line. What filesystem type is it? ext3? reiserfs? etc, etc?

I just deleted home and resized /var to use the space /home was using on an install I had. For you however, it's easy, since you just need to change /home mountpoint to /usr instead. Do this:

1. Tar the contents of /home like this:

CODE
tar cvjpf home.tar.bz2


those parametes will make a bzip2 file and will keep the permissions on all files for when you extract them again. It's important for any user accounts you have on your system.

2. Make a directory called /usr2 and unmount /home and mount it to /usr2 removing the contents of /home since you don't need anymore. Copy the contents of /usr to /usr2 like this:

CODE
cp -dpRx /usr/* /usr2/


again, this will keep permissions on all files. Now, edit /etc/fstab and create entry for /usr. Unmount /usr2. Remove the existing contents /usr and reboot your system. Untar the home.tar.bz2 to /home. All this will have to be done from rescue cd or similar.

Alternatively, if you need to keep /home, then I suggest you use the command line resize tools, but it's not as easy as you think since you then have to use fdisk to delete, and then recreate the partition smaller than it was, but big enough to accommodate what data is already there. Also, perhaps parted will do what you need, but again rescue or single user mode to do this.

And remember, backup your data in case it goes wrong.
mystified
Well I took pmpatrick's advise and I found out why I can't resize /home. It's showing that it's full and it's a 20GB partition with maybe 1 GB being used. Any ideas on how to fix this? I really don't want to delete /home. I just want to resize it.
ianw1974
What filesystem is it? ext3? reiserfs? etc, etc? You failed to mention, so I cannot tell you how to do it unless I know which one it is wink.gif biggrin.gif
pmpatrick
I assume that when you boot up your Debian system, your /home partition shows only 1GB being used. Double check that by running:

$ df -h

Compare that with the output you get when you run that command from within one of your livecds.
mystified
It's reiserfs. And when ever I run df -h it shows me the partition is full.
ianw1974
How do you know it's only using 1GB of space then, if df shows it's full? unsure.gif

I'd be considering looking at archiving whatever stuff you've got there, or deleting what you don't need to reclaim some space. I'm kind of having a hard time trying to understand how 1GB is equating to 20GB though. Unless something was being misreported somewhere.

What you can do, is this:

CODE
cd /home
du -sh `ls`


will give you summary listing by directory. If only one user, go into the user directory itself, and rerun the same command again so you can find out where all the space is going.
mystified
I found out what's happening and I can't figure out why. My /home is reporting as only 283 MB when I know the partition was over 20 GBs. I'm going to back up everything on a CD. Delete the partition and create a /usr and a /home. Do I have to copy everything over from my old /usr directory to the new partition?
ianw1974
Yup, since /usr will be in the / partition as it stands now. /usr holds all your programs, binaries, everything. So you definitely need to copy it over and empty the original /usr directory before mounting the new /usr.
ianw1974
/dev/hda7 was home of 20gb. It was deleted. /dev/hda7 became 10gb for /usr, /dev/hda8 became 10gb for /home.

Copied /usr to new partition.
Recreated /home/username directory from cd backup of user.
Cleared old /usr directory ready for new partition to mount here.
chown new user directory.
Edited /etc/fstab to mount new mount points.

Quick summary of how we increased space on /.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.