# XFS and dwindeling free space questions

## nepenthe

Here's the background info;

Installed gentoo dual boot only made 4 gig root partition for it. Now I have it setup and really dont need windows anymore but would still like to keep for few games cant get working with winex. Anyway my question is my root partition is XFS can XFS partitions be resiezed? And if not I can make another partition but how can I make use of it effectively?

Any help greatly appricated.

----------

## dreamer3

http://www.gnu.org/software/parted/parted.html

Parted is the only Linux tool I know... and it doesn't support the resizing of XFS paritions.

----------

## pilla

You can also make another partition and move one of your directories there (like /usr or /lib or /opt). You will get some extra space without many complications. Besides, I do not think you can resize a XFS partition.

----------

## nepenthe

Okay thanx that was what I was looking for, what I did before i posted though was I resized a windows partition and made another XFS and mounted it as /home just for mp3's and stuff I downloaded. I cant mount the partition as two folders can I. If not, should I just move /home to / and then do what you suggested or? Thanx

~nepenthe

----------

## pilla

When you mount a partition in a mount point (a directory), you won t be able to access what was originally on that directory until you unmount the partition. 

You can mount the same partition in two different mount points, but I do not understand why you should. 

 *nepenthe wrote:*   

> Okay thanx that was what I was looking for, what I did before i posted though was I resized a windows partition and made another XFS and mounted it as /home just for mp3's and stuff I downloaded. I cant mount the partition as two folders can I. If not, should I just move /home to / and then do what you suggested or? Thanx
> 
> ~nepenthe

 

----------

## nepenthe

what i mean is, well here /dev/hda5 is my root /dev/hda6 boot /dev/hda8 is the new XFS partition I made that is mounted as /home if I were to mount /opt or /usr to a new partition like you suggested id I would do it do /dev/hda8.

My question is how do I have /dev/hda8 be /home and either /opt or /usr 

If you understand I know i'm a newb    :Embarassed: 

----------

## pilla

You can, but it will be quite a messy thing.... If you really want to do it, I would suggest:

1. mount /dev/hda8 somewhere (it may be /mnt/floppy, it is just temporary)

2. copy what is in /opt to /mnt/floppy

```

cp -R /opt/* /mnt/floppy

```

3. rename /opt (in case things go wrong, you can rollback)

```

mv /opt /opt-old

```

4. make a new /opt

```

mkdir /opt

```

5. unmount /mnt/floppy and mount the new /opt

```

unmount /mnt/floppy

mount /dev/hda8 /opt

```

6. copy your mp3 to /opt

```

mkdir /opt/mp3

cp  -R /home/mp3 /opt/mp3

```

7. move /home/mp3 to a temp directory and link /home/mp3 to /opt/mp3

```

mv /home/mp3 /tmp

ln -s /opt/mp3  /home/mp3

```

Do not do this before you understand what is going on.  :Cool: 

 *nepenthe wrote:*   

> what i mean is, well here /dev/hda5 is my root /dev/hda6 boot /dev/hda8 is the new XFS partition I made that is mounted as /home if I were to mount /opt or /usr to a new partition like you suggested id I would do it do /dev/hda8.
> 
> My question is how do I have /dev/hda8 be /home and either /opt or /usr 
> 
> If you understand I know i'm a newb   

 

----------

## nepenthe

doh....

Ok dont yell at me I didn't follow your directions completely, I thought I did understand and was trying something. Cause /home I was gonna use for mp3's and stuff like that but I hadn't yet, and I figured it would be easier to mount /dev/hda8 to /usr and just make a folder inside /usr to put that stuff so what I did was made a folder in home called it usr copy'd /usr to /home/usr and then made a folder in root as /home2 and copy'd the contents of /home to it minus the /home/usr folder. Then renamed it to /home after. Then edited /etc/fstab to mount /dev/hda8  to /usr instead of /home. But now when I restart it fails mounting /dev/hda8 because says know folder named /usr exists. So I manually make a folder /usr then mount /dev/hda8 to /usr and then can startup KDE and use it normaly but when I restart I get same error again... sorry...

Any ideas?

----------

## pilla

It is your system, do whatever pleases you  :Cool: 

I am having problems to follow you.  How did you copied /usr to /home? cp -R /usr /home/usr ?   Could you post your fstab ?

 *nepenthe wrote:*   

> doh....
> 
> Ok dont yell at me I didn't follow your directions completely, I thought I did understand and was trying something. Cause /home I was gonna use for mp3's and stuff like that but I hadn't yet, and I figured it would be easier to mount /dev/hda8 to /usr and just make a folder inside /usr to put that stuff so what I did was made a folder in home called it usr copy'd /usr to /home/usr and then made a folder in root as /home2 and copy'd the contents of /home to it minus the /home/usr folder. Then renamed it to /home after. Then edited /etc/fstab to mount /dev/hda8  to /usr instead of /home. But now when I restart it fails mounting /dev/hda8 because says know folder named /usr exists. So I manually make a folder /usr then mount /dev/hda8 to /usr and then can startup KDE and use it normaly but when I restart I get same error again... sorry...
> 
> Any ideas?

 

----------

## nepenthe

yeah I made a folder in like this /home/usr then did what you suggested cp -r /usr /home/usr then moved the contents of /home to /home2 minus the /home/usr folder. Then I moved /home/usr to /home  and changed fstab to instead of having /dev/hda8 mount to /home it mounted to /usr

here's fstab

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.

/dev/hda6		/boot		ext3		noauto,noatime		1 1

/dev/hda5		/		xfs		noatime			0 0

/dev/hda7		none		swap		sw			0 0

/dev/cdroms/cdrom0	/mnt/cdrom	iso9660		noauto,ro		0 0

proc			/proc		proc		defaults		0 0

/dev/hda9		/usr		xfs		noatime			0 0

/dev/hda1		/mnt/windows_c	ntfs		noatime			0 0

/dev/hda8		/mnt/windows_d	ntfs		noatime			0 0

just note I was wrong when I first told you /dev/hda8 was new partition I made it was really /dev/hda9 didn't want to correct myself then because didnt need to but yeah =]

----------

## pilla

Verify if you don t have a usr directory inside /usr , /usr/usr. If it is the case, just move everything inside /usr/usr to /usr and it should work.

 *nepenthe wrote:*   

> yeah I made a folder in like this /home/usr then did what you suggested cp -r /usr /home/usr then moved the contents of /home to /home2 minus the /home/usr folder. Then I moved /home/usr to /home  and changed fstab to instead of having /dev/hda8 mount to /home it mounted to /usr
> 
> here's fstab
> 
> # NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
> ...

 

----------

## nepenthe

nope I'm looking inside the /usr folder and and there's no other /usr folder inside

hmm

its strange cause if I reboot and it has the error where cant mount /dev/hda9 to /usr because folder does not exist then I make the folder then mount it to it, and reboot it has same erro again

----------

## pilla

So, when you reboot, it erases the /usr mountpoint in some way??

 *nepenthe wrote:*   

> nope I'm looking inside the /usr folder and and there's no other /usr folder inside
> 
> hmm
> 
> its strange cause if I reboot and it has the error where cant mount /dev/hda9 to /usr because folder does not exist then I make the folder then mount it to it, and reboot it has same erro again

 

----------

## heliosc

Actually, XFS is quite easily growable. In the xfsprogs package is a program called xfs_growfs. Use a Windows partition program to resize your windows partition and make some freespace after the XFS partition. Then, in Linux, use the fdisk program to delete the existing XFS partition, and create a new one using the new freespace. This whole operation has to be done in one session, and the new partition absolutely MUST start at the same address as the original partition. After that, quit fdisk, and and do xfs_growfs /. You don't have to unmount or reboot or anything like that.

----------

## nepenthe

well that was the case, but after last reboot it stopped. It stopped after I removed the usr folder that was origianlly at /usr from the trashcan. Weather or not that was the cause i dont know... but the xfs_grow sounds complicated... mabbe another day. Thank you though

----------

## meowsqueak

If you put opt and usr on another partition and create /opt -> /mnt/other/opt and /usr -> /mnt/other/usr symlinks, you will need to create these symlinks too:

```
/mnt/other/bin -> /bin

/mnt/other/lib -> /lib

/mnt/other/sbin -> /sbin

/mnt/other/etc -> /etc

/mnt/other/var -> /var

/mnt/other/tmp -> /tmp
```

If you don't do this, there are some ebuilds that will fail, because they do odd things like 'cd /usr/share/ ... cd ../../lib/'. Those symlinks allow the backreferenced directory change to succeed.

I have had actual experience with this - it's what I'm doing now. I can't remember which ebuilds or packages gave problems.

----------

