LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 01-02-2019, 04:27 AM   #1
Shozib
LQ Newbie
 
Registered: Jan 2019
Posts: 12

Rep: Reputation: Disabled
Lightbulb Virtual Hard Disk is added, but not showing using lsblk -d command


I have added a virtual disk in Centos, now in the terminal when I type the command lsblk -d it is not showing me the newly added virtual disk whereas all the other hard disks are showing. Could you please tell me, how can I solve this problem? Thanks
 
Old 01-02-2019, 05:33 AM   #2
berndbausch
Senior Member
 
Registered: Nov 2013
Location: Tokyo
Distribution: A few
Posts: 4,150

Rep: Reputation: 1166Reputation: 1166Reputation: 1166Reputation: 1166Reputation: 1166Reputation: 1166Reputation: 1166Reputation: 1166Reputation: 1166
Not sure what you mean. Did you add it to a virtual machine? How did you add it?

I would check for messages in the kernel message buffer. Use dmesg to display it. You can also run udevadm monitor while you (dis)connect the disk to see if udev gets any notification.

Have you tried a reboot after adding the disk?
 
Old 01-02-2019, 07:41 AM   #3
sgrlscz
Member
 
Registered: Aug 2008
Posts: 116

Rep: Reputation: 83
If the VM was running when you added the disk, you need to rescan for the new disk. Rebooting will work, but you can rescan without rebooting.

If the sg3-utils package is installed, you can use rescan-scsi-bus.sh to rescan. If not you can use the following:

Code:
for h in $(ls /sys/class/scsi_host); do
    echo '- - -' > /sys/class/scsi_host/$h/scan
done
 
1 members found this post helpful.
Old 01-02-2019, 10:11 AM   #4
Shozib
LQ Newbie
 
Registered: Jan 2019
Posts: 12

Original Poster
Rep: Reputation: Disabled
@berndbausch yes Sir, I have added this drive to a virtual Machine (Centos 7 64 bit) by going to settings then under hardware tab. And yes rebooting is working, but I want to do this by scanning the drives. I short, basically I want to see the drive in the list, without rebooting the system. Thanks
 
Old 01-02-2019, 10:14 AM   #5
Shozib
LQ Newbie
 
Registered: Jan 2019
Posts: 12

Original Poster
Rep: Reputation: Disabled
@sgrlscz Thankyou for your time reading my query and responding back. Could you please tell me, how can I check whether the package (sg3-utils) you mentioned above is installed or not?
And sorry for asking simple questions, actually I am new to this OS. Thanks again.
 
Old 01-02-2019, 02:24 PM   #6
sgrlscz
Member
 
Registered: Aug 2008
Posts: 116

Rep: Reputation: 83
It's actually sg3_utils (sorry about that). To check if it's installed:

Code:
rpm -q sg3_utils
If it's not, you'll get a message saying it's not installed. If it is, you get the full package name. For example:

Code:
$ rpm -q sg3_utils
sg3_utils-1.37-12.el7.x86_64
If it's not installed, you can install it with yum:

Code:
# yum install sg3_utils
 
Old 01-02-2019, 03:17 PM   #7
Shozib
LQ Newbie
 
Registered: Jan 2019
Posts: 12

Original Poster
Rep: Reputation: Disabled
@sgrlscz I have run the command to re-scan the disk. The command worked but still I did not get my hard disk listed in the list. Whereas if I reboots the system then the problem gets solved.
 
Old 01-02-2019, 03:24 PM   #8
Shozib
LQ Newbie
 
Registered: Jan 2019
Posts: 12

Original Poster
Rep: Reputation: Disabled
Finally the problem is solved with the code you mentioned in your Ist comment, which is #3 in this thread. Thanks a lot.
 
Old 01-02-2019, 06:45 PM   #9
berndbausch
Senior Member
 
Registered: Nov 2013
Location: Tokyo
Distribution: A few
Posts: 4,150

Rep: Reputation: 1166Reputation: 1166Reputation: 1166Reputation: 1166Reputation: 1166Reputation: 1166Reputation: 1166Reputation: 1166Reputation: 1166
Quote:
Originally Posted by sgrlscz View Post

Code:
for h in $(ls /sys/class/scsi_host); do
    echo '- - -' > /sys/class/scsi_host/$h/scan
done
Picking a nit (and because I like to have the last word ). The following doesn’t require the ls command:
Code:
for h in /sys/class/scsi_host/*; do
    echo '- - -' > /sys/class/scsi_host/$h/scan
done
 
  


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
Rhel 7.3 lsblk showing output rhel-pool00_tmeta rhel-pool00_tdata Pravingoud89 Red Hat 7 12-27-2018 11:52 AM
LXer: Linux lsblk Command Tutorial for Beginners (8 Examples) LXer Syndicated Linux News 0 09-04-2018 12:31 PM
lsblk reports qemu-img created disk is only 200k nbritton Linux - Virtualization and Cloud 1 04-28-2018 01:47 PM
"lsblk" sees flash drive but "fdisk -l" does not themohawkninja Linux - Newbie 5 06-13-2017 02:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:34 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