当前位置:网站首页>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
边栏推荐
- Boost the development of digital economy and consolidate the base of digital talents - the digital talent competition was successfully held in Kunming
- 单商户 V4.4,初心未变,实力依旧!
- 【网易云信】超分辨率技术在实时音视频领域的研究与实践
- Intel 13th generation Raptor Lake processor information exposure: more cores, larger cache
- CISP-PTE之PHP伪协议总结
- 抽象类和接口的区别
- vant popup+其他组件的组合使用,及避坑指南
- ES6 drill down - Async functions and symbol types
- 一些认知的思考
- Background system sending verification code function
猜你喜欢
《21天精通TypeScript-3》-安装搭建TypeScript开发环境.md
公司自用的国产API管理神器
Information collection of penetration test
Use of RLOCK lock
How difficult is it to pass the certification of Intel Evo 3.0? Yilian technology tells you
视觉体验全面升级,豪威集团与英特尔Evo 3.0共同加速PC产业变革
21. [STM32] I don't understand the I2C protocol. Dig deep into the sequence diagram to help you write the underlying driver
19.[STM32]HC_SR04超声波测距_定时器方式(OLED显示)
机械臂速成小指南(九):正运动学分析
vulnhub-Root_ this_ box
随机推荐
abstract关键字和哪些关键字会发生冲突呢
一文带你吃透js处理树状结构数据的增删改查
助力数字经济发展,夯实数字人才底座—数字人才大赛在昆成功举办
18.[STM32]读取DS18B20温度传感器的ROM并实现多点测量温度
This article takes you through the addition, deletion, modification and query of JS processing tree structure data
10分钟帮你搞定Zabbix监控平台告警推送到钉钉群
Cs231n notes (medium) -- applicable to 0 Foundation
One click installation script enables rapid deployment of graylog server 4.2.10 stand-alone version
Data communication foundation ACL access control list
Subclasses and superclasses of abstract classes
Batch update in the project
vlunhub- BoredHackerBlog Social Network
Clock switching with multiple relationship
List uses stream flow to add according to the number of certain attributes of the element
ES6深入—async 函数 与 Symbol 类型
通过的英特尔Evo 3.0整机认证到底有多难?忆联科技告诉你
项目中批量update
vant tabbar遮挡内容的解决方式
SQL injection sqllabs (basic challenges) 1-10
Data communication foundation smart_ Link_&_ Monitor_ Link