How to adjust partition size in Live CD

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
sagesheep

How to adjust partition size in Live CD

Post by sagesheep »

Hello!

So this is my very first time I have felt compelled to ask for help. Most of the time, you can just Google and simple instructions how to do things can be found somewhere on the web. Originally what I wanted to do was to install Windows 10 as dual boot on my laptop that already has Mint installed. To do so I want to create two new partitions, one to install Windows 10 on, and another one to boot the Windows installation from. To do this, I come to learn that I need to change the partition size using Live CD. It was recommended that I used system-config-lvm to do so. When attempting to do so I get the following error:

Code: Select all

Logical volume is not mounted but is in use. Please close all applications using this device (eg iscsi)
I have a very vague understanding what this even means. What is a logical volume? What does it mean for a logical volume to be mounted? How can a logical volume be unmounted but not in use? What "device" does the Live CD use? What is an "application" and a "device" in this context? Are we talking about programs you can see with the top command in terminal? Is the device simply the physical hard-drive? And what does it mean for a application to use a device? Also what is iscsi?

So what I need help with is to understand what this error message even means. And how I can adjust the partition size so that I can create two new partitions for the Windows installation.

Here are some more details on the machine:

Code: Select all

mint@mint ~ $ sudo vgdisplay
  --- Volume group ---
  VG Name               mint-vg
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               930.53 GiB
  PE Size               4.00 MiB
  Total PE              238216
  Alloc PE / Size       238216 / 930.53 GiB
  Free  PE / Size       0 / 0   
  VG UUID               F0JrlX-AJzq-UHwf-1s1h-i4eP-NIUN-M4GZgT
   
mint@mint ~ $ sudo lvdisplay
  --- Logical volume ---
  LV Path                /dev/mint-vg/root
  LV Name                root
  VG Name                mint-vg
  LV UUID                IopTKq-SvnP-3Qnd-Hm52-osaI-WS14-Fqrb0c
  LV Write Access        read/write
  LV Creation host, time mint, 2017-05-18 21:49:24 +0000
  LV Status              available
  # open                 0
  LV Size                918.64 GiB
  Current LE             235171
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:0
   
  --- Logical volume ---
  LV Path                /dev/mint-vg/swap_1
  LV Name                swap_1
  VG Name                mint-vg
  LV UUID                jVQrf2-5eHF-clXB-e4Ql-7Icz-iQRC-tQhMZQ
  LV Write Access        read/write
  LV Creation host, time mint, 2017-05-18 21:49:24 +0000
  LV Status              available
  # open                 0
  LV Size                11.89 GiB
  Current LE             3045
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:1
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
WharfRat

Re: How to adjust partition size in Live CD

Post by WharfRat »

Hello sagesheep Image

Welcome to Linux Mint and the Linux Mint forum :)

A logical volume is your data area within a volume group within an array of physical volumes, in your case one.

You chose the LVM or encrypted option when installing Mint.

The LVM concept is to make one contiguous device from several devices e.g., three 1TB drives/partitions appear as one 3TB block device.

To free up space on the partition use pvresize e.g., pvresize --setphysicalvolumesize 40G /dev/sda1
sagesheep

Re: How to adjust partition size in Live CD

Post by sagesheep »

Dear WharfRat,

I have now tested out what you suggested. It was unclear if you advice was ment to be done on the Live CD or if it also works when booted up on Mint on the harddrive. Here is the output from terminal:

Code: Select all

sagesheep@Entheos ~ $ sudo pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda3
  VG Name               mint-vg
  PV Size               930,54 GiB / not usable 4,00 MiB
  Allocatable           yes (but full)
  PE Size               4,00 MiB
  Total PE              238216
  Free PE               0
  Allocated PE          238216
  PV UUID               9hV8CP-5i25-kDGS-6nbN-kOJm-Pqif-BIIq0A
   
sagesheep@Entheos ~ $ sudo pvresize --setphysicalvolumesize 120G /dev/sda3
  /dev/sda3: cannot resize to 30719 extents as 238216 are allocated.
  0 physical volume(s) resized / 1 physical volume(s) not resized
sagesheep@Entheos ~ $ 
I find it hard to believe that 100% of the near 1TB disk space is used up already...

On Live CD there appears to be similar problems:

Code: Select all

mint@mint / $ sudo pvs --units G
  PV         VG      Fmt  Attr PSize   PFree
  /dev/sda3  mint-vg lvm2 a--  999.15G    0G
mint@mint / $ sudo vgs --units G
  VG      #PV #LV #SN Attr   VSize   VFree
  mint-vg   1   2   0 wz--n- 999.15G    0G
mint@mint / $ sudo lvs --units G
  LV     VG      Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root   mint-vg -wi-ao---- 986.38G                                                    
  swap_1 mint-vg -wi-a-----  12.77G 
  mint@mint / $ df -h
Filesystem                 Size  Used Avail Use% Mounted on
udev                       5.8G     0  5.8G   0% /dev
tmpfs                      1.2G  9.4M  1.2G   1% /run
/dev/sr0                   1.7G  1.7G     0 100% /cdrom
/dev/loop0                 1.7G  1.7G     0 100% /rofs
/cow                       5.9G   57M  5.8G   1% /
tmpfs                      5.9G   26M  5.8G   1% /dev/shm
tmpfs                      5.0M  4.0K  5.0M   1% /run/lock
tmpfs                      5.9G     0  5.9G   0% /sys/fs/cgroup
tmpfs                      5.9G  4.0K  5.9G   1% /tmp
cgmfs                      100K     0  100K   0% /run/cgmanager/fs
tmpfs                      1.2G   28K  1.2G   1% /run/user/999
/dev/mapper/mint--vg-root  786G  246G  500G  33% /media/mint/19e97d1d-cbd3-4a62-a116-d6f898ec3bd3
  mint@mint ~ $ sudo pvresize --setphysicalvolumesize 120g /dev/sda3 
  /dev/sda3: cannot resize to 30719 extents as 238216 are allocated.
  0 physical volume(s) resized / 1 physical volume(s) not resized
So why would it say that PFree is 0G?
sagesheep

Re: How to adjust partition size in Live CD

Post by sagesheep »

WharfRat wrote:You chose the LVM or encrypted option when installing Mint.
I don't know what option that has been selected during install. Perhaps these images from GParted can give some clarity:

Screenshot from 2017-12-09 21-57-28.png[/attachment [attachment=0]Screenshot from 2017-12-09 21-56-39.png
WharfRat

Re: How to adjust partition size in Live CD

Post by WharfRat »

Well clearly sda3 is a LVM member.

The Mint installer defaults to the entire size of the partition after creating a small /boot and if necessary a swap partition.
Locked

Return to “Beginner Questions”