�D�� �a�� ���� �j�M �s�D �e�����x �����p�� ���� LinuxFocus
[Top Bar]
[Bottom Bar]
[Photo of the Author]
�@�̡G Olivier Chapuis

����@��:

�@�̥D�׼ƾǡA�ר�O�q�����޿�A��{�M�z�סC �L�̪�~�o�{ Linux �ӥB�D�`�߷R���C�@�̳��w Muriel �A�����A �]���w Brittney �A���A���M�n�Y���F��C

���e:

  1. ²��
  2. �D�n�B�J
  3. �dzƤu�@
  4. ���s�إ� Windows ���w�Ф��ΰ�
  5. �ϥηs�����ΰ�
  6. ���D
  7. �ѦҸ��

�p�󲾰� Windows

[Ilustration]

�e��:

�ڦb�o�g�峹�̭n���Ѫ��O�p��q Linux �M Windows �@�s������������ Windows �t�ΡA �ӥB��ťX�Ӫ��Ŷ��d�� Linux �ΡC �o�g�峹���D�n��H�O�� Linux ���s�� (�]�]�A�ڦۤv)�C



 

²��

�w�˧� Linux ��Ӥ�᪺�Y�@�ѡA�ڬ�M�Q�� Windows �R���C ��]�O�ڮڥ����Q�A�� Windows �F! �ڷQ�\�h����Ǫ̥i��]�J��M�ڦP�˪����p�A �ҥH�ڼg�F�o�g�峹�����U�L�� (�i���̤]�i�HŪŪ�A���ڤ@�ǫ�ij)�C �o�ر��p����ظѨM��k:

�Ĥ@�جO�q�s�w�� Linux�C�o�˪��n�B�O�Y�ϧA�� Linux ���D�����h�A �]�i�H�b�w�ˮɰ��X�ܦn����ܡA�ר�b�B�z�ϺФ��� (Disk Partitioning) ���ɫJ�C �����I�O�A�|�ᱼ�w�ФW�Ҧ����F��C���M�A�]�i�H�⥲�n���ɮץ��ƥ��_�ӡA ���O�٭쪺�u�@�|��W�ܦh���ɶ��M�ߦ�C

�ĤG�ؤ�k�O�������� Windows (��²��)�A�M��A��ťX�Ӫ��Ŷ����� Linux �ΡC �]�N�O���A�u���s���Ρv(Repartition)�A�o�D�����I�x���A�������]���h�C ���n�B�O�A���t�η|�M�q�e���@�Ҥ@�ˡA�u�O�h�F�ܦh�Ŷ��C�ӥB�p�G�A�S�����\�A �A�٬O�i�H�βĤ@�ؤ�k�A�աC�H�U�ڤ��ЧڥΪ���k�A ���Ӹ`�i��|�M�A���t�Φ��@�ǥX�J�C�٦��@�I�A�p�G�A���@�i�źϺСA �A�i�H���⭫�n���ɮ׳ƥ���o�i�ϺФW�A�A���s�w�ˡC �ڷQ�o�O�@�ظ��w������k�A�B���G�]����z�Q�C �ڬO���ɮ׳ƥ���@�i 1.44 Mb ���Ϥ��W�C ���ަp��Ʊ�H�U����k���Ǫ̯঳�����U�C

�ڭn�P�� Olivier Tharan �b fr.col.moderated �W���^�H�A ���ʫH��O���媺��"�t�@"���C�٦� Finn bo Jorgensen �M Chomouel boudjnah �L�̪��^�H�C

 

�D�n�B�J

- �dzƤu�@: �ƥ��B�O�U���n���ɮסCŪ����g�峹�A�~��C(�аѷӲĤT�`)

- ���� Windows �C(�аѷӲĥ|�`)

- ���s���ΡA�������B�J�C(�аѷӲĤ��`)

 

�dzƤu�@

�����A�ƥ��Ҧ����n���ɮסC�ר�O�]�w�ɩM�A������ɮסC �H�U�ڤ��A���СC

�̭��n���@�B�O�F�ѧA�쩳�n��򰵡C�����ϥΨ쪺���O�M�ɮץu�@�@�Ǹѻ��C �̦n�O�� man Ū�@Ū�o�ǫ��O������: fdisk, mk2ext, cp (�Z��Ϊ����O), lilo, lilo.conf �M fstab (���~�٦��@�dz]�w�ɪ� man ����)�C Lilo ���ǫܸԺɪ�������b /usr/doc/lilo-0.20/doc �U(�]�t�ΦӲ�)�A �ӥB�٦��@�g���F 46 �����ϥλ����ѡC���� fdisk �����㻡���h�O��b /usr/doc/util-linux-2.7/README.fdisk�C �g�o�g�峹���ɫJ���ٵo�{�F�@�g�ܦ��Ϊ� mini-HOWTO: �w�Фɯ� Mini How-To (Hard Disk Upgrade Mini How-To)�C

�Ĥ@�B�A���U�O�ڪ��ϺФ��Ϊ� (Partition Table):

   [olivier@snoopy  olivier]# /sbin/fdisk -l         (�ζW�ŨϥΪ� su ������)

   Disk /dev/hda: 128 heads, 63 sectors, 788 cylinders
   Units = cylinders of 8064 * 512 bytes

      Device Boot  Begin   Start     End  Blocks  Id System
   /dev/hda1   *       1       1     397 1600672+  c Unknown
   /dev/hda2         398     398     601  822528  83 Linux native
   /dev/hda3         602     602     627  104832  82 Linux swap
   /dev/hda4         628     628     788  649152  83 Linux native

�ڭ̥i�H�ݨ� Windows ��b hda1 �W�Cfdisk �q�`���|�� FAT32 �����ΰϬݦ� <<Unknown>> (����)�C�ڪ� Linux �֤� (Kernel, 2.0.34 ��) ���D���s�� FAT32�A�� fdisk �o�����D�C���U�O df ���O����X�A�i�H�o�{ /dev/hda1 ���T�i�H�Q Linux �ϥΡC

    [olivier@snoopy olivier]# df

    Filesystem        1024-blocks    Used   Available  Capacity  Mounted on
    /dev/hda2            796065    506992      247947     67%    /
    /dev/hda4            628351    226366      369528     38%    /home
    /dev/hda1           1594456    850420      744036     53%    /mnt/dos

�A�o�ק��ӳ]�w�� /etc/fstab �M /etc/lilo.conf �A���̬ݰ_�Ӧ��I�����U����X�C

    [olivier@snoopy olivier] less /etc/fstab

    /dev/hda2          /                 ext2         defaults        1 1
    /dev/hda4          /home             ext2         defaults        1 2
    /dev/hda3          swap              swap         defaults        0 0
    /dev/fd0           /mnt/floppy       ext2         user,noauto     0 0
    /dev/cdrom         /mnt/cdrom        iso9660      user,noauto,ro  0 0
    none               proc              proc         defaults        0 0
    /dev/hda1          /mnt/dos          msdos        user,noauto     0 0
    [olivier@snoopy olivier] less /etc/lilo.conf

    boot=/dev/hda
    map=/boot/map
    install=/boot/boot.b
    prompt
    timeout=500
    image=/boot/vmlinuz-2.0.34-1
            label=linux
            root=/dev/hda2
            read-only
    other=/dev/hda1
           label=dos
           table=/dev/hda

 

���s�إ� Windows ���w�Ф��ΰ�

�q�{�b�_�A�@�w�o�� root �������ާ@�C�ڤר��ij�A�� root �n�J(�O�� su)�C �p�G�A�Ϊ��O vi �s�边�A�A�i��n�U w! ���O�~��s�ɡC ��ij�A�b�C�^�s�ɧ���A�ˬd�O�_�ק�L���ɮׯu���Q�s�_�ӤF�C (���}�s�边�� less ���O�Ӭd��)

�A�{�b�n�� fdisk �M mke2fs ��ӫ��O�C�o�ǥi�H�b�w�ЩάO�䥦�x�s�C��W�ΡC �b�ϥΫe�̦n�O���n�s�� (mount) �n�ק諸���@�Ӥ��ΰϡC�Ьݩ��U���T�ӨB�J:

- �p�G�A�n�����ΰϤw�g�Q�s���W�F�A�� umount ���O�Ӥ����A�p: umount /mnt/dos

- �Ұ� fdisk�C�� hda1 �����ΰ����O (System Id)�C �ڭ̲{�b�i�D fdisk �o�Ӥ��ΰϭn�令�� Linux �ۦ������ΰ� (Linux Native Partition)�C �� t ���O (t, 1, 83)�ӭק�C�A�� p ���O�Ӭd�ݡC �ߤ@���P���a��O Unkown �{�b�ܦ��F linux native �٦� System Id �{�b�ܦ��F 83�C�̫�A�� w ���O�x�s�M���}�C �� fdisk -l ���O�A�ݤ@���C���}�ɧڹJ��H�U�����~�T��:

   The partition table has been altered!
       Calling ioctl() to re-read partition table.
       Syncing disks.
       Re-read table failed with error 16: Device or resource busy.
       Reboot your system to ensure the partition table is updated.

���ڤ��z�|���ҥH�S�����s�}���C

- �榡�� (Format): mke2fs /dev/hda1�C �A�|���ݨ��ܦh�Ʀr�b���ʡA�M��N�A�]������ Windows �F! �A�]�i�H�b mke2fs ��[�W -c �� �ѼơA�o�˥i�H���K�ˬd�w�Ц��S���l�a���a��C

�n��! Windows �S��! ���ڨä��O�ܱƥ� Win98 (���Q�� Microsoft)�A�u�O�ܳ��w Linux...

 

�ϥηs�����ΰ�

�n�F�A�{�b�ڦ��@�� 1.5 Gb ���ťդ��ΰϡA�ڥ���� 600 Mb ���Ӱ� /home �A 800 Mb �� / �M 100 Mb ���洫�� (Swap partition)�C�ڧ� /home/myaccount �� 100Mb ����� ���� /usr/local �A�� /usr/local �d�b hda2 �W�A�� / ���� hda1 �W:

   Filesystem      1024-blocks  Used   Available Capacity Mounted on
   /dev/hda1        1600672    465000   1130672     29%    /
   /dev/hda2         796065    110000    696065     13%    /usr/local 
   /dev/hda4         628351     40739    587612      6%    /home

�����ڥΦn�X�~�F....

�ӧڤW�����p���A�ڱo���� hda1 �s���_�Ӥ~��C�@��N�s���� /mnt �Y�i�C

- �b /mnt ���U�A�ؤ@�� tmp �����ؿ� (sub-directory) �C�ӳs�� hda1: mkdir/mnt/tmp.

- �s�� hda1 �� /mnt/tmp : mount -t ext2 /dev/hda1 /mnt/tmp (-t ext2 ���w�ɮרt�Ϊ�����)�C

- �ƻs / �� /mnt/tmp/ ���O�d�ؿ����c: cp -ax / /mnt/tmp/�C-a �ѼƦb man �����̸�����: <<Preserve as much possible of the structure and attributes of the original file in the copy. The same as -dpR>> �Цۦ�Ѧ� cp �� man �����C-x �Ѽƫ��w���n��M�{�b�Ҧb��m���P�����ΰϤ]�]�A�i�ӡC �H�ڬ��ҡA�o�˴N���|�� /home �@�_�ƻs�F�C��ӽƻs�L�{�b�ڪ� AMD K6 266 �W��F 15 �����C �ҥH�A�i�H���h�ܪM�@�ةΫ¤h�ҦA�^�ӡC

- ���o�˰��٬O���@�Ǧa�褣����A�]�� -x �Ѽƪ����Y����ӥؿ��S���Q�ƻs�i�ӡA /home �M /proc�C�ҥH�{�b�ڭ̭n�b�s�����ΰϤW�إ߳o��ӥؿ�: mkdir /mnt/tmp/home �M�� mkdir /mnt/tmp/proc �o��ӥؿ��@�w���i�|���A�o�� /home (�b hda3 �W) �M /proc �H��~�i�H�Q�s���W�C

�{�b��������O�ڭ̱o�ק� fstab �M lilo.conf �ɮסA���s�}���� Lilo �M Linux �����~���D / �b���̡C�`�N�A�ڭ̥����ק� /mnt/tmp/etc/ �U�� fstab �Ӥ��O /etc �U���C �]���s���t�Φb /mnt/tmp �U�C���O�b���s�}���e�ڭ̥������s�w�� Lilo (�p�G�A�� �� Lilo ����)�C�{�b�����ק� /etc/ �U�� lilo.conf �]���ڭ̲{�b �N�n���� lilo ���O�ӭ��s�w�� Lilo�C�M��A�� /etc/lilo.conf �ƻs��s�����ΰ� /mnt/tmp/etc�C �Ϊ̧A�i�H�����ק� /mnt/tmp/etc/lilo.conf �M��b���� lilo ���ɭԥ[�W -C ���ѼƧi �D lilo �A���]�w�ɤ��O�b /etc/lilo.conf �ӬO�b /mnt/tmp/etc/lilo.conf ���C�ڥܽd�� �O�ĤG�ؤ�k�C

- /mnt/tmp/etc/fstab

�o���ɮ׫��ܨt�Φb�ҨϪ��ɫJ�p��s�����P�����ΰϡC�ڭ̲{�b�Q�� / �s���� hda1 �W�A�ҥH�n�p�U�ק�C���ڭ̤��i�H����� / �s���I! �ҥH�ڧ� /dev/hda2 �� ���s���� /mnt/tmp�C�䥦�a��h�S�ܡC

    /dev/hda1        /                ext2     defaults         1 1
    /dev/hda2        /mnt/tmp         ext2     defaults         1 2
    /dev/hda4        /home            ext2     defaults         1 3
    /dev/hda3        swap             swap     defaults         0 0
    /dev/fd0         /mnt/floppy      ext2     user,noauto      0 0
    /dev/cdrom       /mnt/cdrom       iso9660  user,noauto,ro   0 0
    none             /proc            proc     defaults         0 0

- /mnt/tmp/etc/lilo.conf.

lilo.conf �O lilo ���]�w�ɡAlilo �O��b MBR (�Ұʺϰ�) ���}���޲z�{���C �ڤ��Q���O�g�T���� MBR�C�p�G���H�٦b�� Loadlin �Υγn�ж}���A�ڱj�P��ij���� lilo �A�]���ڭ̪��t�ΤW loadlin �w�g�S�ΡA�ӥB�o�~�Y���٥γn�Ф��Ӷ}���O? �ڭ̧i�D lilo Linux ���֤� (Kernel) �{�b�O�b hda1 �W (�쥻�O hda2) �٦��ڭ� �o�R���Ҧ����� Windows ���]�w�C

     boot=/dev/hda
     map=/boot/map
     install=/boot/boot.b
     prompt
      timeout=500
     image=/boot/vmlinuz-2.0.34-1
           label=linux
           root=/dev/hda1
           read-only

- ���� lilo: /sbin/lilo -v -C /mnt/tmp/etc/lilo.conf. -v �i�D lilo �����Ժɪ���X�C �o�����ӨS�����󪺿��~�T���A�]���ڭ̭n���s�ҰʩҥH�@�w����ǿ��C lilo ���T���p�U:

    LILO version 20, Copyright 1992-1997 Werner Almesberger
    Reading boot sector from /dev/hda
    Merging with /boot/boot.b
    Boot image: /boot/vmlinuz-2.0.34
    Added linux *
    /boot/boot.0300 exists - no backup copy made.
    Writing boot sector.

- ���s�}���A�A���@�Ǥp���� (df, fdisk -l) �ݬ��ɮרt�άO���O�M�ڭ̫��w���ŦX�C

- �� /mnt/tmp ���U (hda2) �Ҧ����F��R����: (�b /mnt/tmp �U) rm -rf *

���ӥ��e���w�ơA�ڭ̦A�� cd ������ /usr/local �U�A�ƻs�Ҧ��ɮר� /usr/tmp: cp -a * /mnt/tmp

���ҬO�_�@�����Q�A�A�R�� /usr/local: (�b /usr/local �U) rm -rf * �A�`�N���i�H�R�� /usr/local �o�ӦW�r�C

- �A�s�� /etc/fstab �A�ק�ĤG��:

     /dev/hda2    /usr/local          ext2    defaults       1 2

- ���s�}���A�A���աC

�j�\�i��! �i�D�A�ڷ��ɫD�`�����N�A�ר�O�Ҧ����{����ӳ��ॿ�`���u�@!

 

���D

�ƹ�W�ڦb��@�ɹJ��F�@�ǰ��D�C���ګ�ij�A�h�F�ѳo�ǨB�J�A�ҥH�b�A�J����D�� �ɭԧA�i�H�յۦۦ�ѨM�COlivier Tharan ��ij�ڭ��s�Ұʨ��H�Ҧ��� (Single-user mode) ���ڰ��i�Ӹ��L�o�@�`�C�̦n��b���s�Ұʫe�dzƤ@�i�}���Ϥ� (���ڤ����D����)�C

���U�O�ھD�J�쪺���D�C�b�Ĥ@�����s�}����A�ڪ� /home �M /proc �S���Q�s���i�ӡA �����n�n�J�t�Τ������D�A�ҥH�ڻ��֥�:

    [root@snoopy root]$ df
     Filesystem      1024-blocks    Used   Available  Capacity  Mounted on
     /dev/hda1          1548535   506977    961525     35%       /
     /dev/hda2           796065   506992    247947     67%       /mnt/tmp

/home �S���Q�s���i�ӡA�ҥH�ڸյۥ� mount /home �A�� mount �o���: <<mount: mount point /home does not exist>> �ڤ~�oı�ڨS�F�Ѥ���s"�s���I" (Mount Point) �Ӻ|�Fcp �� -x ���ѼơC �ҥH�ڭ��s�إߤF /home �M /proc ��ӳs���I�A���G�~�M�e���ұԭz���@�ˡC


 

�ѦҸ��

  • man ����: fdisk, mk2ext, cp, mv, rm, lilo, lilo.conf, fstab
  • /usr/doc/lilo-0.20/doc/User_Guide.ps
  • /usr/doc/util-linux-2.7/README.fdisk
  • Hard Disk Upgrade Mini How-To (�w�Фɯ� Mini How-To)
  • ���H�k��g���A�^��½Ķ Paul Kienzle�A����½Ķ ������

    �������@�GLinuxFocus �s���
    © Olivier Chapuis
    LinuxFocus 1999

    1999-08-03, generated by lfparser version 0.6.1