Feed on
Subscription

Adjust when the system works / Tmp and / Var is divisional



The skill that changes partition on this system that running about be in (the second) in,Daniel Robbins explained how will / Tmp and / Var moves of themselves share partition to go up.At the same time,He still introduced a few know-how,Make you can shrink machine down time thereby the shortest,Can avoid to make serious mistake.

In my skill,We are successful already ground general / Home shift arrives on a new partition.Now is study when how arranging the document that often alters a new partition to go up.Why should do so?An example is below.The document that often alters can produce many fragment.The filestore that one of optimal kind that include a fragment often will revise namely is on the partition of themselves.Such,The influence of the fragment that other partition won't suffer the file place that often revises to arise.This is not fathomless on the concept,But how should operate actually?

Disposal data

Above all,The file that must found a new partition to be used technically at memory to be revised often.You may hope to get on the disk with this divisional alone park in order to enhance performance.Next,My general explains stage by stage will / Tmp and / Var moves each measure on this new partition.
Warning
How does the technical specification below move one or more partition.Although this technology passes special design,Make you can " cancel " unsuccessful partition is mobile,But the mistake that it does not avoid an user.Change character,The operation that should undertake the format turns partition or duplicate and many document only,The possibility that because input a mistake,exist and brings about mass data to be destroyed.Because of this,Intense proposal youProper measure is adopted to back up before the action all important files.

2.Will new partition is hanged carry / Mnt/rwstorage

No less than is in my skill in that way,The equipment name that should use the empty partition that just founded is replaced- - ? .The data that keys in wrong name to will destroy existing partition to go up accidentally,Must take care so!After keying in this command,You established a system of new Ext2 file on new partition.Can hang almost now carried this partition,But we should found to hang above all hold a place.





# mkdir /mnt/rwstorage

I choose name "rwstorage" is to remind us,This special partition will be special read written file system often at memory.Should hang carry partition,Key in please:





# mount /dev/--? /mnt/rwstorage

3.Found new / Tmp

Partition has been hanged had carried,Can found now new / Tmp catalog:





# cd /mnt/rwstorage
# mkdir tmp
# chmod 1777 tmp


















Answer page head

4.Enter odd user mode

Our new directory / Mnt/rwstorage/tmp is had temporarily the limits of authority that catalog should have.Now,Enter odd user mode please,Because we must duplicate whole / Var.As usual,We will enter last moment of remit to of odd user mode to undertake.From now on we do not hope any programs are read write / the file in Var,Must suspend all guardianship programs so,Disconnect all users,Carry out a few fast maintenance,Key in the following command please for this:





# init 1

If hint you input a mouth to make have a system,safeguard,Operate by the directive please.You should be now in Root Shell,All needless guardianship processes already were stopped.Key in the following command to be / the file in Var founds a reposition:





# cd /mnt/rwstorage
# mkdir var

5.Duplicate / Var

In us new / the acquiescent attributive on Mnt/newstorage/var catalog should be correct,OK now will original all / Var data duplicated to go up to new partition:





# cd /var
# cp -ax * /mnt/rwstorage/var

6.Executive backup establishs symbolic link

After this command is finished,/ Mnt/rwstorage/var is become / a of Var identical carbon.You may ask now,How to make Linux correct use / Mnt/rwstorage/var and / Mnt/rwstorage/tmp is not the acquiescent position below root catalog?Use symbol link comes true very easily this- - we will found new sign to link / Tmp and / Var,They are pointed to / the true list in Mnt/rwstorage.We back up above all original list:





# cd /
# cp var var.old
# cp tmp tmp.old


Final group may be done not have necessary,Because normally you won't put any important documents,be in / in Tmp,But we are done so a few safer.Begin to found a symbol to link now:





# cd /
# ln -s /mnt/rwstorage/var /var
# ln -s /mnt/rwstorage/tmp /tmp


7.Revise finally / Etc/fstab

Now,Use when any users or program / when Var,They will be gone to by voluntary move / Mnt/rwstorage/var!To / Tmp is same also.We still have a measure to want to do;But this one pace can be surely below much user mode carry out.Can let Apache restored to move now,All users that also can allow you loginned afresh.Exit Runlevel 1 by CTRL-D please.The system should be started normally.Login with Root identity please.

The last step that we must complete is configuration / Etc/fstab file,So that will / Dev/- - ? Hang carry / Mnt/rwstorage.Must be in / such group are added in Etc/fstab:





/dev/--? /mnt/rwstorage ext2 defaults 1 2


Important specification:If you are used kernel version is belonged to 2.3+ ,Be in your / in Etc/fstab file have such group probably:





none /var/shm shm defaults 0 0


Should enable in the system all right share memory,It is hanged below acquiescent circumstance carry in / in Var.To make should work normally all right,Next group of that group that it must give to just was added in you now.Such,When Linux is started,/ Mnt/rwstorage will be hanged to carry above all (enable / Var) .Next,And be become only be after this,Shm equipment will be hanged to carry in / Var/shm,And latter is actually / Mnt/rwstorage/var/shm.Ensure these two order is:





/dev/--? /mnt/rwstorage ext2 defaults 1 2
none /var/shm shm defaults 0 0


In saved right / of Etc/fstab after changing,Your system upgraded already successfully!It is after it is normal to confirm everything works,You can delete a backup / Tmp.old and / Var.old catalog.Congratulation you- - to obtain optimum behavior,You are opposite successfully your systematic partition undertook be configuringed afresh.


Textual link:Http://www-128.ibm.com/developerworks/cn/linux/l-tip-prompt/tip04/index.html


Related:

    Submit: