Moving /var, /home to separate partition: diferenças entre revisões

Fonte: ARDITI - WIKI
Saltar para a navegação Saltar para a pesquisa
Sem resumo de edição
Sem resumo de edição
 
Linha 5: Linha 5:
2. Then you need to create the filesystems for those partitions, for example, to create a new ext4 filesystem on the /dev/sdaX device (replace /dev/sdaX with your own device):
2. Then you need to create the filesystems for those partitions, for example, to create a new ext4 filesystem on the /dev/sdaX device (replace /dev/sdaX with your own device):


  mkfs.ext4 /dev/sdaX
mkfs.ext4 /dev/sdaX


3. Mount the new filesystem under /mnt
3. Mount the new filesystem under /mnt


  mkdir /mnt/var         
mkdir /mnt/var         
  mount /dev/sdaX /mnt/var
mount /dev/sdaX /mnt/var


4. Go to single-user mode so that there is no rw activity on the directory during the process
4. Go to single-user mode so that there is no rw activity on the directory during the process


  init 1
init 1


5. Enter your root password.
5. Enter your root password.
Linha 20: Linha 20:
6. Backup data in var only (not the /var directory itself)
6. Backup data in var only (not the /var directory itself)


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


7. Rename the /var directory after your data has been transferred successfully.
7. Rename the /var directory after your data has been transferred successfully.


  cd /
cd /
  mv var var.old
mv var var.old


8. Make the new var directory
8. Make the new var directory


  mkdir var
mkdir var


9. Unmount the new partition.
9. Unmount the new partition.


  umount /dev/sdaX
umount /dev/sdaX


10. Remount it as /var
10. Remount it as /var


  mount /dev/sdaX /var
mount /dev/sdaX /var


11. Edit /etc/fstab file to include the new partition, with /var being the mount point, so that it will be automatically mounted at boot.
11. Edit /etc/fstab file to include the new partition, with /var being the mount point, so that it will be automatically mounted at boot.


  /dev/sdaX      /var    ext4    defaults    0 0
/dev/sdaX      /var    ext4    defaults    0 0


12. Repeat steps 1-11 for /home and /tmp.
12. Repeat steps 1-11 for /home and /tmp.
Linha 48: Linha 48:
13. Finally return to multitasking mode.
13. Finally return to multitasking mode.


  init 5
init 5

Edição atual desde as 14h02min de 31 de março de 2018

Reference: https://unix.stackexchange.com/questions/131311/moving-var-home-to-separate-partition

1. First you need some unallocated space to create the partitions for each mountpoint (/var, /home, /tmp).

2. Then you need to create the filesystems for those partitions, for example, to create a new ext4 filesystem on the /dev/sdaX device (replace /dev/sdaX with your own device):

mkfs.ext4 /dev/sdaX

3. Mount the new filesystem under /mnt

mkdir /mnt/var        
mount /dev/sdaX /mnt/var

4. Go to single-user mode so that there is no rw activity on the directory during the process

init 1

5. Enter your root password.

6. Backup data in var only (not the /var directory itself)

cd /var
cp -ax * /mnt/var

7. Rename the /var directory after your data has been transferred successfully.

cd /
mv var var.old

8. Make the new var directory

mkdir var

9. Unmount the new partition.

umount /dev/sdaX

10. Remount it as /var

mount /dev/sdaX /var

11. Edit /etc/fstab file to include the new partition, with /var being the mount point, so that it will be automatically mounted at boot.

/dev/sdaX       /var     ext4    defaults    0 0

12. Repeat steps 1-11 for /home and /tmp.

13. Finally return to multitasking mode.

init 5