当前位置:网站首页>Migrate /home partition
Migrate /home partition
2022-07-05 16:17:00 【51CTO】
Experimental environment
Originally installed by the company Centos The server adopts the scheme of automatic partition , With the increasing number of system users using servers , The root partition often faces disk space exhaustion , There were even several times that the system could not start , To solve these problems , Now we need to add a new piece for the server scsl Hard disk , And put the user directory /home Migrate the data from to this hard disk , It is required that the use of the original user account cannot be affected after the migration .
Requirements describe
Add a piece to the virtual machine 80GB Of SCSI disk

Create a new hard drive 20GB The partition , It is used to store all ordinary user host folders
command ( Input m get help ):n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Zone number (1-4, Default 1):1
start A sector (2048-167772159, The default is 2048):
The default value... Will be used 2048
Last A sector , + A sector or +size{K,M,G} (2048-167772159, The default is 167772159):+20G
Partition 1 Set to Linux type , The size is set to 20 GiB
command ( Input m get help ):p
disk /dev/sdb:85.9 GB, 85899345920 byte ,167772160 Sectors
Units = A sector of 1 * 512 = 512 bytes
Sector size ( Logic / Physics ):512 byte / 512 byte
I/O size ( Minimum / The best ):512 byte / 512 byte
Disk label type :dos
Disk identifier :0x47dca76d
equipment Boot Start End Blocks Id System
/dev/sdb1 2048 41945087 20971520 83 Linux
command ( Input m get help ):w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Synchronizing disk .
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
After partition, the disk needs to be formatted
[[email protected] ~]# mkfs -t ext4 /dev/sdb1
mke2fs 1.42.9 (28-Dec-2013)
File system tags =
OS type: Linux
Block size =4096 (log=2)
Block size =4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1310720 inodes, 5242880 blocks
262144 blocks (5.00%) reserved for the super user
The first data block =0
Maximum filesystem blocks=2153775104
160 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000
Allocating group tables: complete
Are written to the inode surface : complete
Creating journal (32768 blocks): complete
Writing superblocks and filesystem accounting information: complete
[[email protected] ~]#
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
The new partition is still mounted to /home Under the table of contents , You need to import the data of the original user in the system
[[email protected] ~]# mkdir /zhang
[[email protected] ~]# mv /home/* -t /zhang/
[[email protected] ~]# ls /zhang/
bdqn kylin obama zhang
[[email protected] ~]# ls /home/
[[email protected] ~]# mount /dev/sdb1 /home/
[[email protected] ~]# df
file system 1K- block Already used You can use Already used % Mount point
devtmpfs 481616 0 481616 0% /dev
tmpfs 497836 0 497836 0% /dev/shm
tmpfs 497836 8676 489160 2% /run
tmpfs 497836 0 497836 0% /sys/fs/cgroup
/dev/sda3 18873344 5782856 11349848 34% /
/dev/sda1 1038336 173828 864508 17% /boot
tmpfs 99568 24 99544 1% /run/user/0
/dev/sr0 4600876 4600876 0 100% /run/media/root/CentOS 7 x86_64
/dev/sdb1 20511312 45080 19401272 1% /home
[[email protected] ~]# ls -al /home/
Total usage 20
drwxr-xr-x 3 root root 4096 7 month 4 15:31 .
dr-xr-xr-x. 1 root root 230 7 month 4 15:33 ..
drwx------ 2 root root 16384 7 month 4 15:31 lost+found
[[email protected] ~]# mv /zhang/* -t /home/
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
The server can automatically mount the partition after each boot

Check the partition after restart

边栏推荐
猜你喜欢
随机推荐
Data communication foundation - route republication
Using graylog alarm function to realize the regular work reminder of nail group robots
Background system sending verification code function
Li Kou today's question -729 My schedule I
20. [stm32] realize the function of intelligent garbage can by using ultrasonic module and steering gear
Cartoon: what is MapReduce?
10 minutes to help you get ZABBIX monitoring platform alarm pushed to nail group
迁移/home分区
Find the root of the following equation by chord cutting method, f (x) =x^3-5x^2+16x-80=0
Replknet: it's not that large convolution is bad, but that convolution is not large enough. 31x31 convolution. Let's have a look at | CVPR 2022
21.[STM32]I2C协议弄不懂,深挖时序图带你编写底层驱动
The OBD deployment mode of oceanbase Community Edition is installed locally
16. [stm32] starting from the principle, I will show you the DS18B20 temperature sensor - four digit digital tube displays the temperature
How difficult is it to pass the certification of Intel Evo 3.0? Yilian technology tells you
This article takes you through the addition, deletion, modification and query of JS processing tree structure data
Record a 'very strange' troubleshooting process of cloud security group rules
Quick completion guide for manipulator (IX): forward kinematics analysis
list集合根据对象某属性求和,最大值等
List de duplication and count the number
Arduino控制微小的六足3D打印机器人









