新买了一个500G的硬盘,今天终于拿到了。
开始将Gentoo移到新的硬盘上去。
先是分区:fdisk /dev/sdb

gentoo-pjq pjq # fdisk -l /dev/sdb

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xf265e339

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1          26      208813+  83  Linux
/dev/sdb2              27       60801   488175187+   5  Extended
/dev/sdb5              27         549     4200966   83  Linux
/dev/sdb6             550        7077    52436128+  83  Linux
/dev/sdb7            7078       13605    52436128+  83  Linux

/dev/sdb1 200M 挂载到/boot
/dev/sdb5 4G 挂载到swap
/dev/sdb6 50G 挂载到/
/dev/sdb7 50G 挂载到/home

分好区后用mke2fs进行文件系统格式化:
mke2fs /dev/sdb1
mkswap /dev/sdb5
mke2fs -j /dev/sdb6
mke2fs -j /dev/sdb7

格式化完后,将它们挂载:
mount /dev/sdb1 /media/sdb1
mount /dev/sdb6 /media/sdb6
mount /dev/sdb7 /media/sdb7

然后进行手动拷贝:
cp /boot/* /media/sdb1/ -a
cp /home/* /media/sdb7/ -a

然后是根目录copy了:
由于根目录下已经有了/boot,/home/,/media
所以只好将根目录下的文件夹一个个手动拷贝了。

完了之后在建立相关的目录:
mkdir /media/sdb6/{home,boot,media}

目录建好了后,
就是修改相关的引导文件了,一个是menu.lst,一个是fstab,


gentoo-pjq pjq # cat /boot/grub/menu.lst
# menu.lst - See: grub(8), info grub, update-grub(8)
#            grub-install(8), grub-floppy(8),
#            grub-md5-crypt, /usr/share/doc/grub
#            and /usr/share/doc/grub-doc/.

#gfxmenu (hd0,10)/boot/message.cristal
#splashimage=(hd1,0)/boot/grub/splash.xpm.gz
default		0

timeout		4


title Gentoo-2.6.30-r6
root (hd0,0)
kernel /boot/kernel-2.6.30-r6 root=/dev/sdb6  plash=silent,fadein,theme:gentoo vga=792  CONSOLE=/dev/tty1   ramdisk=8192
boot

gentoo-pjq pjq # cat /etc/fstab
# /etc/fstab: static file system information.
#
# noatime turns off atimes for increased performance (atimes normally aren't
# needed; notail increases performance of ReiserFS (at the expense of storage
# efficiency).  It's safe to drop the noatime options if you want and to
# switch between notail / tail freely.
#
# The root filesystem should have a pass number of either 0 or 1.
# All other filesystems should have a pass number of 0 or greater than 1.
#
# See the manpage fstab(5) for more information.
#

# <fs>			<mountpoint>	<type>		<opts>		<dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
/dev/sdb1		/boot		ext2		noatime	1 2
/dev/sdb5		none		swap		sw		0 0
/dev/sdb6		/		ext3		noatime		0 1
/dev/sdb7              /home           ext3           noatime          0 1
/dev/cdrom		/media/cdrom	auto		ro	0 0
#/dev/cdrom		/media/cdrom	auto		noauto,ro	0 0
#/dev/fd0		/mnt/floppy	auto		noauto		0 0


/dev/sda1    /media/sda1      ntfs-3g    defaults,locale=zh_CN.UTF-8,umask=002  0   0
/dev/sda5   /media/sda5       ntfs-3g    defaults,locale=zh_CN.UTF-8,umask=002   0  0
/dev/sda6    /media/sda6     vfat      defaults,iocharset=utf8,umask=000 0  0
/dev/sda7     /media/sda7    vfat      defaults,iocharset=utf8,umask=002  0   0



# glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for
# POSIX shared memory (shm_open, shm_unlink).
# (tmpfs is a dynamically expandable/shrinkable ramdisk, and will
#  use almost no memory if not populated with files)
shm			/dev/shm	tmpfs		nodev,nosuid,noexec	0 0
#none    /tmp   tmpfs       defaults    0	 0
#none   /var/tmp  tmpfs     defaults   0          0

说明一下:
title Gentoo-2.6.30-r6
root (hd0,0)
kernel /boot/kernel-2.6.30-r6 root=/dev/sdb6 plash=silent,fadein,theme:gentoo vga=792 CONSOLE=/dev/tty1 ramdisk=8192
boot
我一直以为要用root (hd1,0),但试过后都没用,试了几次终于成功了,但奇怪的是root=/dev/sdb6 却不是:
root=/dev/sda6.

在fstab中用的也是sdb,而不是sda,试了好几次终于试成功了。
还好,整个过程没有遇到什么问题,现在顺利的拷贝到新的硬盘上了,以后就不需要担心空间不够了。
现在看起来整个系统复杂多了:

gentoo-pjq pjq # mount
rootfs on / type rootfs (rw)
/dev/root on / type ext3 (rw,noatime,errors=continue,data=writeback)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
rc-svcdir on /lib/rc/init.d type tmpfs (rw,nosuid,nodev,noexec,relatime,size=1024k,mode=755)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
udev on /dev type tmpfs (rw,nosuid,relatime,size=10240k,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620)
shm on /dev/shm type tmpfs (rw,nosuid,nodev,noexec,relatime)
/dev/sdb1 on /boot type ext2 (rw,noatime)
/dev/sdb7 on /home type ext3 (rw,noatime)
/dev/sda1 on /media/sda1 type fuseblk (rw,allow_other,default_permissions,blksize=4096)
/dev/sda5 on /media/sda5 type fuseblk (rw,allow_other,default_permissions,blksize=4096)
/dev/sda6 on /media/sda6 type vfat (rw,iocharset=utf8,umask=000)
/dev/sda7 on /media/sda7 type vfat (rw,iocharset=utf8,umask=002)
usbfs on /proc/bus/usb type usbfs (rw,noexec,nosuid,devmode=0664,devgid=85)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
/media/sda5/software on /var/ftp/winsoft type none (rw,bind)
/media/sda6/music on /var/ftp/music type none (rw,bind)
/media/sda6/movies on /var/ftp/movies type none (rw,bind)
/media/sda7/linux on /var/ftp/linux type none (rw,bind)
/media/sda7/games on /var/ftp/games type none (rw,bind)
/media/sda6/var on /var/ftp/var type none (rw,bind)
/media/sda5/software on /var/www/localhost/htdocs/ftp/winsoft type none (rw,bind)
/media/sda5/课件 on /var/www/localhost/htdocs/ftp/ppt type none (rw,bind)
/media/sda6/music on /var/www/localhost/htdocs/ftp/music type none (rw,bind)
/media/sda7/linux on /var/www/localhost/htdocs/ftp/linux type none (rw,bind)
/media/sda7/games on /var/www/localhost/htdocs/ftp/games type none (rw,bind)
/media/sda6/var on /var/www/localhost/htdocs/ftp/var type none (rw,bind)

但仔细看一下还是比较简单的。

现在新硬盘只用了100G,还有大约360G,想一下该怎么分呢,再分60给linux,其它的为NTFS和XP共用。

成功将Gentoo移到新买的硬盘上去

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.