]> git.proxmox.com Git - proxmox-backup.git/blame - docs/storage.rst
Restructure docs (more first level headings)
[proxmox-backup.git] / docs / storage.rst
CommitLineData
04e24b14
DW
1Storage
2=======
3
4Disk Management
5---------------
6
7.. image:: images/screenshots/pbs-gui-disks.png
8 :align: right
9 :alt: List of disks
10
11Proxmox Backup Server comes with a set of disk utilities, which are
12accessed using the ``disk`` subcommand. This subcommand allows you to initialize
13disks, create various filesystems, and get information about the disks.
14
15To view the disks connected to the system, navigate to **Administration ->
16Disks** in the web interface or use the ``list`` subcommand of
17``disk``:
18
19.. code-block:: console
20
21 # proxmox-backup-manager disk list
22 ┌──────┬────────┬─────┬───────────┬─────────────┬───────────────┬─────────┬────────┐
23 │ name │ used │ gpt │ disk-type │ size │ model │ wearout │ status │
24 ╞══════╪════════╪═════╪═══════════╪═════════════╪═══════════════╪═════════╪════════╡
25 │ sda │ lvm │ 1 │ hdd │ 34359738368 │ QEMU_HARDDISK │ - │ passed │
26 ├──────┼────────┼─────┼───────────┼─────────────┼───────────────┼─────────┼────────┤
27 │ sdb │ unused │ 1 │ hdd │ 68719476736 │ QEMU_HARDDISK │ - │ passed │
28 ├──────┼────────┼─────┼───────────┼─────────────┼───────────────┼─────────┼────────┤
29 │ sdc │ unused │ 1 │ hdd │ 68719476736 │ QEMU_HARDDISK │ - │ passed │
30 └──────┴────────┴─────┴───────────┴─────────────┴───────────────┴─────────┴────────┘
31
32To initialize a disk with a new GPT, use the ``initialize`` subcommand:
33
34.. code-block:: console
35
36 # proxmox-backup-manager disk initialize sdX
37
38.. image:: images/screenshots/pbs-gui-disks-dir-create.png
39 :align: right
40 :alt: Create a directory
41
42You can create an ``ext4`` or ``xfs`` filesystem on a disk using ``fs
43create``, or by navigating to **Administration -> Disks -> Directory** in the
44web interface and creating one from there. The following command creates an
45``ext4`` filesystem and passes the ``--add-datastore`` parameter, in order to
46automatically create a datastore on the disk (in this case ``sdd``). This will
47create a datastore at the location ``/mnt/datastore/store1``:
48
49.. code-block:: console
50
51 # proxmox-backup-manager disk fs create store1 --disk sdd --filesystem ext4 --add-datastore true
52
53.. image:: images/screenshots/pbs-gui-disks-zfs-create.png
54 :align: right
55 :alt: Create ZFS
56
57You can also create a ``zpool`` with various raid levels from **Administration
58-> Disks -> Zpool** in the web interface, or by using ``zpool create``. The command
59below creates a mirrored ``zpool`` using two disks (``sdb`` & ``sdc``) and
60mounts it on the root directory (default):
61
62.. code-block:: console
63
64 # proxmox-backup-manager disk zpool create zpool1 --devices sdb,sdc --raidlevel mirror
65
66.. note:: You can also pass the ``--add-datastore`` parameter here, to automatically
67 create a datastore from the disk.
68
69You can use ``disk fs list`` and ``disk zpool list`` to keep track of your
70filesystems and zpools respectively.
71
72Proxmox Backup Server uses the package smartmontools. This is a set of tools
73used to monitor and control the S.M.A.R.T. system for local hard disks. If a
74disk supports S.M.A.R.T. capability, and you have this enabled, you can
75display S.M.A.R.T. attributes from the web interface or by using the command:
76
77.. code-block:: console
78
79 # proxmox-backup-manager disk smart-attributes sdX
80
81.. note:: This functionality may also be accessed directly through the use of
82 the ``smartctl`` command, which comes as part of the smartmontools package
83 (see ``man smartctl`` for more details).
84
85
86.. _datastore_intro:
87
88:term:`DataStore`
89-----------------
90
91A datastore refers to a location at which backups are stored. The current
92implementation uses a directory inside a standard unix file system (``ext4``,
93``xfs`` or ``zfs``) to store the backup data.
94
95Datastores are identified by a simple *ID*. You can configure this
96when setting up the datastore. The configuration information for datastores
97is stored in the file ``/etc/proxmox-backup/datastore.cfg``.
98
99.. note:: The `File Layout`_ requires the file system to support at least *65538*
100 subdirectories per directory. That number comes from the 2\ :sup:`16`
101 pre-created chunk namespace directories, and the ``.`` and ``..`` default
102 directory entries. This requirement excludes certain filesystems and
103 filesystem configuration from being supported for a datastore. For example,
104 ``ext3`` as a whole or ``ext4`` with the ``dir_nlink`` feature manually disabled.
105
106
107Datastore Configuration
108~~~~~~~~~~~~~~~~~~~~~~~
109
110.. image:: images/screenshots/pbs-gui-datastore.png
111 :align: right
112 :alt: Datastore Overview
113
114You can configure multiple datastores. Minimum one datastore needs to be
115configured. The datastore is identified by a simple *name* and points to a
116directory on the filesystem. Each datastore also has associated retention
117settings of how many backup snapshots for each interval of ``hourly``,
118``daily``, ``weekly``, ``monthly``, ``yearly`` as well as a time-independent
119number of backups to keep in that store. :ref:`Pruning <pruning>` and
120:ref:`garbage collection <garbage-collection>` can also be configured to run
121periodically based on a configured schedule (see :ref:`calendar-events`) per datastore.
122
123
124Creating a Datastore
125^^^^^^^^^^^^^^^^^^^^
126.. image:: images/screenshots/pbs-gui-datastore-create-general.png
127 :align: right
128 :alt: Create a datastore
129
130You can create a new datastore from the web GUI, by navigating to **Datastore** in
131the menu tree and clicking **Create**. Here:
132
133* *Name* refers to the name of the datastore
134* *Backing Path* is the path to the directory upon which you want to create the
135 datastore
136* *GC Schedule* refers to the time and intervals at which garbage collection
137 runs
138* *Prune Schedule* refers to the frequency at which pruning takes place
139* *Prune Options* set the amount of backups which you would like to keep (see :ref:`Pruning <pruning>`).
140
141Alternatively you can create a new datastore from the command line. The
142following command creates a new datastore called ``store1`` on :file:`/backup/disk1/store1`
143
144.. code-block:: console
145
146 # proxmox-backup-manager datastore create store1 /backup/disk1/store1
147
148
149Managing Datastores
150^^^^^^^^^^^^^^^^^^^
151
152To list existing datastores from the command line run:
153
154.. code-block:: console
155
156 # proxmox-backup-manager datastore list
157 ┌────────┬──────────────────────┬─────────────────────────────┐
158 │ name │ path │ comment │
159 ╞════════╪══════════════════════╪═════════════════════════════╡
160 │ store1 │ /backup/disk1/store1 │ This is my default storage. │
161 └────────┴──────────────────────┴─────────────────────────────┘
162
163You can change the garbage collection and prune settings of a datastore, by
164editing the datastore from the GUI or by using the ``update`` subcommand. For
165example, the below command changes the garbage collection schedule using the
166``update`` subcommand and prints the properties of the datastore with the
167``show`` subcommand:
168
169.. code-block:: console
170
171 # proxmox-backup-manager datastore update store1 --gc-schedule 'Tue 04:27'
172 # proxmox-backup-manager datastore show store1
173 ┌────────────────┬─────────────────────────────┐
174 │ Name │ Value │
175 ╞════════════════╪═════════════════════════════╡
176 │ name │ store1 │
177 ├────────────────┼─────────────────────────────┤
178 │ path │ /backup/disk1/store1 │
179 ├────────────────┼─────────────────────────────┤
180 │ comment │ This is my default storage. │
181 ├────────────────┼─────────────────────────────┤
182 │ gc-schedule │ Tue 04:27 │
183 ├────────────────┼─────────────────────────────┤
184 │ keep-last │ 7 │
185 ├────────────────┼─────────────────────────────┤
186 │ prune-schedule │ daily │
187 └────────────────┴─────────────────────────────┘
188
189Finally, it is possible to remove the datastore configuration:
190
191.. code-block:: console
192
193 # proxmox-backup-manager datastore remove store1
194
195.. note:: The above command removes only the datastore configuration. It does
196 not delete any data from the underlying directory.
197
198
199File Layout
200^^^^^^^^^^^
201
202After creating a datastore, the following default layout will appear:
203
204.. code-block:: console
205
206 # ls -arilh /backup/disk1/store1
207 276493 -rw-r--r-- 1 backup backup 0 Jul 8 12:35 .lock
208 276490 drwxr-x--- 1 backup backup 1064960 Jul 8 12:35 .chunks
209
210`.lock` is an empty file used for process locking.
211
212The `.chunks` directory contains folders, starting from `0000` and taking hexadecimal values until `ffff`. These
213directories will store the chunked data after a backup operation has been executed.
214
215.. code-block:: console
216
217 # ls -arilh /backup/disk1/store1/.chunks
218 545824 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 ffff
219 545823 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 fffe
220 415621 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 fffd
221 415620 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 fffc
222 353187 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 fffb
223 344995 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 fffa
224 144079 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 fff9
225 144078 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 fff8
226 144077 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 fff7
227 ...
228 403180 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 000c
229 403179 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 000b
230 403177 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 000a
231 402530 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 0009
232 402513 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 0008
233 402509 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 0007
234 276509 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 0006
235 276508 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 0005
236 276507 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 0004
237 276501 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 0003
238 276499 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 0002
239 276498 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 0001
240 276494 drwxr-x--- 2 backup backup 4.0K Jul 8 12:35 0000
241 276489 drwxr-xr-x 3 backup backup 4.0K Jul 8 12:35 ..
242 276490 drwxr-x--- 1 backup backup 1.1M Jul 8 12:35 .
243
244