1

I plug a completely clean CF-card into my USB card-writer. Then I dd a mbr block of 512 bytes size to the device, which contains the partition table and the definition of one partition.

Problem: While "fdisk -l /dev/sdx" correctly displays the partition, it happens that there is no device like "/dev/sdx1" after these operations (as it was not present before). Unplugging and plugging the card-writer solves the problem and makes the device(s) appear. Since I use this procedure in a script, manually unplugging and re-plugging is no option whatsoever.

Is there a way to "refresh" the devices or to "unplug and re-plug" the drive by script such that /dev/sdx1 appears?

Thanks for any help,

Chris

Chris
  • 225
  • 1
  • 3
  • 8

2 Answers2

1

I think I found a solution:

hdparm -z /dev/sdx

seems to to the trick so far.

Chris
  • 225
  • 1
  • 3
  • 8
0

try partprobe. I don't know if it rereads external cards, but it did help me when I changed partitions on my local drives.

Jure1873
  • 3,702
  • 1
  • 22
  • 28
  • Thanks for the hint, but while 'partprobe -s' detects the partitions correctly, the '/proc/partitions' file and the device nodes are not updated. – Chris May 12 '10 at 08:13