Rozdíly
Zde můžete vidět rozdíly mezi vybranou verzí a aktuální verzí dané stránky.
| Obě strany předchozí revize Předchozí verze Následující verze | Předchozí verze | ||
|
linux:presun_var_na_jine_misto [2022/05/31 08:52] badtotem |
linux:presun_var_na_jine_misto [2022/05/31 08:57] (aktuální) badtotem |
||
|---|---|---|---|
| Řádek 1: | Řádek 1: | ||
| ====== How to move or relocate /var folder to a new partition in Linux ====== | ====== How to move or relocate /var folder to a new partition in Linux ====== | ||
| - | This document (7015338) is provided subject to the disclaimer at the end of this document. | + | * Add a new hard disk to the server. |
| - | + | ||
| - | To relocate or move the /var folder to a new partition in Linux, please follow the steps below: | + | |
| - | + | ||
| - | * Add a new hard disk to the server. | + | |
| + | <note> | ||
| Note: If this is a virtual machine, see how to add a new virtual hard disk to the VM with a corresponding vendor. | Note: If this is a virtual machine, see how to add a new virtual hard disk to the VM with a corresponding vendor. | ||
| + | </note> | ||
| - | Mount the new filesystem in /mnt, from YaST: | + | * Switch to single-user mode: |
| - | Launch YaST, select Partitioner | expand Hard Disks | select Add Partition... | + | <code> |
| - | New Partition Type: Primary Partition | + | init 1 |
| - | Select Maximum Size, if preferred. | + | </code> |
| - | Formatting Options: ext3 (default) | + | |
| - | Mounting Options: Mount Partition and specify Mount Point as /mnt/newvar | + | |
| - | Note: If there is a problem, the directory may need to be created first. | + | |
| - | Select Finish and then Next. | + | |
| - | Switch to single-user mode: | ||
| - | init 1 | ||
| Note: This will reboot the server into single-user mode where services aren't started and networking is offline for the server. Please login as root when the login dialog is presented and proceed to open a terminal window. | Note: This will reboot the server into single-user mode where services aren't started and networking is offline for the server. Please login as root when the login dialog is presented and proceed to open a terminal window. | ||
| Copy the data in var only to the new mounted filesystem: | Copy the data in var only to the new mounted filesystem: | ||
| + | <code> | ||
| cp -apx /var/* /mnt/newvar | cp -apx /var/* /mnt/newvar | ||
| + | </code> | ||
| Rename the current /var directory for backup purposes: | Rename the current /var directory for backup purposes: | ||
| + | <code> | ||
| mv /var /var.old | mv /var /var.old | ||
| + | </code> | ||
| Make the new var directory: | Make the new var directory: | ||
| + | <code> | ||
| mkdir /var | mkdir /var | ||
| + | </code> | ||
| Edit the /etc/fstab file: | Edit the /etc/fstab file: | ||
| Replace /mnt/newvar with /var | Replace /mnt/newvar with /var | ||
| Save and Close the file. | Save and Close the file. | ||
| + | |||
| Note: The new partition is now configured to be mounted at /var on boot. | Note: The new partition is now configured to be mounted at /var on boot. | ||
| Restart the server. | Restart the server. | ||