How about:
# mkpart /dev/sda /dev/mypartition -o size=1024k,type=swap
# ls /dev/mypartition
base size device type
# cat /dev/mypartition/size
1048576
# cat /dev/mypartition/device
/dev/sda
# mke2fs /dev/mypartition
The information that was specified is persistent in /dev. We can
rearrange our physical devices any way we want without affecting
the name we chose in /dev. When the kernel enumerates devices
at startup, our persistent information better match or we will have
to take some corrective action.
Generally, we shouldn't care which order the kernel enumerates
devices in or which device number gets assigned internally. If we
did need to care, we'd just do:
# echo 666 >/dev/mypartition/number
setting a persistent device minor number. The major number is
inherited via the partition's /device property.
To set the minor number back to 'don't care':
# rm /dev/mypartition/number
By taking the physical device off the top of the food chain we
gain the flexibility of being able to move the device from bus to
bus for example, and only the partition's device property
changes, nothing in our fstab. It's no great leap to set things
up so that not even the /device property would need to
change.
Note that we can have a heirarchy of partitions this way if
we want to, since /dev/mypartition is just another block
device.
-- Daniel - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/