You need to reduce the size of the primary partition to burn the image to a smaller disk.

I have:

Filesystem Size Used Avail Use% Mounted on udev 3.8G 0 3.8G 0% /dev tmpfs 772M 9.1M 763M 2% /run /dev/sda1 4.7G 3.0G 1.5G 67% / tmpfs 3.8G 79M 3.7G 3% /dev/shm tmpfs 5.0M 8.0K 5.0M 1% /run/lock tmpfs 3.8G 0 3.8G 0% /sys/fs/cgroup /dev/mapper/vg01-some--common 2.0G 3.1M 1.8G 1% /opt/some-common /dev/mapper/vg01-some--game 12G 1.5G 11G 13% /opt/some /dev/mapper/vg01-some--var 20G 45M 19G 1% /opt/some-var /dev/mapper/vg01-some--log 20G 48M 19G 1% /opt/some-log tmpfs 772M 0 772M 0% /run/user/1000 

I reduce the sections / dev / mapper / vg01-some-var and / dev / mapper / vg01-some-log to 16 gigs with the help of resize2fs and lvreduce . At this stage, everything goes fine, the file system is OK, the system boots, df -h shows 16G each

Then I boot from the flash drive, I launch gparted, it shows that there is more free space. I am happy. I try to reduce it to the right size (within an empty space), I save - bam, the error - I don’t want to reduce it much, although when I began to reduce it a little, I reduced it somewhere by 200 megs, and then to no other - the same error (unfortunately now There is no possibility to greet the entire message

Question: Is this a common problem, if so, what have I not completed? It may not be enough to reduce each logical partition and you need to reduce this group itself vg01 ?? Then how to do it, if you really need?

Please help with practical tz, since now there is no time to deeply study theory, you just need to solve the problem - burn the image to a smaller disk.

Remark: I recorded the image from this disk to another disk (not the smallest size, as needed, but the same as the first one) - everything went fine. When I try to reduce gparted on the second disk - the same error, that is, I conclude that the problem is not related to the physical error on the disk.


in my list of block devices:

 $ sudo pvs PV VG Fmt Attr PSize PFree /dev/sda2 vg01 lvm2 a-- 58.64g 20.64g 

How to call a block device? Suppose / dev / sda3. I do:

 $ sudo pvcreate /dev/sda3 Device /dev/sda3 not found (or ignored by filtering). 

What am I doing wrong?


I also attach vgs and lvs output

 **$ sudo vgs VG #PV #LV #SN Attr VSize VFree vg01 1 4 0 wz--n- 58.64g 20.64g $ sudo lvs LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert gkt-common vg01 -wi-ao---- 2.00g gkt-game vg01 -wi-ao---- 12.00g gkt-log vg01 -wi-ao---- 12.00g gkt-var vg01 -wi-ao---- 12.00g ** 
  • one
    sudo pvs; sudo vgs; sudo lvs output to the question sudo pvs; sudo vgs; sudo lvs sudo pvs; sudo vgs; sudo lvs sudo pvs; sudo vgs; sudo lvs - aleksandr barakin
  • pvcreate device - specify the device that you want to connect to the volume group. what you referred to as the “smaller disk”: burn the image to a smaller disk - aleksandr barakin

1 answer 1

you just need to solve the problem - burn the image to a smaller disk

this is a much simpler task than “packaging” of reduced volumes ( logical volumes , lv ).


In general, a “sandwich”, which is lvm , can be (quite simply) portrayed like this:

 +--pv1--+----------pv2----------+ | | | | +------------vg1------------+ | | | +-----------+-----------+ | | | | | lv1 | lv2 | | | | | +-----------+-----------+ | | | +---------------------------+ | +-------+-----------------------+ 

here pv1 and pv2 are two physical volumes ( phisycal volumes , pv ). usually these are either partitions on the block device (“disk”), or even block devices as a whole (if there are no partitions on them as such). I chose the number two only for illustration - you can include any number of (available) pv in the volume group ( volumes group , vg ), at least one.

You can see the big picture, for example, using the pvs , vgs and lvs programs. Here is an approximate conclusion for the picture shown (dimensions are conditional, given for illustration; pv1 is /dev/sda1 , pv2 - /dev/sda2 ):

 $ sudo pvs PV VG Fmt Attr PSize PFree /dev/sda1 vg1 lvm2 a-- 10g 0 /dev/sda2 vg1 lvm2 a-- 20g 0 $ sudo vgs VG #PV #LV #SN Attr VSize VFree vg1 2 2 0 wz--n- 30g 0 $ sudo lvs LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert lv1 vg1 -wi-ao---- 5g lv2 vg1 -wi-ao---- 25g 

At first you had it ( vg I do not draw to simplify the picture):

  pv1 +-----------+-----------+ | lv1 | lv2 | +-----------+-----------+ 

You have reduced the size of a pair of available lv (the free space is indicated by dots):

  pv1 +-------+---+-------+---+ | lv1 | . | lv2 | . | +-------+---+-------+---+ 

In principle, of course, you can “move” lv2 to the vacant space .

but, since your task is to transfer these lv (as part of vg1 ) to another block device, then the most reasonable way would be:

  1. create a physical volume on this new block device:

     $ sudo pvcreate новое-блочное-устройство 

    hereafter, the новое/старое-блочное-устройство is either the entire “disk” (for example, /dev/sdb ), or the partition into a partitioned “disk” (for example, /dev/sdb1 )

  2. Add this pv to your vg1 volume group :

     $ sudo vgextend vg1 новое-блочное-устройство 
  3. “Release” the pv старое-блочное-устройство from logical volumes (this is the longest operation - information from one pv to another (s) will be copied):

     $ sudo pvmove старое-блочное-устройство 
  4. remove pv старое-блочное-устройство from volume group vg1 :

     $ sudo vgreduce vg1 старое-блочное-устройство 
  • ** It is better to read in the question, here the whole format has gone somewhere. ** in my list of block devices: $ sudo pvs PV VG Fmt Attr PSize PFree / dev / sda2 vg01 lvm2 a-- 58.64g 20.64g How to name a block device? Suppose / dev / sda3. I do: $ sudo pvcreate / dev / sda3 Device / dev / sda3 not found (or ignored by filtering). What am I doing wrong? - asianirish
  • /dev/sda2 , in the pv column. - aleksandr barakin
  • and the old-block-device then what will happen? - asianirish
  • this is the "old". the one that is now included in the volume group vg01 - aleksandr barakin
  • and “new” is the one that you connected to the computer to transfer information to it. - aleksandr barakin