/usr is at 90% full

Latest response

Basically my /usr area  (/dev/cciss/c0d0p6) is at 90% full.   I have about 5gb currently allocated to that partition.  Fortunately, I still have about 30gb of unallocated space on the device where /usr resides.  That being said, I would like to allocate an additional 5gb to /usr.   Does anyone know the best approach to do this? 

 

Disk /dev/cciss/c0d0: 73.3 GB, 73372631040 bytes

255 heads, 63 sectors/track, 8920 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

 

           Device Boot      Start         End      Blocks   Id  System

/dev/cciss/c0d0p1   *           1          13      104391   83  Linux

/dev/cciss/c0d0p2              14         650     5116702+  83  Linux

/dev/cciss/c0d0p3             651        2435    14338012+  82  Linux swap / Solaris

/dev/cciss/c0d0p4            2436        8920    52090762+   5  Extended

/dev/cciss/c0d0p5            2436        3455     8193118+  83  Linux

/dev/cciss/c0d0p6            3456        4092     5116671   83  Linux

/dev/cciss/c0d0p7            4093        4729     5116671   83  Linux

/dev/cciss/c0d0p8            4730        5239     4096543+  83  Linux

Responses

Hello Brett!

 

Are there any unused partitions? As I can see from your "fdisk" output there are plenty of partitions on your hard drive.

I don't know what you're exactly meaning with the 30 GB of remaining capacity. Is there storage unassigned to any partition? Or is it assigned to an unused parition?

If there is an unused partition it would be one possibility to merge it with your /usr partition to get more capacity. Another possibility is to delete another partition and expand your /usr partition. If you have 30 GB unassigned to any partition remaining the best approach would be to use a tool like gparted from a live CD to resize the /usr partition - this needs a downtime.

 

Basically it would have been the best to choose LVM when partitioning the hard drive. The big benefit of LVM is to resize partitions and file systems dynamically on your needs - online, of course. ;-)

 

Is it a productive or a test server? I personally would highly recommend using LVM instead of classical partitioning.

 

Best regards,

Christian.

Hi Christian,

Thanks for the response.  Device c0d0 is 73gb in size (mirrored drives HP raid).  Based on my fdisk, I still show close to 30gb of unallocated space (not set to any partition) that I have available that I can use. 

Anyway, can I create a new partition of 10gb with the 30gb I have available and then copy (rsync) /usr to my new partition and remount /usr to the new partition?

Yes, this is a production server that was set up some time ago.

I think the best solution in that case would be:

  1. create a additional partition (can be done easily with the live DVD and gparted)
  2. format the additional partition with your favourite file system
  3. mount it as /mnt/temp or something like this
  4. rsync / cp --preserve=all the data from your "old" /usr to the new /usr
  5. edit your /etc/fstab to use the new partition as /usr (so you don't have to format/delete the old partition)
  6. reboot the system to see if everything's working fine

Remember: this operation needs server downtime - you need a RHEL live DVD to do this.

Good luck!

 

Best regards!

Hi Brett,

In addition to that, check this Knowledge base that perhaps can assist you on that:

"Moving home and var from root [ / ] to a different partition on RHEL
    https://access.redhat.com/site/solutions/67781"

Best regards

Fábio Da Cunha

It would be very interesting to see, under which paths the additional partitions are mounted.

Could you provide the outputs of:

  • df -h
  • cat /etc/fstab
  • cat /proc/mounts

?

 

Best regards,

Christian.

Silly question, but, "do you have any capability of breaking that mirror and presenting the underlying devices directly to your RHEL system as individual disks"? If so, then what you could do is:

  1. boot off one half the mirror
  2. Redo the other disk as an LVM-managed device - replicating your current partitioning scheme to it via LVs.
  3. Set the LVM-managed drive to be your primary mirror half and resilver to the disk you booted off of in step one

Once you've re-established your hardware-level mirror, the device your OS is booted from will be LVM-controlled, allowing you to dynamically resize filesystems annd volumes to your heart's content.

What I ended up doing is creating a new partition on the same device (c0d0p9) and mounting it as /newusr.   I then copied /usr to /newusr using rsync -avz options.   Once the rsync completed, I edited fstab to have /usr point to c0d0p9 and rebooted the server.  I did this on our DR server and it appears to be working just fine. 

 

Hi Bret,

 

This works until your /usr or whatever filesystem grows to more then half the space left on disk. LVM does not have this disadvantage, for it does not need to copy all the data on the filesystem. It just extends "the filesystem structure".

I would recommend to switch to LVM the next time you have to reinstall this system e.g. when upgrading the RHEL 7.

 

Kind regards,

 

Jan Gerrit Kootstra

Nice work Brett.  It seems like you were caught in quite a predicament and came up with an acceptable work-around.  Like Jan mentioned, LVM is definitely the way to go.  I'll actually be surprised if "slices" will even be an option in coming releases.

I wish I had noticed this thread previously.  You could have (and probably stlil could, if you rolled back what you just did)... created that new partition as an LVM slice.

partition your drive and toggle the new partition to be LVM (8e I believe)

pvcreate /dev/cciss/c0d0p9

vgcreate /dev/cciss/c0d0p9 vg_hostname

lvcreate -n lv_usr -L10GB vg_hostname

mkfs /dev/mapper/vg_hostname-lv_usr

mount /dev/mapper/vg_hostname-lv_usr /newusr

 

Then... when you need more space in /usr

pvdisplay /dev/cciss/c0d0p9 | grep Free

lvresize -L+5G /dev/mapper/vg_hostname-lv_usr

resize2fs /dev/mapper/vg_hostname-lv_usr

Thanks for keeping us updated, Brett, and for everyone's advice and contributions on this topic.