Get all hardisk list (/dev/sd*)Using command line
up vote
3
down vote
favorite
I need to get all the hardisk connected to my PC like,
/dev/sda
/dev/sdb
/dev/sdc
later I have to use it in script and monitor using iostat
I alrady found fdisk
command, it seems to be hard for me to extract all the device from the output of fdisk
using grep
.
Is there any simple way ?
linux command-line hard-disk
add a comment |
up vote
3
down vote
favorite
I need to get all the hardisk connected to my PC like,
/dev/sda
/dev/sdb
/dev/sdc
later I have to use it in script and monitor using iostat
I alrady found fdisk
command, it seems to be hard for me to extract all the device from the output of fdisk
using grep
.
Is there any simple way ?
linux command-line hard-disk
add a comment |
up vote
3
down vote
favorite
up vote
3
down vote
favorite
I need to get all the hardisk connected to my PC like,
/dev/sda
/dev/sdb
/dev/sdc
later I have to use it in script and monitor using iostat
I alrady found fdisk
command, it seems to be hard for me to extract all the device from the output of fdisk
using grep
.
Is there any simple way ?
linux command-line hard-disk
I need to get all the hardisk connected to my PC like,
/dev/sda
/dev/sdb
/dev/sdc
later I have to use it in script and monitor using iostat
I alrady found fdisk
command, it seems to be hard for me to extract all the device from the output of fdisk
using grep
.
Is there any simple way ?
linux command-line hard-disk
linux command-line hard-disk
edited Nov 24 at 19:39
Rui F Ribeiro
38.3k1475126
38.3k1475126
asked Apr 1 '15 at 9:56
Haris
14128
14128
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
7
down vote
accepted
easier than fdisk for your purpose is lsblk:
$ lsblk --nodeps
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 223.6G 0 disk
sdb 8:16 0 298.1G 0 disk
sr0 11:0 1 12M 0 rom
or if you just want the drives:
$ lsblk --nodeps -n -o name
sda
sdb
sr0
So I have to add /dev/ with the result manually.........?
– Haris
Apr 1 '15 at 10:24
yes, sorry to make it so hard, it's some homework for you ;-)
– gogoud
Apr 1 '15 at 11:09
Hi, thanks for reply....I already completed the homework... :-)
– Haris
Apr 1 '15 at 11:11
add a comment |
up vote
1
down vote
Try this:
blkid | awk -F":" '{print $1}'
Actually I don’t need partition only device, like sda,sdb,sdc etc
– Haris
Apr 1 '15 at 10:10
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
7
down vote
accepted
easier than fdisk for your purpose is lsblk:
$ lsblk --nodeps
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 223.6G 0 disk
sdb 8:16 0 298.1G 0 disk
sr0 11:0 1 12M 0 rom
or if you just want the drives:
$ lsblk --nodeps -n -o name
sda
sdb
sr0
So I have to add /dev/ with the result manually.........?
– Haris
Apr 1 '15 at 10:24
yes, sorry to make it so hard, it's some homework for you ;-)
– gogoud
Apr 1 '15 at 11:09
Hi, thanks for reply....I already completed the homework... :-)
– Haris
Apr 1 '15 at 11:11
add a comment |
up vote
7
down vote
accepted
easier than fdisk for your purpose is lsblk:
$ lsblk --nodeps
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 223.6G 0 disk
sdb 8:16 0 298.1G 0 disk
sr0 11:0 1 12M 0 rom
or if you just want the drives:
$ lsblk --nodeps -n -o name
sda
sdb
sr0
So I have to add /dev/ with the result manually.........?
– Haris
Apr 1 '15 at 10:24
yes, sorry to make it so hard, it's some homework for you ;-)
– gogoud
Apr 1 '15 at 11:09
Hi, thanks for reply....I already completed the homework... :-)
– Haris
Apr 1 '15 at 11:11
add a comment |
up vote
7
down vote
accepted
up vote
7
down vote
accepted
easier than fdisk for your purpose is lsblk:
$ lsblk --nodeps
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 223.6G 0 disk
sdb 8:16 0 298.1G 0 disk
sr0 11:0 1 12M 0 rom
or if you just want the drives:
$ lsblk --nodeps -n -o name
sda
sdb
sr0
easier than fdisk for your purpose is lsblk:
$ lsblk --nodeps
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 223.6G 0 disk
sdb 8:16 0 298.1G 0 disk
sr0 11:0 1 12M 0 rom
or if you just want the drives:
$ lsblk --nodeps -n -o name
sda
sdb
sr0
answered Apr 1 '15 at 10:05
gogoud
1,690716
1,690716
So I have to add /dev/ with the result manually.........?
– Haris
Apr 1 '15 at 10:24
yes, sorry to make it so hard, it's some homework for you ;-)
– gogoud
Apr 1 '15 at 11:09
Hi, thanks for reply....I already completed the homework... :-)
– Haris
Apr 1 '15 at 11:11
add a comment |
So I have to add /dev/ with the result manually.........?
– Haris
Apr 1 '15 at 10:24
yes, sorry to make it so hard, it's some homework for you ;-)
– gogoud
Apr 1 '15 at 11:09
Hi, thanks for reply....I already completed the homework... :-)
– Haris
Apr 1 '15 at 11:11
So I have to add /dev/ with the result manually.........?
– Haris
Apr 1 '15 at 10:24
So I have to add /dev/ with the result manually.........?
– Haris
Apr 1 '15 at 10:24
yes, sorry to make it so hard, it's some homework for you ;-)
– gogoud
Apr 1 '15 at 11:09
yes, sorry to make it so hard, it's some homework for you ;-)
– gogoud
Apr 1 '15 at 11:09
Hi, thanks for reply....I already completed the homework... :-)
– Haris
Apr 1 '15 at 11:11
Hi, thanks for reply....I already completed the homework... :-)
– Haris
Apr 1 '15 at 11:11
add a comment |
up vote
1
down vote
Try this:
blkid | awk -F":" '{print $1}'
Actually I don’t need partition only device, like sda,sdb,sdc etc
– Haris
Apr 1 '15 at 10:10
add a comment |
up vote
1
down vote
Try this:
blkid | awk -F":" '{print $1}'
Actually I don’t need partition only device, like sda,sdb,sdc etc
– Haris
Apr 1 '15 at 10:10
add a comment |
up vote
1
down vote
up vote
1
down vote
Try this:
blkid | awk -F":" '{print $1}'
Try this:
blkid | awk -F":" '{print $1}'
answered Apr 1 '15 at 10:09
jcbermu
3,292719
3,292719
Actually I don’t need partition only device, like sda,sdb,sdc etc
– Haris
Apr 1 '15 at 10:10
add a comment |
Actually I don’t need partition only device, like sda,sdb,sdc etc
– Haris
Apr 1 '15 at 10:10
Actually I don’t need partition only device, like sda,sdb,sdc etc
– Haris
Apr 1 '15 at 10:10
Actually I don’t need partition only device, like sda,sdb,sdc etc
– Haris
Apr 1 '15 at 10:10
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f193776%2fget-all-hardisk-list-dev-sdusing-command-line%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown