Commands

Commands

badblocks

[ -b block-size ] [ -o output_file ] [ -s ] [ -v] [ -w ] device blocks-count [ start-block ]

This command is used to search for bad blocks on a hardware device. You should specify the device (e.g., /dev/hda1) and the count of the number of blocks on the device.

Example: To check /dev/hda1 for bad blocks, use

badblocks /dev/hda1 3096

-b block-size

Specify the size of blocks in bytes.

-o output_file

Specify a file to which the list of bad blocks is output. Default is to display to standard out.

-s

Progress indicator. Display the block numbers as they are checked.

-v

Verbose output.

-w

Write-mode test option: badblocks will write a few bytes to each block and then read them back in to verify that everything worked. Of course, this will overwrite data already on the block, so be careful.

cfdisk

[ -avz ] [ -c cylinders ] [ -h heads ] [ -s sectors-per-track ] [ -P opt ] [ device ]

This is an interactive, (ascii) graphic program for partitioning a hard drive. It works as follows:

1.       It tries to read the geometry of the hard disk.

2.       It looks for a current partition table.

graphics/tip.gif

When attempting to partition a SCSI drive on an adapter without a BIOS, you should set the cylinders, heads and sectors-per-track on the command line.

 

Example: This command is interactive. When invoked, you see a screen similar to the following:

cfdisk

  cfdisk 0.8l
 
  Disk Drive: /dev/hda
  Heads: 240  Sectors per Track: 63  Cylinders: 832
 
  Name  Flags  Part Type  FS Type  [Label]  Size (MB)
-----------------------------------------------------------------------------
  hda1  Boot  Primary  DOS FAT16 (big)  [NO NAME  ]  2997.43
  hda5  Logical  Linux ext2  214.11
  hda6   Logical  Linux ext2  1638.99
  hda7  Logical  Linux ext2  302.70
  hda8  Logical  Linux ext2  103.36
  hda9  Logical  Linux ext2  819.50
  hda10  Logical  Linux Swap  66.45
 
 
  [Bootable]  [ Delete ]  [  Help  ]  [Maximize]  [ Print  ]
  [  Quit  ]  [  Type  ]  [ Units  ]  [ Write  ]

The following keys are active for the preceeding screen:

b

Toggle the bootable flag of the current partition.

d

Delete the selected partition.

g

Alter the disk geometry. Warning: this option, even more than most in this section, is dangerous.

h

Display the help screen.

m

Maximize the usage of the current partition by recovering the unused space between the partition table and the beginning of the partition.

n

Create a new partition. You will be prompted for size and (assuming that the new partition doesn't use up all of the available free space) whether to put the new partition at the beginning or the end of the free space.

p

Print the partition table to the screen or a file. Output is in one of the following forms:

r Raw data exactly what would be written to disk.

s Partition table in sector order format.

t Partition table in raw format.

q

Quit program without saving changes.

t

Change the filesystem type.

u

Toggle units of the partition size display (megabytes, sectors, cylinders).

W

Save changes to disk.

Up Arrow, Down Arrow

Highlight the previous or next partition.

CTRL-L

Redraw the screen.

?

Display the help screen.

Command Line Options

-a

Tells cfdisk to use an arrow cursor rather than highlighting.

-v

Display version information.

-z

Invoke cfdisk with zeroed partition table.

-c

Specify a number of cylinders.

-h

Specify a number of heads.

-s

Specify the number of sectors-per-track.

-P [r|s|t]

Display the partition table in raw, standard, or table formats.

du

[OPTION] [FILE]

With no arguments, "du" reports the disk space used by the current directory. The output is in 1024-byte units by default, unless the environment variable "POSIXLY_CORRECT" is set, in which case 512-byte blocks are used (unless "-k" is specified).

Example: To display disk usage information for all files in the filesystem, not just the directories (-a option), use

du -a /

Example: Suppose your /whatever filesystem fills up. To sort the files by size in order from largest to smallest, use

du -a /whatever | sort -rn | less

Usually, this will give you a good idea of which files are choking you.

-a, --all

Include all files in output, rather than just directories.

-b, --bytes

Output file size in bytes rather than kilobytes.

-c, --total

Display totals after processing.

-D, --dereference-args

Dereference symbolic links.

-h, --human-readable

Append a size letter to the end of each quantity displayed. (M=megabytes, K=kilobytes, )

-k, --kilobytes

Display size in kilobytes.

-l, --count-links

Count the size of all files even if they have already been counted as a hard link.

-L, --dereference

Dereference symbolic links.

-m, --megabytes

Display size in megabytes.

-s, --summarize

Display totals only for each argument.

-S, --separate-dirs

When outputting the size of a directory, do not include the size of any subdirectories it may have.

-x, --one-file-system

Limit processing to the current filesystem.

fdformat

[ -n ] device

Perform a low-level format on a floppy disk. The major device number is 2. The device is usually one of the following, (NOT /dev/fd0 or /dev/fd1):

/dev/fd0d360 (minor = 4)

/dev/fd0h1200 (minor = 8)

/dev/fd0D360 (minor = 12)

/dev/fd0H360 (minor = 12)

/dev/fd0D720 (minor = 16)

/dev/fd0H720 (minor = 16)

/dev/fd0h360 (minor = 20)

/dev/fd0h720 (minor = 24)

/dev/fd0H1440 (minor = 28)

/dev/fd1d360 (minor = 5)

/dev/fd1h1200 (minor = 9)

/dev/fd1D360 (minor = 13)

/dev/fd1H360 (minor = 13)

/dev/fd1D720 (minor = 17)

/dev/fd1H720 (minor = 17)

/dev/fd1h360 (minor = 21)

/dev/fd1h720 (minor = 25)

/dev/fd1H1440 (minor = 29)

Example: To format a high density floppy in the disk drive, use

fdformat /dev/fd0H1440

graphics/tip.gif

To make /dev/fd0 or /dev/fd1 work with this command, you must first run setfdprm.

 

-n

Do not verify.

fdisk

[-b] [-u] [device]

fdisk

-l [-b] [-u] [device ]

fdisk

-s partition

fdisk

-v

The fdisk command is used to modify a hard disk's partition table. The command is menu driven, and the following options apply:

graphics/tip.gif

You'd probably be happier using cfdisk.

 

Example: To invoke fdisk on /dev/hda, use

fdisk /dev/hda

Once invoked, fdisk is interactive. The following keys are used:

a

Toggle bootable (y/n) flag on the current partition.

d

Delete current partition.

l

List partition types.

m

Display menu.

n

Create a new partition.

p

List all current partitions.

q

Quit without saving changes.

t

Modify type of current partition.

u

Toggle unit of entry between cylinders and sectors.

v

Verify current partition table.

w

Write changes to disk.

-v

Display version information and exit.

-l

List partition tables and exit.

-b

Include a "Begin" column in the partition table listing.

-u

List the partition table sizes in sectors rather than cylinders.

-s partition

Display partition size (in blocks).

quota

[ -guv | q ]

quota

[ -uv | q ] user

quota

[ -gv | q ] group

Display disk usage and limit information for the specified user or group.

Example: To display disk usage quotas for the user Mary, use

quota mary

-g

Display quotas for the group of which the user is a member.

-u

Display user quotas (same as default).

-v

Display quotas on filesystems where no storage is allocated.

-q

Display information only on filesystems where usage is over quota.

setfdprm

[ -p ] device name

setfdprm

[ -p ] device size sectors heads tracks stretch gap rate spec1 fmt_gap

setfdprm

[ -c ] device

setfdprm

[ -y ] device

setfdprm

[ -n ] device

Set parameters on a floppy disk as specified by the user or, without any options, as found in /etc/fdprm.

Example: To set the parameters as previously specified in /etc/fdprm:

setfdprm /dev/fd0 floppy

-pdevice name

Load a new parameter set for the specified device.

-cdevice

Clear the parameters of the specified device.

-ydevice

Enable format detection messages for the specified device.

-ndevice

Disable format detection messages for the specified device.

 



Linux Desk Reference
Linux Desk Reference (2nd Edition)
ISBN: 0130619892
EAN: 2147483647
Year: 2000
Pages: 174
Authors: Scott Hawkins

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net