
jm8254og
New User
Aug 4, 2009, 5:16 PM
Post #1 of 2
(539 views)
|
|
Automatically determing harddrive information such as filesystem type?
|
Can't Post
|
|
Hello, I am trying to create a script that will automatically determine the source and destination drives for making images. I have some known variables such as file system type and one drive, the source, will have a boot flag. I thought that the "df" command would solve my problem and works great on a local system but when I run it from a live cd environment it will only report the cd's information, makes sense I guess. I put what I have below: I have tried to do the same thing with "fdisk -l" and split but all I can get is the last line of the output of the fdisk command. Any ideas on what to do to make such a thing work in a live cd environment? Maybe I am going about it too difficult? The goal here is that someone could boot to a live CD that runs the script and determines what the source, internal drive, and destination, external drive, is and pass that to "dd" open (df, "df -t ext 3 |"); #I will eventually change this to ntfs while (<df>) { ($src)=split; } $src = substr ($src, 5,3); print "The Source Drive is $src\n"; open (df, "df -t vfat |"); while (<df>) { ($dst)=split; } $dst= substr ($dst, 5,4); print "The Destination Drive is $dst\n"; #pass those to dd and make image
|