磁盘规划 迁移/home

磁盘规划 迁移/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 =

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值