# Managing Snapshot(s)

Snapshot เป็นการทำ Snapshot ของข้อมูลใน Volume ต้นฉบับขณะนั้น เพื่อนำไปเก็บเป็น backup หรือใช้ในการกู้คืนข้อมูลภายหลัง

{% hint style="info" %}
size ของ Snapshot ในดับ block storage ทำให้ size ของ Snapshot ใน NCS อาจไม่เท่ากับ size ที่แสดงใน file system เนื่องจาก file system อาจไม่ได้ระบุบล็อกที่ไม่ได้ใช้งานทันที ทำให้ระบบ block storage รวมบล็อกเหล่านั้นไว้ใน Snapshot แม้ว่าบล็อกเหล่านั้นจะไม่ได้มีข้อมูลอยู่ก็ตาม

เพื่อลด size ของ Snapshot และลดค่าใช้จ่ายในการจัดเก็บ คุณสามารถทำการ 'ตัดแต่ง' (trim) หรือ 'ทิ้ง' (discard)  block ที่ไม่ได้ใช้งานได้ โดยการตั้งค่า `fstrim` ให้ทำงานตามระยะเวลาที่กำหนด หรือการ mount Volume ด้วยตัวเลือก `discard` เพื่อให้ระบบ block storage ทราบว่า blockใดถูกใช้งาน และ blockใดไม่ได้ถูกใช้งาน
{% endhint %}

{% hint style="warning" %}
size ของ Snapshot จะคำนวนจากการเปลี่ยนของข้อมูลเมื่อเทียบกับ Snapshot ก่อนหน้าของ Volume เดียวกัน ซึ่งอาจจะทำให้เกิดเหตุการณ์ที่ทำให้ Snapshot มีขนาดใหญ่กว่า Volume ได้

เช่น&#x20;

1. Snapshot ครั้งแรกตอนที่ Volume 100 GB มี data อยู่ที่ 40 GB จะได้ Snapshot ที่มี size เป็น 40 GB
2. มีการเปลี่ยนแปลง data ใน Volume 100 GB โดยมีการลบ data เดิมออกไป 30 GB และเขียน data เพิ่ม 80 GB
3. Snapshot ครั้งถัดไปขณะที่ Volume 100 GB มี data อยู่ที่ 90 GB จะได้ Snapshot ที่มี size เป็น 110 GB โดยคิดจากการเปลี่ยนแปลง 2 อย่าง รวมกัน
   1. 30 GB จาก data ที่ถูกลบไป
   2. 80 GB จาก data ที่ถูกเขียนเพิ่ม
      {% endhint %}

Snapshot สามารถสร้างได้จากทั้ง Volume ธรรมดาและ Bootable Volume

## Instructions

### 1. Log in เข้าสู่ project

เลือก project จากหน้า projects management เพื่อเข้าสู่หน้า project detail

![Project Overview](/files/LUErGfAgWtadOdOLU1xh)

### 2. เข้าสู่หน้า Snapshots&#x20;

ที่แถบเมนูทางซ้าย คลิกเลือกเมนู​ BLOCK STORAGE > Snapshots เพื่อเข้าสู่หน้า Snapshots&#x20;

![](/files/iwbtebHelqiN4EfzkVl1)

### 3. การจัดการ Snapshot

สามารถจัดการ Snapshot ได้ดังนี้&#x20;

1. &#x20;[สร้าง Snapshot](/ncs-documents/storage/block-storage/managing-snapshot-s/create-a-snapshot.md)
2. &#x20;[สร้าง volume จาก Snapshot](/ncs-documents/storage/block-storage/managing-volume-s/create-from-a-snapshot.md)
3. &#x20;ลบ Snapshot
4. &#x20;[เปลี่ยนชื่อ Snapshot ](/ncs-documents/storage/block-storage/managing-snapshot-s/renaming-a-volume-snapshot.md)

![Volume Snapshots Page](/files/cBDgrIipyPtBF42GCKhc)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs-epc.gitbook.io/ncs-documents/storage/block-storage/managing-snapshot-s.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
