M
M
Maxim Kudryavtsev2016-06-03 14:49:54
linux
Maxim Kudryavtsev, 2016-06-03 14:49:54

How to create a virtual writable volume?

Good day to all.
We have a Linux Debian host. It is necessary to create a virtual partition in this environment (most likely some kind of img, iso and etc. image), with the ext2 / ext4 file system. The created image should be subsequently writable and mounted as a regular ext4 volume via /etc/fstab
Tell me, is this even possible and in which direction to dig?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Armenian Radio, 2016-06-03
@gbg

1. Create a file of the desired size
2. Mount it as a loop device
3. Format
4. Mount
mount /dev/loop0 /mnt/image

X
xibir, 2016-06-03
@xibir

Slightly improved 1st answer:
create file:
fallocate -l 1G /file
mkfs.ext4 -Fm0 /file
mount
either mount -o loop,noatime,nodiratime /file /mnt
or via fstab with options rw,loop,noatime,nodiratime

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question