The2 Posted May 12, 2008 Share Posted May 12, 2008 I'm writing a small script that detects hard drive's serial with hdparm, but hdparm is accepting /dev/hda or /dev/sda What's the easieast way to determine on what /dev/ is system installed? Link to comment Share on other sites More sharing options...
markwolfe Veteran Posted May 12, 2008 Veteran Share Posted May 12, 2008 A command to fdisk -l (that is a lowercase letter "L", not the number one) will list your partitions. You will need to either be root, or use sudo to assume root privileges to run that command. This will be a pure listing, and not tell you what is in-use where. You will need to reason out what partition is for what with this command. On the other hand, there is the mount command, which will show you what filesystems are mounted (in use) and where they are mounted to (for example /home may be a separate mounted partition). This may be the command you are after. Link to comment Share on other sites More sharing options...
mitch00 Posted May 13, 2008 Share Posted May 13, 2008 mark, I wonder if we counted how many times you gave the advice to use the command "sudo fdisk -l" what the number would be. I'm willing to bet at least 1500 times :p. Anyway The2, just do exactly what markjensen said. Link to comment Share on other sites More sharing options...
Mike Posted May 13, 2008 Share Posted May 13, 2008 mount |grep "on / " | cut -d ' ' -f 1 should do it Link to comment Share on other sites More sharing options...
Barney T. Administrators Posted May 14, 2008 Administrators Share Posted May 14, 2008 mark, I wonder if we counted how many times you gave the advice to use the command "sudo fdisk -l" what the number would be. I'm willing to bet at least 1500 times :p. I agree......... he should just place it somewhere on his computer so he can copy and paste it........ :p Link to comment Share on other sites More sharing options...
Recommended Posts