移动/home到新分区 - Leo's Utopia

移动/home到新分区

leo.zhao posted @ Wed, 30 Dec 2009 16:32:20 +0800 in old posts with tags ArchLinux Home 移动分区 , 2234 readers

原来的/home是在第一块硬盘里面的,这个硬盘上完全就是系统,下面是我的分区表

 

1 /dev/sda1 /boot
2
3 /dev/sda2 swap
4
5 /dev/sda3 /
6
7 /dev/sda4 /home

 

因为这块硬盘比较小,当时给/home留的空间不多,只有500m,现在发现不够了,新加了一块硬盘来专门做/home分区。

注:关于/home放在单独分区或者单独硬盘上的好处可以参见前人的叙述。进入正题:

1. 准备新分区

在新硬盘上新建一个分区,工具可以使用fdisk,也可以使用gparted。

尝试一下ext4文件系统,需要命令:

 

1 mkfs.ext4 /dev/sdb1

 

 

2. 转移文件到新分区

在执行以下的操作之前得先切换到单用户模式:

1 init 1

稍等一下,系统会结束图形界面进入纯终端的单用户模式,输入root密码登录。

挂载新分区:

 

1 mkdir /media/disk-2
2
3 mount /dev/sdb1 /media/disk-2

 

复制文件:

1 cp -ax /home/* /media/disk-2

3. 启用新分区

1 umount /home
2
3 umount /media/disk-2
4
5 mount /dev/sdb1 /home

4. 扫尾,清理

在完成上述步骤之后,按Ctrl-D退出单用户模式返回正常模式。

这时需要编辑/etc/fstab,来使系统以后使用我们刚才设置的新分区,将该文件中/home行原来的/dev/sda4替换成/dev /sdb1,原来的文件系统名称由ext3换成ext4,其余不变。

5. 参考文档

http://www.ibm.com/developerworks/cn/linux/l-tip-prompt/tip05/

PAN India meaning said:
Tue, 09 Aug 2022 19:34:26 +0800

PAN is abbreviated as Presence Across Nation and is operating or available at every possible location. A mark of PAN India is given to an organization or firm or company if their entity or branches are spread across every state and their customers can avail of their services from anywhere in India. PAN India meaning If any company operates at one location at the start and has spread its branches to various cities of India, then that company can use the recognition to announce its company growth.


Login *


loading captcha image...
(type the code from the image)
or Ctrl+Enter
Host by is-Programmer.com | Power by Chito 1.3.3 beta | © 2007 LinuxGem | Design by Matthew "Agent Spork" McGee