Results 1 to 3 of 3
Hi,
I am developing (in bash) a script that will install Linux from a clean system. I am using syslinux to boot a media where the script and its packages ...
- 02-19-2010 #1Just Joined!
- Join Date
- Feb 2010
- Location
- Brazil
- Posts
- 7
Install script must find hard disk
Hi,
I am developing (in bash) a script that will install Linux from a clean system. I am using syslinux to boot a media where the script and its packages are stored. The destination hard disk was hard coded as /dev/sda which worked until now.
I am booting from a usb pendrive and don't know how to tell which /dev/sd* is the hard disk.
So far the best idea that I have is to look in /sys/block/sd*/removable. If the value is 1, I assume that it is a pendrive.
Does anyone know a better approach?
Thanks in advance.
- 02-19-2010 #2Linux User
- Join Date
- Jan 2007
- Location
- cleveland
- Posts
- 452
welcome to the forum
something like this might help
fdisk -l | sed -n '2p' | cut -d" " -f2 | sed s/://the sun is new every day (heraclitus)
- 02-22-2010 #3Just Joined!
- Join Date
- Feb 2010
- Location
- Brazil
- Posts
- 7
Thanks for the welcome and for the reply.
The solution is simpler than I thought. However, is there any guarantee that hard disks will be always the first "sd*"? Is udev responsible for this assignment?
Thanks again.


Reply With Quote