Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[bash] wie Festplattengröße ermitteln?
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) Diskussionsforum
View previous topic :: View next topic  
Author Message
3PO
Veteran
Veteran


Joined: 26 Nov 2006
Posts: 1110
Location: Schwabenländle

PostPosted: Thu Jun 07, 2012 9:06 am    Post subject: [bash] wie Festplattengröße ermitteln? Reply with quote

Hallo Zusammen,

ich bräuchte für ein Shellscript die Festplattengröße von z.B. "/dev/sda", leider finde ich keinen Befehl, der mit das ausgibt. :(

Deshalb nun die Frage, wie man die Größe von Festplatten via bash ermitteln kann?
Back to top
View user's profile Send private message
rc
Apprentice
Apprentice


Joined: 16 Dec 2003
Posts: 234

PostPosted: Thu Jun 07, 2012 9:19 am    Post subject: Reply with quote

Schau dir mal den Output von "fdisk -l" (kleines 'L') an, ob der dir weiter hilft. Das geht halt nur als root und du müsstest das Ganze noch entsprechend "aufbereiten" um an dein gewünschtes Datum zu kommen.
Back to top
View user's profile Send private message
3PO
Veteran
Veteran


Joined: 26 Nov 2006
Posts: 1110
Location: Schwabenländle

PostPosted: Thu Jun 07, 2012 9:24 am    Post subject: Reply with quote

THX @ rc,

aber das,

Code:
vdr01 ~ # fdisk -l |grep Disk |grep sda |cut -d " " -f5
60022480896
vdr01 ~ #

ist doch ziemlich umständlich, gibt es nichts einfacheres?
Back to top
View user's profile Send private message
rc
Apprentice
Apprentice


Joined: 16 Dec 2003
Posts: 234

PostPosted: Thu Jun 07, 2012 9:28 am    Post subject: Reply with quote

Du kannst deine Platte auch direkt bei fdisk mit angeben: "fdisk -l /dev/sda"
Das reduziert die Länge der | chain zumindest schonmal etwas.

PS OT: Wenn ich versuche via den "Antwort Erstellen" Link eine Antwort zu erstellen, lande ich auf der Foren Hauptseite. Über "Zitieren" klappt das erstellen einer Antwort.
Back to top
View user's profile Send private message
firefly
Watchman
Watchman


Joined: 31 Oct 2002
Posts: 5161

PostPosted: Thu Jun 07, 2012 9:36 am    Post subject: Reply with quote

rc wrote:
Schau dir mal den Output von "fdisk -l" (kleines 'L') an, ob der dir weiter hilft. Das geht halt nur als root und du müsstest das Ganze noch entsprechend "aufbereiten" um an dein gewünschtes Datum zu kommen.

fdisk kann man auch als non root aufrufen. Das Programm ist halt nicht im Standard Suchpfad enthalten für einen non-root user (/sbin fehlt in $PATH) aber wenn man es direkt aufruft funktioniert ein fdisk -l
_________________
Ein Ring, sie zu knechten, sie alle zu finden,
Ins Dunkel zu treiben und ewig zu binden
Im Lande Mordor, wo die Schatten drohn.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) Diskussionsforum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum