当前位置:网站首页>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
边栏推荐
- PSPNet | 语义分割及场景分析
- Which keywords will conflict with the abstract keyword
- 五种常见的咨询公司谈判策略以及如何维护自己的利益
- Cartoon: what is service fusing?
- Research and practice of super-resolution technology in the field of real-time audio and video
- Enterprise backup software Veritas NetBackup (NBU) 8.1.1 installation and deployment of server
- The visual experience has been comprehensively upgraded, and Howell group and Intel Evo 3.0 have jointly accelerated the reform of the PC industry
- 通过的英特尔Evo 3.0整机认证到底有多难?忆联科技告诉你
- Verilog realizes the calculation of the maximum common divisor and the minimum common multiple
- Arduino controls a tiny hexapod 3D printing robot
猜你喜欢
Cs231n notes (medium) -- applicable to 0 Foundation
Data communication foundation - route republication
ES6 drill down - ES6 generator function
Cs231n notes (top) - applicable to 0 Foundation
The visual experience has been comprehensively upgraded, and Howell group and Intel Evo 3.0 have jointly accelerated the reform of the PC industry
Verilog realizes the calculation of the maximum common divisor and the minimum common multiple
RLock锁的使用
vulnhub-Root_ this_ box
机械臂速成小指南(九):正运动学分析
Data communication foundation NAT network address translation
随机推荐
漫画:什么是MapReduce?
DataArts Studio数据架构——数据标准介绍
10分钟帮你搞定Zabbix监控平台告警推送到钉钉群
List uses stream flow to add according to the number of certain attributes of the element
OceanBase社区版之OBD方式部署方式本地安装
Find the root of the following equation by chord cutting method, f (x) =x^3-5x^2+16x-80=0
CISP-PTE之PHP伪协议总结
Enterprise backup software Veritas NetBackup (NBU) 8.1.1 installation and deployment of server
obj集合转为实体集合
Cartoon: what is service fusing?
EDI许可证和ICP经营性证有什么区别
超分辨率技术在实时音视频领域的研究与实践
19.[STM32]HC_ SR04 ultrasonic ranging_ Timer mode (OLED display)
One click installation script enables rapid deployment of graylog server 4.2.10 stand-alone version
Noi / 1.5 06: element maximum span value of integer sequence
Data communication foundation ACL access control list
Example project: simple hexapod Walker
How to use FRP intranet penetration +teamviewer to quickly connect to the intranet host at home when mobile office
Data communication foundation - Ethernet port mirroring and link aggregation
Clock switching with multiple relationship