]> git.proxmox.com Git - pve-docs.git/blame - pve-storage-dir.adoc
remove web interface section
[pve-docs.git] / pve-storage-dir.adoc
CommitLineData
aa039b0f
DM
1Directory Backend
2-----------------
fc3425bd 3include::attributes.txt[]
aa039b0f
DM
4
5Storage pool type: `dir`
6
7{pve} can use local directories or locally mounted shares for
8storage. A directory is a file level storage, so you can store any
9content type like virtual disk images, containers, templates, ISO images
10or backup files.
11
8c1189b6 12NOTE: You can mount additional storages via standard linux `/etc/fstab`,
aa039b0f
DM
13and then define a directory storage for that mount point. This way you
14can use any file system supported by Linux.
15
16This backend assumes that the underlying directory is POSIX
17compatible, but nothing else. This implies that you cannot create
871e1fd6 18snapshots at the storage level. But there exists a workaround for VM
aa039b0f
DM
19images using the `qcow2` file format, because that format supports
20snapshots internally.
21
871e1fd6 22TIP: Some storage types do not support `O_DIRECT`, so you can't use
aa039b0f
DM
23cache mode `none` with such storages. Simply use cache mode
24`writeback` instead.
25
26We use a predefined directory layout to store different content types
871e1fd6 27into different sub-directories. This layout is used by all file level
aa039b0f
DM
28storage backends.
29
30.Directory layout
31[width="100%",cols="d,m",options="header"]
32|===========================================================
33|Content type |Subdir
8c1189b6
FG
34|VM images |`images/<VMID>/`
35|ISO images |`template/iso/`
36|Container templates |`template/cache/`
37|Backup files |`dump/`
aa039b0f
DM
38|===========================================================
39
5eba0743 40
aa039b0f
DM
41Configuration
42~~~~~~~~~~~~~
43
44This backend supports all common storage properties, and adds an
45additional property called `path` to specify the directory. This
46needs to be an absolute file system path.
47
8c1189b6 48.Configuration Example (`/etc/pve/storage.cfg`)
aa039b0f
DM
49----
50dir: backup
51 path /mnt/backup
52 content backup
53 maxfiles 7
54----
55
56Above configuration defines a storage pool called `backup`. That pool
57can be used to store up to 7 backups (`maxfiles 7`) per VM. The real
8c1189b6 58path for the backup files is `/mnt/backup/dump/...`.
aa039b0f
DM
59
60
61File naming conventions
62~~~~~~~~~~~~~~~~~~~~~~~
63
64This backend uses a well defined naming scheme for VM images:
65
66 vm-<VMID>-<NAME>.<FORMAT>
67
68`<VMID>`::
69
70This specifies the owner VM.
71
72`<NAME>`::
73
8c1189b6 74This can be an arbitrary name (`ascii`) without white space. The
871e1fd6 75backend uses `disk-[N]` as default, where `[N]` is replaced by an
aa039b0f
DM
76integer to make the name unique.
77
78`<FORMAT>`::
79
8c1189b6 80Specifies the image format (`raw|qcow2|vmdk`).
aa039b0f
DM
81
82When you create a VM template, all VM images are renamed to indicate
5eba0743 83that they are now read-only, and can be used as a base image for clones:
aa039b0f
DM
84
85 base-<VMID>-<NAME>.<FORMAT>
86
87NOTE: Such base images are used to generate cloned images. So it is
871e1fd6
FG
88important that those files are read-only, and never get modified. The
89backend changes the access mode to `0444`, and sets the immutable flag
aa039b0f
DM
90(`chattr +i`) if the storage supports that.
91
5eba0743 92
aa039b0f
DM
93Storage Features
94~~~~~~~~~~~~~~~~
95
871e1fd6 96As mentioned above, most file systems do not support snapshots out
aa039b0f
DM
97of the box. To workaround that problem, this backend is able to use
98`qcow2` internal snapshot capabilities.
99
100Same applies to clones. The backend uses the `qcow2` base image
101feature to create clones.
102
103.Storage features for backend `dir`
104[width="100%",cols="m,m,3*d",options="header"]
105|==============================================================================
106|Content types |Image formats |Shared |Snapshots |Clones
107|images rootdir vztempl iso backup |raw qcow2 vmdk subvol |no |qcow2 |qcow2
108|==============================================================================
109
110
111Examples
112~~~~~~~~
113
114Please use the following command to allocate a 4GB image on storage `local`:
115
116 # pvesm alloc local 100 vm-100-disk10.raw 4G
117 Formatting '/var/lib/vz/images/100/vm-100-disk10.raw', fmt=raw size=4294967296
7c384c31 118 successfully created 'local:100/vm-100-disk10.raw'
aa039b0f
DM
119
120NOTE: The image name must conform to above naming conventions.
121
122The real file system path is shown with:
123
124 # pvesm path local:100/vm-100-disk10.raw
125 /var/lib/vz/images/100/vm-100-disk10.raw
126
127And you can remove the image with:
128
129 # pvesm free local:100/vm-100-disk10.raw
130
deb4673f
DM
131
132ifdef::wiki[]
133
134See Also
135~~~~~~~~
136
f532afb7 137* link:/wiki/Storage[Storage]
deb4673f
DM
138
139endif::wiki[]
140
141