≡ Menu

hard disk

Q. My Linux system says LI while booting system and then boots procedure freezes or halts. How do I solve this problem?

A. LILO is a generic boot loader for Linux. This error means few things. LI characters indicate that LILO is having problems. It cannot boot the system.

a) Goto BIOS and set LBA mode for hard disk and reinstall Linux

b) Make sure /boot partition created below the 1023rd cylinder on the hard drive, if not repartition and reinstall Linux

c) See this page for more information.

Linux: How to delete a partition with fdisk command

Q. My system comes with pre installed Linux and XP. Now I would like to delete a partition. How do I delete a partition?

A. Hard disks can be divided into one or more logical disks called partitions. This division is described in the partition table found in sector 0 of the disk.

You need to use fdisk command. It is a menu driven program for creation and manipulation of partition tables. However this program needs the device name (hard disk name) to manipulate partitions. Usually you use following names
/dev/hda
/dev/hdb
/dev/sda
/dev/sdb

So,
=> /dev/hd[a-h] for IDE disks
=> /dev/sd[a-p] for SCSI disks
=> /dev/ed[a-d] for ESDI disks
=> /dev/xd[ab] for XT disks.

A device name refers to the entire hard disk. For more information see Linux partition naming convention and IDE drive mappings.

Before typing any one of the following command(s) make sure you have the backup of important data.

First, get a listing of your current partition scheme, type the following command:
# fdisk -l.
Output:

Disk /dev/hda: 20.0 GB, 20060651520 bytes
255 heads, 63 sectors/track, 2438 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/hda1               1        1024     8225248+   b  W95 FAT32
/dev/hda2   *        1025        2438    11357955    c  W95 FAT32 (LBA)
Disk /dev/hdb: 80.0 GB, 80060424192 bytes
255 heads, 63 sectors/track, 9733 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/hdb1   *           1        2432    19535008+  83  Linux
/dev/hdb2            2433        2554      979965   82  Linux swap / Solaris
/dev/hdb3            2555        6202    29302560   83  Linux
/dev/hdb4            6203        9733    28362757+   5  Extended
/dev/hdb5            6203        9733    28362726   83  Linux

From above output I have two hard disks:
=> /dev/hda - 20 GB
=> /dev/hdb - 80 GB

Let us assume that you want to remove a partition from /dev/hdb disk. Type the following command:
# fdisk /dev/hdb
Output:

The number of cylinders for this disk is set to 9733.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
Command (m for help):

Now type p command to list partition:
Command (m for help): p
Output:

Disk /dev/hdb: 80.0 GB, 80060424192 bytes
255 heads, 63 sectors/track, 9733 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/hdb1   *           1        2432    19535008+  83  Linux
/dev/hdb2            2433        2554      979965   82  Linux swap / Solaris
/dev/hdb3            2555        6202    29302560   83  Linux
/dev/hdb4            6203        9733    28362757+   5  Extended
/dev/hdb5            6203        9733    28362726   83  Linux

Now let us say you want to delete /dev/hdb3 (3rd partition). Type the d command to delete a partition:
Command (m for help): d
Partition number (1-4): 3

It will prompt you for the partition number. Type 3:

Verify that partition deleted:
Command (m for help): p

Now save the changes and exit to shell prompt. Type the w command:
Command (m for help): w

Reboot the system.

How do I find out my installed hard disk size in Linux or UNIX like operating systems?
[click to continue…]

Q. I have two disk-mirrored array, suppose if one of my disk in mirrored RAID array fails, then I will replace that disk with new one (I have hot swapping SCSI drives). Now question is how I rebuild a RAID array after a disk fails.

A. A redundant array of inexpensive disks, (redundant array of independent disks) is a system, which uses multiple hard drives to share or replicate data among the drives. You can use both IDE and SCSI disk for mirroring.

If you are not using hot swapping drives then you need to shutdown server. Once hard disk has been replaced to system, you need to use used raidhotadd to add disks from RAID-1, -4 and -5 arrays, while they are active.

Assuming that new SCSI disk is /dev/sdb, type the following command:# raidhotadd /dev/mdX /dev/sdbReplace /dev/mdX with actual raid device name (e.g. /dev/md0). While array is under construction, you can see progress and other information by typing following command:# cat /proc/mdstat

See also:

MySQL error 28 and solution

Q. I am getting an error that read as follows:

MySQL: got error 28 from server handler

How do I fix this problem?

A. This error means no space left on hard disk. According to official MySQL docs, "If you get his error, you need to check all filesystems where MySQL operates. It may be single filesystem or as we recommend you can have datadir, tmpdir and log files split into dedicated filesystems."

Solution

a) Stop mysql server
# /etc/init.d/mysql stop
OR
# /etc/init.d/mysqld stop
b) Check filesystem and /tmp directories:
$ df -h
$ cd /tmp
$ df -h /tmp

c) Remove files from /tmp to free up space:
# cd /tmp
# rm -rf *

d) Look into /var/log directory and remove or compress logs file.

e) Use myisamchk command to check and repair of ISAM table:
# cd /var/lib/mysql
# myisamchk

f) Increase disk space (add new hard disk or remove unwanted software(s) )

g) Start the mysql server:
# /etc/init.d/mysql start
OR
# /etc/init.d/mysqld start

Q. I am new to Linux and I not able to understand /dev/hdc (is it C: drive?) under Linux. This is quite confusing for a new Linux user like me. What device naming convention followed by Linux? Can you explain it in layman's term?
[click to continue…]

HowTo: Formatting Linux Filesystem

How do I format Linux file system? Can you tell me command names to format and create a Linux file system?
[click to continue…]