Lab Environment:
The company originally installed the RHEL5 server with an automatic partitioning scheme, as the number of system users using the server continues to increase, the root partition often face disk space exhaustion situation, occasionally also caused the system to fail to boot. In order to solve these problems, we need to add a new SCSI hard disk for the server, and migrate the data from user directory "/home" to the hard disk, which will not affect the use of the old user account after the migration.
Requirements Description:
(1) Add a 80GB SCSI disk to the virtual machine.
Add new hard drive after shutdown, reboot into RHEL5 system (or reboot after adding hard drive)
Vm→settings (or press the shortcut key Ctrl+d) →add→
(2) Set up a 20GB partition on the new hard disk to hold all the normal user's host folders.
Partitioning and formatting
1 Use the FDISK command to partition the new hard disk, creating a 20GB Primary partition ("/DEV/SDB1").
2 perform "partprobe" to update the partition table information, using the MKFS command to format the newly created partition in the previous step to the EXT3 file system.
(3) The newly created partition is still attached to the "/home" directory and needs to import the data from the system.
Migrating the "/home" Partition
1 Transfer the contents of the original "/home" directory and do a backup.
2 Modify the partition mount settings in the "/etc/fstab" file.
3 Attach the newly created partition to the "/home" directory by pressing the settings in the "/etc/fstab" file.
4 Copy the user data backed up in this step ① to the newly mounted "/home" file system.
(4) The server can automatically mount to the partition after each boot.
How Linux migrates the/home partition