[parted-devel] [PATCH] Add support for RAM drives

Sebastian Parschauer sparschauer at suse.de
Wed Apr 19 14:37:14 UTC 2017


On 14.03.2017 16:40, Sebastian Parschauer wrote:
> Recognize RAM drives, so "parted -s /dev/ram0 p" now prints
> "RAM Drive (brd)" instead of "Model: Unknown (unknown)".
> 
> In order for a device to be recognized as RAM drive, it has to
> have major number 1. Also the BLKFLSBUF ioctl shouldn't be used
> on RAM drives as it is used to zero the device.

[snip]

@Phil and Brian: Can you please have a look? This is really trivial and
easy to test. It is mostly about not erasing RAM drives when printing
their partitions. Thanks in advance!

Test:
modprobe brd
dd if=/dev/urandom of=/dev/ram0 bs=1M count=1
dd if=/dev/ram0 | xxd | less   # see random data
parted -s /dev/ram0 p          # zeros the device with BLKFLSBUF ioctl
dd if=/dev/ram0 | xxd | less   # see zeroed data

Cheers,
Sebastian



More information about the parted-devel mailing list