LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Laptop and Netbook
User Name
Password
Linux - Laptop and Netbook Having a problem installing or configuring Linux on your laptop? Need help running Linux on your netbook? This forum is for you. This forum is for any topics relating to Linux and either traditional laptops or netbooks (such as the Asus EEE PC, Everex CloudBook or MSI Wind).

Notices


Reply
  Search this Thread
Old 11-22-2017, 05:24 PM   #1
Witch-y
LQ Newbie
 
Registered: Nov 2017
Distribution: Debian
Posts: 3

Rep: Reputation: Disabled
Drive completely filled with an LVM partition


Almost a year ago, I installed Debian on my laptop, and following the advice of a video, set the partition to LVM. Somehow, the partition takes nearly all of the drive, not leaving enough space to make any other partitions. I must have done this at some point.

Now, I would like to install other operating systems, but I can't seem to shrink the Debian partition. I can't shrink it inside Debian, because the partition is mounted, and I can't shrink it from any live USBs I've tried.

I haven't used nearly all of the Debian partition, so if any of you know a way to do so, it would be much appreciated if you would share.
If it is, indeed, impossible, letting me know would also be helpful.

Thanks.

Last edited by Witch-y; 11-22-2017 at 05:41 PM.
 
Old 11-22-2017, 06:06 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 15,987

Rep: Reputation: 2217Reputation: 2217Reputation: 2217Reputation: 2217Reputation: 2217Reputation: 2217Reputation: 2217Reputation: 2217Reputation: 2217Reputation: 2217Reputation: 2217
From within Debian (with the lv mounted) run these and post the output - use [code] tags so we can read them.
Code:
df -hT
lsblk -f
sudo parted /dev/sda "print free"
Change /dev/sda in need. If there is space available, things can be accommodated fairly easily - unless using XFS.
 
Old 11-22-2017, 08:20 PM   #3
tofino_surfer
Member
 
Registered: Aug 2007
Posts: 200

Rep: Reputation: 63
It is very much possible to share an LVM VG with multiple versions of Linux. There is no need to shrink the LVM partition itself but I do recommend renaming the volume group from 'Debian' or whatever it is to something like 'linux-shared'. You would shrink the LVM logical volumes inside the VG to create freed extents. You would then use this space to create new logical volumes on which to install new OSs. On another forum (Fedora Forum) I was involved in a long thread involving a poster who wanted to share an LVM VG with two Linux distros. After much guidance they were able to install a second OS inside the same VG and rename the VG as well.

Please run the following commands and post the results.

Code:
sudo vgdisplay
sudo lvdisplay
sudo pvdisplay
df -hT
Quote:
Now, I would like to install other operating systems, but I can't seem to shrink the Debian partition. I can't shrink it inside Debian, because the partition is mounted, and I can't shrink it from any live USBs I've tried.
You can't modify a mounted filesystem but you can do it from a live distro. You would need to chroot into the environment first. There are many guides on how to do this. You would only shrink the logical volumes to create space inside the VG and would not shrink the LVM PV partition.
 
Old 11-22-2017, 09:13 PM   #4
Witch-y
LQ Newbie
 
Registered: Nov 2017
Distribution: Debian
Posts: 3

Original Poster
Rep: Reputation: Disabled
syg00:
I always have a backup of my data. Thanks for the reminder
Here are the outputs of the commands:

Code:
 william@william:~$ df -hT
Filesystem                   Type      Size  Used Avail Use% Mounted on
udev                         devtmpfs  3.9G     0  3.9G   0% /dev
tmpfs                        tmpfs     791M   18M  773M   3% /run
/dev/mapper/william--vg-root ext4      909G  108G  755G  13% /
tmpfs                        tmpfs     3.9G   43M  3.9G   2% /dev/shm
tmpfs                        tmpfs     5.0M  4.0K  5.0M   1% /run/lock
tmpfs                        tmpfs     3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/sda2                    ext2      237M   80M  145M  36% /boot
/dev/sda1                    vfat      511M  7.3M  504M   2% /boot/efi
tmpfs                        tmpfs     791M   20K  791M   1% /run/user/118
tmpfs                        tmpfs     791M   48K  791M   1% /run/user/1000
william@william:~$ lsblk -f
NAME                   FSTYPE      LABEL UUID                                   MOUNTPOINT
sda                                                                             
├─sda1                 vfat              F51B-41A2                              /boot/efi
├─sda2                 ext2              6a69d6cc-0e34-473f-ac76-2014bbe46ac2   /boot
└─sda3                 LVM2_member       3SJgvo-BaKB-hYg3-Atye-fCt4-CvYI-S7GWGe 
  ├─william--vg-root   ext4              39fc75e9-d347-46d3-ad67-ca3ecc66743c   /
  └─william--vg-swap_1 swap              fb91bbf6-c284-4212-ba0a-c77d04ee4136   [SWAP]
sr0                                                                             
william@william:~$ su
Password: 
root@william:/home/william# parted /dev/mapper/william--vg-root "print free"
Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/william--vg-root: 991GB
Sector size (logical/physical): 512B/4096B
Partition Table: loop
Disk Flags: 

Number  Start  End    Size   File system  Flags
 1      0.00B  991GB  991GB  ext4
I assumed you wanted the last command to be applied to the Debian partition.

tofino surfer:
Here are the outputs of the commands:

Code:
 root@william:/home/william# vgdisplay
  --- Volume group ---
  VG Name               william-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               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               930.77 GiB
  PE Size               4.00 MiB
  Total PE              238277
  Alloc PE / Size       238277 / 930.77 GiB
  Free  PE / Size       0 / 0   
  VG UUID               2MaCrA-SuFG-ekNO-Clt6-8W6L-qefX-Nfo7xx
   
root@william:/home/william# lvdisplay
  --- Logical volume ---
  LV Path                /dev/william-vg/root
  LV Name                root
  VG Name                william-vg
  LV UUID                xG76MZ-ZXqp-Vea4-RzQ3-GI9u-KkAR-NG5xRg
  LV Write Access        read/write
  LV Creation host, time william, 2017-05-29 19:29:32 -0500
  LV Status              available
  # open                 1
  LV Size                922.85 GiB
  Current LE             236250
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:0
   
  --- Logical volume ---
  LV Path                /dev/william-vg/swap_1
  LV Name                swap_1
  VG Name                william-vg
  LV UUID                ZMI3Og-1taQ-q2JS-pso6-g5wB-KvZ1-A24arg
  LV Write Access        read/write
  LV Creation host, time william, 2017-05-29 19:29:32 -0500
  LV Status              available
  # open                 2
  LV Size                7.92 GiB
  Current LE             2027
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:1
   
root@william:/home/william# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda3
  VG Name               william-vg
  PV Size               930.77 GiB / not usable 4.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              238277
  Free PE               0
  Allocated PE          238277
  PV UUID               3SJgvo-BaKB-hYg3-Atye-fCt4-CvYI-S7GWGe
   
root@william:/home/william# df -hT
Filesystem                   Type      Size  Used Avail Use% Mounted on
udev                         devtmpfs  3.9G     0  3.9G   0% /dev
tmpfs                        tmpfs     791M   18M  773M   3% /run
/dev/mapper/william--vg-root ext4      909G  108G  755G  13% /
tmpfs                        tmpfs     3.9G   44M  3.9G   2% /dev/shm
tmpfs                        tmpfs     5.0M  4.0K  5.0M   1% /run/lock
tmpfs                        tmpfs     3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/sda2                    ext2      237M   80M  145M  36% /boot
/dev/sda1                    vfat      511M  7.3M  504M   2% /boot/efi
tmpfs                        tmpfs     791M   20K  791M   1% /run/user/118
tmpfs                        tmpfs     791M   48K  791M   1% /run/user/1000
Thanks to you both for the help.
 
Old 11-22-2017, 09:45 PM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 15,987

Rep: Reputation: 2217Reputation: 2217Reputation: 2217Reputation: 2217Reputation: 2217Reputation: 2217Reputation: 2217Reputation: 2217Reputation: 2217Reputation: 2217Reputation: 2217
Quote:
Originally Posted by Witch-y View Post
I assumed you wanted the last command to be applied to the Debian partition.
Bad assumption - run the command I posted.

Nothing there to indicate why resizing wouldn't work. You always have to work from the "inside-out". Resize the filesystem first, then the lv (gparted will do this together for you), then vg, then pv. Or as mentioned you could leave the pv, and use the space as-is, but that gets more tricky.
Use a liveCD and show us what you tried, and what happened.
 
Old 11-23-2017, 12:18 AM   #6
tofino_surfer
Member
 
Registered: Aug 2007
Posts: 200

Rep: Reputation: 63
You have a very simple arrangement with a huge root partition, mostly empty, and a small swap partition.

Code:
root@william:/home/william# df -hT
Filesystem                   Type      Size  Used Avail Use% Mounted on
/dev/mapper/william--vg-root ext4      909G  108G  755G  13% /
You could easily shrink this root partition by 600 GB or more and use that space to install a second or third OS as well as create large data partitions. If you will be multi-booting I highly recommend having separate data partitions to keep all of your files and documents. The home directories in the two (or more) linux distros should be mostly empty with only local configuration files but all of your personal files being in the shared data partitions. The actual / root directory of a Linux distro only requires 10-15 GB and can easily be expanded if needed. Most of the 600-700 GB should be used for data partitions.

It will be far easier and safer to simply shrink this large root LV and create as many partitions as you want than to try to shrink the LVM PV and create regular partitions if you are simply trying to install other Linux distributions. If you want to install Windows or BSD operating systems then that is another matter.

The following command will set the new size of the root LV at 150GB thus freeing about 700 GB of space in the form of freed logical extents to create new partitions. It will also resize the underlying ext4 file system using fsadm.

Code:
sudo lvreduce --resizefs --size 150G william--vg/root
To install a second OS I would only create a new LV of around 15 GB with the name of the OS you want to install such as 'Suse-root'. As long as the installer of the second OS can install to LVM logical volumes you will be fine. If not you may have to do a temporary installation to an external disk and then copy the installation over to the logical volumes.

In the thread on FedoraForum I was involved in the OP had a Fedora LVM installation. They renamed the VG from 'fedora' to 'linux-shared', shrunk the Fedora root LV and then installed Open Suse Tumbleweed in the freed space. It all worked for them.

With all of the space you can create separate data logical volumes for documents, photos, videos etc. to organize everything. You would put symlinks to these LVs in the respective home directories.
 
Old 11-23-2017, 01:07 AM   #7
Witch-y
LQ Newbie
 
Registered: Nov 2017
Distribution: Debian
Posts: 3

Original Poster
Rep: Reputation: Disabled
Many thanks to both of you.
I worked it out and now have plenty of open space. I'll be sure to not make that mistake again. I learned a lot from this experience.

I will mark the thread as solved now.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
fsck.ext4 zero-filled Files on a lvm-partition because of dying drive DrBenzo Linux - Newbie 5 01-24-2014 08:44 AM
PhotoRec completely filled home - can not remove the recup_dir.# directories Herbivore Linux - Newbie 3 06-03-2013 01:47 PM
Recovering data from a hard drive with LVM a partition ShadyCraig Linux - Software 6 01-21-2010 03:03 AM
[SOLVED] Cannot read LVM Partition from SATA Drive asuderma Linux - Hardware 16 10-13-2009 05:40 PM
Is it necessary to partition a drive in use w/ LVM? stgrob Linux - Enterprise 7 01-09-2008 06:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Laptop and Netbook

All times are GMT -5. The time now is 04:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration