I've installed Ubuntu using these options:
How can I create LVM snapshots, so that I'm able to revert system changes when it's necessary?
Note: all commands should be done from sudo
fdisk -l
to see name of your device. Device Start End Sectors Size Type /dev/sda1 2048 1050623 1048576 512M EFI System /dev/sda2 1050624 2050047 999424 488M Linux filesystem /dev/sda3 2050048 500117503 498067456 237.5G Linux filesystem
/dev/sda3
in my casecryptsetup luksOpen /dev/sda3 crypt1
to decrypt your volumevgscan --mknodes
to find all volume groups Reading all physical volumes. This may take a while... Found volume group "ubuntu-vg" using metadata type lvm2
vgchange -ay
to activate all your volume groups 2 logical volume(s) in volume group "ubuntu-vg" now active
lvreduce -r -L -20G /dev/ubuntu-vg/root
to reduce size of your root volume by 20 Gb. This may take a while (it took ~4 min for me).vgs
to see that you actually got 20G of free space VG #PV #LV #SN Attr VSize VFree ubuntu-vg 1 2 0 wz--n- 230.44g 20.01g
reboot
and remove Live CDNow whenever you want to do something risky with your system, run the following command
lvcreate -s -n snap -L 20G /dev/ubuntu-vg/root
/dev/ubuntu-vg/root
is a logical volume that you want to have a snapshot oflvs
to see that the volume has been created LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert root ubuntu-vg owi-aos--- 201.59g snap ubuntu-vg swi-a-s--- 20.00g root 0.00 swap_1 ubuntu-vg -wi-ao---- 15.90gThe snapshot is active from the moment you run
lvcreate
. You can now start experimenting with new things.lvconvert --merge /dev/mapper/ubuntu--vg-snap
Logical volume ubuntu-vg/root contains a filesystem in use. Can't merge over open origin volume. Merging of snapshot ubuntu-vg/snap will occur on next activation of ubuntu-vg/root.
reboot
lvremove /dev/mapper/ubuntu--vg-snap
You basically have to run lvcreate
to start the process and then either run lvconvert --merge
or lvremove
to end it.
Keep in mind that when the snapshot is active, due to Copy-On-Write strategy all the changes are saved to those 20Gb of space (or whatever value you set). One way of checking the remaining capacity is to look at Data% column of lvs
command.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다