LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   LVM cannot create snapshot, insufficent space (https://www.linuxquestions.org/questions/linux-newbie-8/lvm-cannot-create-snapshot-insufficent-space-4175511616/)

backwardsbyte 07-19-2014 05:27 PM

LVM cannot create snapshot, insufficent space
 
Hello I am new to volume management and have been watching a few lvm tutorials on youtube, I am trying to create a snapshot of my root volume but get insufficient free space error. I want to make this snapshot incase I goof something up, since this is a fresh install of mint 17 with my drivers and all updates. This is the sequence of commands recorded from my terminal session:

Code:

Script started on Sat 19 Jul 2014 05:49:04 PM EDT
yte log # pvs
  PV        VG      Fmt  Attr PSize  PFree
  /dev/sda5  mint-vg lvm2 a--  931.27g 44.00m
yte log # vgs
  VG      #PV #LV #SN Attr  VSize  VFree
  mint-vg  1  2  0 wz--n- 931.27g 44.00m
yte log # lvs
  LV    VG      Attr      LSize  Pool Origin Data%  Move Log Copy%  Convert
  root  mint-vg -wi-ao--- 927.23g                                         
  swap_1 mint-vg -wi-ao---  4.00g                                         
yte log # moun t
No command 'moun' found, did you mean:
 Command 'moin' from package 'python-moinmoin' (main)
 Command 'mount' from package 'mount' (main)
 Command 'muon' from package 'muon' (universe)
 Command 'mon' from package 'mon' (universe)
moun: command not found
yte log # mount
/dev/mapper/mint--vg-root on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/cgroup type tmpfs (rw)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
none on /run/user type tmpfs (rw,noexec,nosuid,nodev,size=104857600,mode=0755)
none on /sys/fs/pstore type pstore (rw)
/dev/sda1 on /boot type ext2 (rw)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
systemd on /sys/fs/cgroup/systemd type cgroup (rw,noexec,nosuid,nodev,none,name=systemd)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,user=bb)
/dev/sdf1 on /media/bb/My Passport type fuseblk (rw,nosuid,nodev,allow_other,default_permissions,blksize=4096)
yte log # lvcreate -L150M -s -n backup /dev/mint-vg/root
  Rounding up size to full physical extent 152.00 MiB
  Volume group "mint-vg" has insufficient free space (11 extents): 38 required.
yte log # lvs
  LV    VG      Attr      LSize  Pool Origin Data%  Move Log Copy%  Convert
  root  mint-vg -wi-ao--- 927.23g                                         
  swap_1 mint-vg -wi-ao---  4.00g                                         
yte log # exit
exit

Script done on Sat 19 Jul 2014 06:14:29 PM EDT

Can someone point me in the right direction. Also I dont yet know how to avoid the prompt codes from showing up in the log that i recoreded with script -a lvmsession.txt

rknichols 07-20-2014 09:28 AM

You let the installer allocate all of the available space, and now there is nothing left (well, 44MB, but that's not much on a 1TB disk) for a new LV. If you don't have too much time invested in the original install+drivers+updates, it might be best just to reinstall and set a more reasonable size (100GB perhaps?) for that filesystem. Then you will have plenty of space available to play with LVM. You can use the df command to see how much space you are actually using on the filesystem now.

If you don't want to reinstall, you will have to reduce the size of that root filesystem and LV. You can't reduce the size of a filesystem while it is mounted, so you will have to boot from the install medium or a rescue disk. The command to resize the LV and filesystem together is
Code:

lvresize --size 100G --resizefs /dev/mint-vg/root
Select whatever size you want there. Do not leave out the "--resizefs" option or the operation will just chop off the end of the filesystem and leave you with the broken remainder. (It's recoverable, but you don't want to go there.) You should be sure that
Code:

fsck -f /dev/mint-vg/root
is run afterward to make sure that all is still well in the filesystem.

Normally I would advise making a full backup before resizing a filesystem, but since this is a fresh install the effort to do that would be similar to just reinstalling if something goes wrong.

T3RM1NVT0R 07-20-2014 09:31 AM

@ Reply
 
Hi backwardsbyte,

Welcome to LQ!!!

Well the output from LVS and VGS command shows that you have got root lv and swap on the system with 927 G and 4 G. The free space from VGS shows only 44 MB of free space in the VG group and that is the reason it is complaining of not enough free space for creating LVM snapshot.

As you said that you want to use LVM snapshot incase you goof up something on the system, here I would like to mention that LVM snapshot is not backup solution. Usually system administrators use LV snapshot for easy recovery, they take LV snapshot before going ahead with some task that will make modification on the file system. So if this is the system wherein your will be playing around with for testing purpose then I would suggest once in a month backup to external drive.

Also as you have got a single LV which is pretty big so am not sure how feasible LV snapshots will be in that case. Though LV snapshot does not take disk space into consideration rather it takes used disk space into consideration.

Quote:

Also I dont yet know how to avoid the prompt codes from showing up in the log that i recoreded with script -a lvmsession.txt
What you mean by prompt codes here? Because script will log everything which is happening on the screen where it has been executed.

backwardsbyte 07-20-2014 07:13 PM

Thank you both, as I now understand my root volume is very large and would idealy need to be resized, and given what was said about snapshots not being a backup solution I decided that I was in way over my head with LVM and reinstalled with the default partitioning without checking off LVM. This way I can maybe use a dd to copy my root partition and just wory about learning linux. I sometimes give myself difficult tasks, considering I started using Linux as a complete replacement for Windows about 1 month ago and never looked back, I am much of a linux noob and now it seems this LVM is maybe used by sysadmins for testing big changes before commiting. Thank you both for your help.


All times are GMT -5. The time now is 02:30 AM.