磁盘规划 迁移/home
之所以进行迁移,是因为根分区预留不宽裕,du –sh /home 发现home分区占比较大,于是将home目录迁移到新的分区
迁移/home目录有两种方法:
第一种
1. 新建一个磁盘分区,将其挂载到/data目录下
2.将/home目录下的所有用户的宿主目录用mv移动到/data目录下
3.修改/etc/passwd文件,将文件内普通用户的宿主目录进行修改,即将/home改为/data
第二种
1.首先创建用户xiaowang
[root@magedu ~]# useradd xiaowang
[root@magedu ~]# getent passwd xiaowang
xiaowang:x:504:504::/home/xiaowang:/bin/bash
2.磁盘分区,划分一个10G的磁盘
[root@magedu ~]# fdisk /dev/sda
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): p 查看分区
Disk /dev/sda: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00060738
Device Boot Start End Blocks Id System
/dev/sda1 * 1 131 1048576 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 131 6658 52428800 83 Linux
/dev/sda3 6658 13185 52428800 83 Linux
Command (m for help): n 进行分区
Command action
e extended
p primary partition (1-4)
p
Selected partition 4
First cylinder (13185-26108, default 13185):
Using default value 13185
Last cylinder, +cylinders or +size{K,M,G} (13185-26108, default 26108): +10G
Command (m for help): P
Disk /dev/sda: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 =