LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 5483|回复: 14

如何把 ext2 文件系统转成 reiserfs 的

[复制链接]
发表于 2004-4-8 09:11:32 | 显示全部楼层 |阅读模式
经过2天的摸索,终于把debian装好了,但是文件系统还是ext2的,所以想换成reiserfs的,不知道该怎么做啊~
发表于 2004-4-8 10:06:47 | 显示全部楼层
没别的办法,先备份好数据,然后重新格式化成reiserfs,再恢复过去。
 楼主| 发表于 2004-4-8 10:12:28 | 显示全部楼层
我也是这样做的,但是启动的时候找不到啊,好像是不支持reiserfs格式
我的内核是2.4.20的啊,应该支持的啊,我可以mount reiserfs格式的.
发表于 2004-4-8 10:14:36 | 显示全部楼层
最好升级到2.4(2.6)内核以后再备份,因为看你的安装内核应该是2.2的,reiserfs不支持,
或者重装,在boot时输入linux-24bf(看下帮助),安装2.4的内和,有reiserfs可选
发表于 2004-4-8 10:35:55 | 显示全部楼层

前两天我也转了一把,把过程说出来与大家分享:

0.目标是把根分区转成 reiserfs 3 的(原来是 ext2)。
分区操作危险,各位朋友请小心从事
根分区如果是 reiserfs 的话,内核必须内建 reiserfs 支持,或者使用带 reiserfs 模块的 initrd

1.准备运动:
1.1.把分区格式化成 reiserfs ,以及日后维护,需要用到一些工具:
#apt-get install reiserfsprogs

1.2.看一下系统上的各个分区大小,决定一下文件临时放什么地方

  1. $df -h
  2. Filesystem            Size  Used Avail Use% Mounted on
  3. /dev/hdb1             4.9G  1.3G  3.7G  26% /
  4. tmpfs                 126M     0  126M   0% /dev/shm
  5. /dev/hdb7             9.6G  4.1G  5.6G  43% /usr
  6. /dev/hdb8             9.6G  4.4G  5.3G  46% /mnt/songs
  7. /dev/hdb5             4.3G  3.0G  1.1G  75% /mnt/movie
复制代码

到时候,还是把 / 先放在 /mnt/songs 下面吧,一个是 1.3 GB 一个还剩  5.3GB,足够了。

1.3. 现在就开始?那么岂不是把 /usr,/mnt/* 什么的全弄到  /mnt/songs 了?重启先!
我用 Knoppix 启动机器,用 F2 看了一下,加了以下参数:2 us dma,即字符界面,英文(美文),开启dma。

1.4.把 /dev/hdb1 和 /dev/hdb8 先 mount 上,Knoppix 帮我们写好了 fstab,mount 时可以简单一点。
#mount /dev/hdb1
#mount /dev/hdb8
在 /dev/hdb8 下面建一个临时目录,就叫 root_tmp 吧:
#mkdir /mnt/hdb8/root_tmp

2.备份再恢复
2.1.现在开始备份 / 分区(它现在是 /mnt/hdb1 了)。
#(cd /mnt/hdb1 && tar cvf - . ) | (cd /mnt/hdb8/root_tmp && tar xvf -)
时间可能很长(我花了十分钟左右),休息一下。拷贝结束后,再看看  /mnt/hdb8/root_tmp ,嗯,都在。

2.2.把原来的 root 分区格式化成 reiserfs 3.6 格式
#umount /dev/hdb1
#mkreiserfs /dev/hdb1

2.3.再把刚才备份的文件恢复回来
#mount /dev/hdb1 /mnt/hdb1
看着提示,呵呵,已经是 reiserfs 了。
#(cd /mnt/hdb8/root_tmp && tar cvf - . ) | (cd /mnt/hdb1 && tar xvf -)
再耐心地等待一会儿。

3. 修改原来的 /etc/fstab
#vi /mnt/hdb1/etc/fstab
我把 /dev/hdb1 的一行改成了这样:

  1. /dev/hdb1       /               reiserfs        defaults        1       1
复制代码


4. 重启
一切如常,我的日子又恢复了平静。舒了一口气,
#rm -rf /mnt/songs/root_tmp

其实在精华区里都有答案呢:
1.昨晚的经历:Debian 搬家
http://linuxsir.cn/forum.php?mod=viewthread&tid=4838
2.如何更改文件系统类型?
http://linuxsir.cn/forum.php?mod=viewthread&tid=26059
发表于 2004-4-8 10:36:21 | 显示全部楼层
ext2 转换到ext3吧 可以无缝转换的
发表于 2004-4-8 11:04:26 | 显示全部楼层
用tar做备份会不会有问题呢?

Debian参考手册

8.3.3 tar
Tar overcame some of the problems that cp had with symbolic links.
However, although cpio handles special files, traditional tar
doesn't.

tar's way of handling multiple hard links to a file places only one
copy of the link on the tape, but the name attached to that copy is
the only one you can use to retrieve the file; cpio's way puts one
copy for every link, but you can retrieve it using any of the names.
发表于 2004-4-8 11:05:58 | 显示全部楼层
用tar整个分区对铐,主意不错
发表于 2004-4-8 11:22:37 | 显示全部楼层
只要内核支持就可以了。用tar是很保险的方法,我经常使用此方法在硬盘中把Debian转来转去的。
发表于 2004-4-8 11:26:47 | 显示全部楼层
最初由 BBDD 发表
用tar做备份会不会有问题呢?

Debian参考手册

8.3.3 tar
Tar overcame some of the problems that cp had with symbolic links.
However, although cpio handles special files, traditional tar
doesn't.

tar's way of handling multiple hard links to a file places only one
copy of the link on the tape, but the name attached to that copy is
the only one you can use to retrieve the file; cpio's way puts one
copy for every link, but you can retrieve it using any of the names.


我以前曾经用 tar 做过备份 /usr 的工作,到现在还没有发现异常。但是似乎老鸟比较喜欢 cpio 的说,这里有个 thread 是说扩大 /usr 的事儿:
http://lists.debian.org/debian-u ... 00304/msg00693.html
他是这样备份的:

  1. cd /
  2. find usr|cpio -pmd /mnt/newusr
复制代码

下次备份的话,我一定要试一下 cpio 。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表