4. File Systems, Disks, and Drives

Q: How Can I Get Linux to Work With My Disk?
Q: How Do I Undelete Files?
Q: How Do I Make Backups?
Q: How Do I Resize a Partition Non-Destructively?
Q: Is There a Defragmenter for Ext2fs?
Q: How Do I Create a File System on a Floppy?
Q: Does Linux Support Virtualized File Systems Like RAID?
Q: Does Linux Support File System Encryption?
Q: What are these Nasty Messages about Inodes, Blocks, and the Like?
Q: Why Isn't My Virtual Memory Swap Area Working?
Q: How Do I Add Temporary Swap Space?
Q: Can I Remove LILO So the System Boots DOS Again?
Q: Why Does fdformat Require Superuser Privileges?
Q: Why Does the System Check the Ext2fs Partitions Each Reboot?
Q: Why is My Root File System Read-Only?
Q: What Is [/proc/kcore]?
Q: Why Doesn't the AHA1542C Card Work With Linux?
Q: Where Is the Journalling File System on the Net?

A: The lilo program (not the complete LILO package), uses the command line option -u to uninstall the LILO boot loader. You have to supply the device name of the device you installed LILO on, for example:

 lilo -u /dev/hda

This rewrites the original, pre-LILO master boot record back to the first hard drive, from the boot record saved in [/boot/boot.0300]. If you installed LILO to a partition as a secondary boot loader, for example, [/dev/hda1], lilo re-installs the original boot sector from the save file [/boot/boot.0301]. Refer to the lilo manual page for details. Thanks to Villy Kruse for reminding me to update this answer.

If you have an earlier version of LILO, you will have to use the DOS (MS-DOS 5.0 or later, or OS/2) FDISK /MBR (which is not documented). This will overwrite the lilo boot loader with a standard MS-DOS Master Boot Record. If you have DR-DOS 6.0, go into [FDISK.EXE] in the normal way and then select the Re-write Master Boot Record option.

If you create a boot floppy during the Windows installation process, make sure that it contains the programs FDISK.EXE, FORMAT.COM, and SYS.COM, and use that to re-install MS-DOS on the hard disk.

If you don't have MS-DOS or DR-DOS, you need to have the boot sector that LILO saved when you first installed it. You did keep that file, didn't you? It's probably called [boot.0301] or some such. Type:

 dd if=boot.0301 of=/dev/hda bs=445 count=1

(or [/dev/sda] if you're using a SCSI disk). This may also wipe out your partition table, so beware! If you're desperate, you could use

 dd if=/dev/zero of=/dev/hda bs=512 count=1

This will erase your partition table and boot sector completely: you can then reformat the disk using your favorite software. But this will render the contents of your disk inaccessible you'll lose it all unless you're an expert.

Note that the DOS MBR boots whichever (single!) partition is flagged as "active." You may need to use fdisk to set and clear the active flags on partitions appropriately.

A: To understand how you got into this state, see, (``EXT2-fs: warning: mounting unchecked file system'')

Remount it. If [/etc/fstab] is correct, you can simply type:

 mount -n -o remount /

If [/etc/fstab] is wrong, you must give the device name and possibly the type, too: e.g.

mount -n -o remount -t ext2 /dev/hda2 /