Operating System - Linux
1752805 Members
5406 Online
108789 Solutions
New Discussion юеВ

Re: How to know which disk drive was added?

 
ben10_1
Regular Advisor

How to know which disk drive was added?

Hi Forum,

I am adding SCSI hard disk to a linux server.
How can I know and be sure which disk is added before I run the fdisk and Mkfs?
5 REPLIES 5
Steven E. Protter
Exalted Contributor

Re: How to know which disk drive was added?

Shalom,

fdisk -l


You might want to try providing your distribution of Linux and situation details to get more help.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Ivan Ferreira
Honored Contributor

Re: How to know which disk drive was added?

You can use:

dumpe2fs -h /dev/sdX

To identify if the disk already has a File System.

cat /etc/fstab

To identify the disks and their mount points

mount

To identify the disks and their mount point

swap -s

To identify disks used as swap

pvs/pvdisplay

To identify disks used by LVM

The only missing part here is to identify disks used without filesystem for example by Oracle. You must consult your DBA.

Normally from the output of:

fdisk -l

You would recognize your new disk as it would not have partition table, and the matching size.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
ben09
New Member

Re: How to know which disk drive was added?

So the best way is to do:

-fdisk -f before adding the scsi disk
-Note down the disk drive that exist
-Connect the disk
-fdisk -l to see what was added.

I am right? I guess this is the best way to go.
Matti_Kurkela
Honored Contributor

Re: How to know which disk drive was added?

When a new disk is detected, messages identifying the disk device are output to the kernel message buffer. You can use the "dmesg" command to view it.

If you have the "lsscsi" utility (available as an optional package in RHEL 5, probably other newer distributions too) and you know the SCSI device number of your new disk, you can find the device name easily in the lsscsi output.

http://sg.danny.cz/scsi/lsscsi.html

MK
MK
Steven Schweda
Honored Contributor

Re: How to know which disk drive was added?

> -fdisk -f before adding the scsi disk
> [...]

Or, if it's too late, then remove the actual
disk, and look for the apparent disk (device
special file) which you appear to have, but
which no program can talk to.