LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-01-2010, 09:36 AM   #1
maccas17
Member
 
Registered: May 2010
Location: UK
Distribution: RHEL6
Posts: 70

Rep: Reputation: 10
Adding and Using a New Disk - without rebooting


Hi,

I thought I had found a solution on the forum, but it doesn't seem to work - so I need a bit more help!

I'm running RHEL5:
2.6.18-164.el5 #1 SMP Tue Aug 18 15:51:54 EDT 2009 i686 i686 i386 GNU/Linux

under VMWare Server 2.0.2. When I create a new disk for my Linux VM I want to be able to use it without rebooting.

I checked what was currently in use:

cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
Vendor: VMware, Model: VMware Virtual S Rev: 1.0
Type: Direct-Access ANSI SCSI revision: 02
Host: scsi0 Channel: 00 Id: 01 Lun: 00
Vendor: VMware, Model: VMware Virtual S Rev: 1.0
Type: Direct-Access ANSI SCSI revision: 02
Host: scsi0 Channel: 00 Id: 02 Lun: 00
Vendor: VMware, Model: VMware Virtual S Rev: 1.0
Type: Direct-Access ANSI SCSI revision: 02


Also double-checked this with an ll /dev/disk/by-*

So I could see my new disk would be using HBA 0, channel 0, SCSI ID 2, and LUN 0. I would expect it to be /dev/sdd.

With the new 10MB disk created to the VM I issue:

echo "0 3 0" > /sys/class/scsi_host/host0/scan

This completes without error, but I do not have a /dev/sdd device file created for my disk.

Some dmesg output does seem to suggest the above command has worked and the disk has been found.

hdc: drive_cmd: status=0x51 { DriveReady SeekComplete Error }
hdc: drive_cmd: error=0x04 { AbortedCommand }
ide: failed opcode was: 0xec
Vendor: VMware, Model: VMware Virtual S Rev: 1.0
Type: Direct-Access ANSI SCSI revision: 02
target0:0:3: Beginning Domain Validation
target0:0:3: Domain Validation skipping write tests
target0:0:3: Ending Domain Validation
target0:0:3: FAST-40 WIDE SCSI 80.0 MB/s ST (25 ns, offset 127)
SCSI device sdd: 20480 512-byte hdwr sectors (10 MB)
sdd: Write Protect is off
sdd: Mode Sense: 5d 00 00 00
sdd: cache data unavailable
sdd: assuming drive cache: write through
SCSI device sdd: 20480 512-byte hdwr sectors (10 MB)
sdd: Write Protect is off
sdd: Mode Sense: 5d 00 00 00
sdd: cache data unavailable
sdd: assuming drive cache: write through
sdd: unknown partition table
sd 0:0:3:0: Attached scsi disk sdd
sd 0:0:3:0: Attached scsi generic sg3 type 0


If I reboot the system the disk is available and ready to use fine through the /dev/sdd device file.

Any ideas why the device file is not being created and how I can fix this?

Thanks.
 
Old 05-01-2010, 09:46 AM   #2
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 249Reputation: 249Reputation: 249
I would think that disks are assigned when udev runs at boot, so maybe running start_udev as root would do the trick.
 
1 members found this post helpful.
Old 05-01-2010, 10:02 AM   #3
TBC Cosmo
Member
 
Registered: Feb 2004
Location: NY
Distribution: Fedora 10, CentOS 5.4, Debian 5 Sparc64
Posts: 355

Rep: Reputation: 43
Try doing a partprobe -s after you rescan the scsi bus. I'm not able to test myself.
 
0 members found this post helpful.
Old 05-01-2010, 10:07 AM   #4
maccas17
Member
 
Registered: May 2010
Location: UK
Distribution: RHEL6
Posts: 70

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by smoker View Post
I would think that disks are assigned when udev runs at boot, so maybe running start_udev as root would do the trick.
Thanks for the response.

I just created another disk for this VM to test your suggestion and this time the device file is created automatically and the disk is available to use I'm more confused now!

I ran the same commands and saw the same output in syslog and dmesg.

Does anybody have experience of this not always working and if so, what to do (other than reboot!) in those circumstances?

Thanks.
 
Old 05-01-2010, 10:10 AM   #5
maccas17
Member
 
Registered: May 2010
Location: UK
Distribution: RHEL6
Posts: 70

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by TBC Cosmo View Post
Try doing a partprobe -s after you rescan the scsi bus. I'm not able to test myself.
When I did the test fdisk -l (which I think is the equivalent) it did not list this disk. If there is no device file, I'm not sure tools such as these can attempt to read partition information.
 
Old 05-01-2010, 10:20 AM   #6
TBC Cosmo
Member
 
Registered: Feb 2004
Location: NY
Distribution: Fedora 10, CentOS 5.4, Debian 5 Sparc64
Posts: 355

Rep: Reputation: 43
Quote:
Originally Posted by maccas17 View Post
When I did the test fdisk -l (which I think is the equivalent) it did not list this disk. If there is no device file, I'm not sure tools such as these can attempt to read partition information.
Fdisk provides the kernel's view of the partition table. Partprobe syncs the scsi midlayer changes witth the kernel. So no, they are not equivalent.

Since your new disk was visible to the scsi mid layer (/proc/scsi/scsi) it seemed to me that this could work. But it seems there is some flaky behavior from your description
 
1 members found this post helpful.
Old 05-01-2010, 10:35 AM   #7
maccas17
Member
 
Registered: May 2010
Location: UK
Distribution: RHEL6
Posts: 70

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by TBC Cosmo View Post
Fdisk provides the kernel's view of the partition table. Partprobe syncs the scsi midlayer changes witth the kernel. So no, they are not equivalent.

Since your new disk was visible to the scsi mid layer (/proc/scsi/scsi) it seemed to me that this could work. But it seems there is some flaky behavior from your description
Thanks for highlighting this difference to me; so I guess fdisk -l just reports the contents of /proc/partitions

Whilst, partprobe -s, as per the man page will:

"partprobe is a program that informs the operating system kernel of partition table changes, by requesting that the operating system re-read the partition table."

So from what you're saying and the man page info above the difference is that the OS will re-read disk partitions to re-populate the kernels view with the latest data - would this then have udev create device files for devices with no entries?

In other Unix flavours there are specific commands to create new device files for new hardware (aside from mknod), such as insf in HP-UX. Is there any equivalent for RHEL?
 
1 members found this post helpful.
Old 05-01-2010, 11:00 AM   #8
TBC Cosmo
Member
 
Registered: Feb 2004
Location: NY
Distribution: Fedora 10, CentOS 5.4, Debian 5 Sparc64
Posts: 355

Rep: Reputation: 43
Try this

I've had mixed results with this scsi-rescan script - attached. But it worked just now in esxi 4


Code:
[root@cent5-vm1 ~]# cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: VMware   Model: Virtual disk     Rev: 1.0 
  Type:   Direct-Access                    ANSI SCSI revision: 02
[root@cent5-vm1 ~]# fdisk -l

Disk /dev/sda: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14         652     5132767+  8e  Linux LVM
[root@cent5-vm1 ~]# vim scsi_rescan.sh
[root@cent5-vm1 ~]# chmod 755 scsi_rescan.sh 
[root@cent5-vm1 ~]# ./scsi_rescan.sh 
Host adapter 0 (mptspi) found.
Scanning hosts  0 channels 0 for 
 SCSI target IDs  0 1 2 3 4 5 6 7 , LUNs  0
Scanning for device 0 0 0 0 ...
OLD: Host: scsi0 Channel: 00 Id: 00 Lun: 00
      Vendor: VMware   Model: Virtual disk     Rev: 1.0 
      Type:   Direct-Access                    ANSI SCSI revision: 02
Scanning for device 0 0 1 0 ...
NEW: Host: scsi0 Channel: 00 Id: 01 Lun: 00
      Vendor: VMware   Model: Virtual disk     Rev: 1.0 
      Type:   Direct-Access                    ANSI SCSI revision: 02
1 new device(s) found.               
0 device(s) removed.                 
[root@cent5-vm1 ~]# fdisk -l

Disk /dev/sda: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14         652     5132767+  8e  Linux LVM

Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn't contain a valid partition table
Attached Files
File Type: txt scsi-rescan.txt (5.8 KB, 269 views)
 
2 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding second hard disk with windows to boot with grub on first hard disk rushadrenaline Linux - Hardware 3 07-08-2009 04:39 AM
Adding second/third disk tractng Red Hat 4 11-25-2007 04:55 AM
how bad is hard disk damage when rebooting? Saulo Linux - Hardware 3 11-01-2006 02:38 PM
RAID 1: adding a new SCSI disk to existing disk.... help mgy Linux - Enterprise 4 04-17-2006 03:56 AM
adding a new disk vressue Linux - Hardware 2 12-04-2003 01:27 PM


All times are GMT -5. The time now is 12:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration