I have openvz vps and as I can see there's no disk device. But I really need to have a disk device there to check one thing.
The question is, can I create fake disk device that would be able to work with commands such as df or sfdisk?
I have openvz vps and as I can see there's no disk device. But I really need to have a disk device there to check one thing.
The question is, can I create fake disk device that would be able to work with commands such as df or sfdisk?
I am not a user of OpenVZ, but on a standard Linux system I would create a big file and then just setup a loopback device.
# create 50mb file to act as my block device
dd if=/dev/zero of=/srv/loopfs bs=1M count=50
# setup loopback device
losetup /dev/loop0 /srv/loopfs
# verify that I have a loopback device.
fdisk -l /dev/loop0
Disk /dev/loop0: 52 MB, 52428800 bytes
255 heads, 63 sectors/track, 6 cylinders, total 102400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
# and detach the device because I am done.
losetup -d /dev/loop0
See: