⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 linux-fdisk.html

📁 Linus guide, Linus guide, Linus guide,
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"><BASE TARGET="_top"><HTML><HEAD><TITLE>Josh's Linux Guide - Modifying Your Partitions and Help on LILO</TITLE>   <META NAME="Description" CONTENT="How to modify partitions under Linux and fiddling with LILO, the LInux LOader.">   <META NAME="keywords" CONTENT="beginners, Linux, help, #LinuxHelp, LILO, bootloader, lilo.conf, LI"></HEAD><LINK REL="stylesheet" TYPE="text/css" HREF="default.css"><BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#7F007F"><H2><A NAME="0">Modifying Your Partitions and Help on LILO</A></H2><FONT SIZE="-1"><B>Last updated: September 9, 1999</B></FONT><P>If you were really careful during installation (or can predict howmuch hard drive space you'll need later on), you might not need toread this, but if you suddenly decided or found out that you want toextend your partitions, shrink or extend your swap space, added a newhard drive, or something of that sort, I'll explain how to do thosethings for you right here.</P><P>First, type <TT><B>fdisk</B></TT> when you're <B>root</B> at theLinux prompt. You might remember this from installation, when you weresetting up your partitions for Linux to use.</P><P>You probably also want to be able to boot any new partitions usingLILO (if you're <I>using</I> LILO). First you have to edit<TT>/etc/lilo.conf</TT> so that LILO will know which partitions arethere to boot. As of now I still haven't figured out everything aboutLILO, but it would help to take a look at your <TT>lilo.conf</TT> andfigure it out to an extent; you can also read the lilo.conf manualpage by typing <TT>man 5 lilo.conf</TT>. The first entry put down isthe one LILO will boot if you just press 'enter' or leave it alone. Onmy system, I have LILO boot Linux on default and boot my Windows FATpartition when I type &quot;dos&quot;. Here's what my<TT>lilo.conf</TT> file looks like:</P><PRE>boot=/dev/hdamap=/boot/mapinstall=/boot/boot.bprompttimeout=50image=/boot/vmlinuz        label=linux        root=/dev/hda2        read-onlyother=/dev/hda1        label=dos        table=/dev/hda</PRE><P>After you edit <TT>/etc/lilo.conf</TT>, <B>don't immediatelyreboot</B>. Type <TT><B>lilo</B></TT> at the command prompt and see if itdisplays something like this (with no error message; if there is, thenedit <TT>lilo.conf</TT> until you get it right):</P><PRE>Added linux *Added dos</PRE><P>The asterisk (*) after <TT>linux</TT> shows that it boots Linux ifI don't enter anything or just press Enter. If you have more than twobootable partitions, then it should show whatever partitions youenabled in <TT>/etc/lilo.conf</TT>. Using the <TT>image</TT> label in<TT>lilo.conf</TT> is only for your Linux or Unix-based partitionswith boot images, and the label <TT>other</TT> is used for other typesof partitions.</P><P>The way it is set up as of now, it loads Linux on default. What ifyou want it to load to your DOS/Windows setup? Notice that the&quot;image&quot; block is there first. It loads whatever is therefirst, so if you switched the &quot;other&quot; block to be first,then it would load DOS/Windows on default. Let's say you wanted toboot into DOS/Windows first:</P><PRE>boot=/dev/hdamap=/boot/mapinstall=/boot/boot.bprompttimeout=50other=/dev/hda1        label=dos        table=/dev/hdaimage=/boot/vmlinuz        label=linux        root=/dev/hda2        read-only</PRE><P>Upon making that change and re-running <B><TT>lilo</TT></B> asroot, you would get the nice output of:</P><PRE>Added dos *Added linux</PRE><P>That indicates that, since the &quot;dos&quot; line had theasterisk, it is the one that will be booted into by default.</P><P>If you're like me, you may want to have many separate<TT>image</TT> entries in <TT>/etc/lilo.conf</TT> for the sake ofhaving an option to boot other kernels. This can be any valid Linuxkernel, such as previous versions, development versions (if you'rebrave), or differently configured versions of the same kernel. Itreally doesn't matter. (If you have no idea what I'm talkingabout in this paragraph, there is no need to worry.)</P><P>Another common problem people have with LILO is that the computerreads the hard drive, starts to display &quot;LILO&quot;, but thenstops when it only displays &quot;LI&quot;. A possible solution mightbe to add the line <TT>linear</TT> somewhere in /etc/lilo.conf; Iheard it's a disk geometry problem. If you have another solution tothis, I'd sure appreciate it if you shared it. So if that problemappears, you should boot a kernel using LOADLIN.EXE, which should beon your Linux distribution's CD-ROM, and a copy of the kernel (a filecalled vmlinuz).</P><P>I can't predict all the possible uses you might have, but I'll justlist some basic pieces of information you might want to use to format,repartition, and make swap space.</P><UL><LI>To format a new partition I've just made, I'd use <TT><B>mkfs -t ext2 /dev/hda4</B></TT>.</LI><LI>The syntax for formatting a new ext2 partition is <TT><B>mkfs -t ext2 &lt;full path to device&gt;</B></TT>.</LI><LI>To make new swap space, I'd use <TT><B>mkswap /dev/hda5</B></TT>.</LI><LI>The syntax for creating new swap space is <TT><B>mkswap &lt;full path to device&gt; [number of blocks]</B></TT>.</LI></UL><P>To make Linux mount a filesystem that you want automatically, youshould edit <TT>/etc/fstab</TT>. It is read each time you boot up Linux. Here's what mine looks like:</P><PRE>/dev/hda2               /                       ext2    defaults        1 1/dev/hda4		/usr/local/src		ext2	defaults 	1 1/dev/hda5               swap                    swap    defaults        0 0/dev/fd0                /mnt/floppy             ext2    noauto          0 0none                    /proc                   proc    defaults        0 0</PRE><P>The configuration I have is for Linux to mount my main partition(/dev/hda2) on <TT>/</TT>, mount my second ext2 Linux partition(/dev/hda4) to <TT>/usr/local/src</TT>, enable my swap space(/dev/hda5), and to mount the /proc filesystem to <TT>/proc</TT>(/proc contains information about your system and the hardware; it'snot part of the actual harddisk). When it says <TT>defaults</TT> Ithink it automatically mounts it to where you specified. The entriesare separated after each line.</P><H3><A NAME="1">Suggestions</A></H3><P><A HREF="mailto:stefan@inorbit.com">Stefan</A> had a suggestionabout the problem with LILO's tendency to sometimes only display the&quot;LI&quot;: &quot;<I>It's a little bit annoying if you've spent 2hor more on installing your Linux and then discovers that the LILOdoesn't work. I can't even count the hours I've spent to solve thisproblem. Then I finally discovered another solution. To be sure thatthis problem never occurs, I do a <TT>fdisk /mbr</TT> from awindows/dos boot diskette before installing my linux. In this way yourewrite the boot-table on your boot harddisk and the geometry-problem,or whatever it is, never occurs.</I>&quot;.</P><HR><P><B><FONT SIZE="-1">Copyright &copy; 1997-1999 <AHREF="mailto:jgo@local.net">Joshua Go(jgo@local.net)</A>. All rights reserved. Permission to use,distribute, and copy this document is hereby granted.  You may modifythis document as long as credit to me is given.</FONT></B></P></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -