The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Move /usr directory?

Discussion in 'General Discussion' started by HH-Steven, Aug 26, 2008.

  1. HH-Steven

    HH-Steven Well-Known Member

    Joined:
    Aug 29, 2004
    Messages:
    284
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    Ok, im constantly running into issues with my /usr directory becoming 84% full etc... and its getting tiresome removing files.

    Ive already moved and symlinked domlogs, still get the warnings.

    Now, i have a secondary hard drive on this server, it is a 120GB drive with 109GB usable.

    Currently, the setup is:

    Filesystem Size Used Avail Use% Mounted on
    /dev/hda7 2.0G 331M 1.6G 18% /
    /dev/hda8 83G 13G 66G 16% /home
    /dev/hdc1 109G 2.5G 101G 3% /home2
    /dev/hda6 2.0G 40M 1.8G 3% /tmp
    /dev/hda3 3.9G 3.1G 656M 83% /usr
    /dev/hda2 16G 1.9G 13G 13% /var
    /dev/hda1 494M 21M 448M 5% /boot
    tmpfs 505M 0 505M 0% /dev/shm

    Obviously the /usr partition is too small but formatting etc.. is out of the question as this is a live server.

    There is no critical data on the secondary drive (hdc), only tar.gz backups which are also on a remote server i have for backups.

    My question:

    Can i format & partition the secondary hdd (hdc) to have the below:

    hdc1 - 9GB
    hdc2 - 100GB

    Then:

    - mount /dev/hdc1 /usr2

    - Copy all data from /usr to /usr2

    - umount /dev/hda3 (usr)
    - umount /dev/hdc1 (usr2)
    - mount /dev/hdc1 /usr

    - mount /dev/hdc2 /home2

    It all looks good in writing unless someone can spot any flaws?

    Also, could someone describe the steps on formatting and partitioning the drive via ssh? or point me in the right direction?

    I know most will say hire an admin but as this is only a secondary drive i would rather learn myself, after all, what harm can learning on a secondary, unused drive do?

    Any help is greatly appreciated, cheers.
     
  2. Murtaza_t

    Murtaza_t Well-Known Member

    Joined:
    Jan 24, 2005
    Messages:
    476
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Earth
    cPanel Access Level:
    Website Owner
    Hello,

    I don't think you will be able to umount the the /usr partition on a Live server as it give "Partition is busy" error. You will need to either do it from the rescue mode or use the Symlink method to use the space on the /hdc drive.

    To format and resize the partition you can use mke2fs and fdisk /dev/hdc commands.
     
  3. MaestriaNick

    MaestriaNick Well-Known Member

    Joined:
    Aug 6, 2008
    Messages:
    159
    Likes Received:
    3
    Trophy Points:
    18
    i think, unmounting /usr in a live server is not wise , as there may be many libraries needed in /usr partition for the next mount command. So , after you create a new partition, mount it to say /usr2 and copy all the contents in /usr to /usr2 , preserving the permission (use -p option ) . Then modify the /etc/fstab, modify the line for /usr with the new partition you created.

    there will be entry like this,

    /dev/XXXX /usr ext3 defaults ......

    modify it like

    YOURNEWPARTITION /usr ext3 defaults ..

    where YOURNEWPARTITION is partition you created for /usr.

    save the file and use the command

    mount -0 remount /usr

    then verify whether the correct partition is mounted as /usr, using mount command
     
  4. yawsh

    yawsh Well-Known Member

    Joined:
    Jun 20, 2004
    Messages:
    48
    Likes Received:
    0
    Trophy Points:
    6
    Hi,
    What is the process of this post?

    Is it done?
    How?
    Would you explaine please?

    My /usr is 93% full and I want to resize it move it to /home3 as it is 3000GB free disk


    Regards
     
    #4 yawsh, Nov 16, 2008
    Last edited: Nov 16, 2008
  5. activa

    activa Well-Known Member

    Joined:
    May 23, 2006
    Messages:
    204
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Morocco
    cPanel Access Level:
    Root Administrator
    how i can unmount the second drive and format it and re-mount it ?
     
Loading...

Share This Page