1

I have some VPS with weird (for me) disc structure:

root@Debian1:~# lsblk 
NAME           MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
fd0              2:0    1    4K  0 disk 
sda              8:0    0   20G  0 disk 
├─sda1           8:1    0  476M  0 part /boot
├─sda2           8:2    0  9,5G  0 part 
│ ├─vg-lv_root 254:0    0 17,7G  0 lvm  /
│ └─vg-lv_swap 254:1    0  1,9G  0 lvm  [SWAP]
└─sda3           8:3    0   10G  0 part 
  └─vg-lv_root 254:0    0 17,7G  0 lvm  /
sr0             11:0    1 1024M  0 rom 

I don't know why / is split into sda2 and sda3. This is normal?

I don't need swap partition, how I can use it space as /?

root@Debian1:~# df -kh
System plików  rozm. użyte dost. %uż. zamont. na
/dev/dm-0        18G   18G     0 100% /
udev             10M     0   10M   0% /dev
tmpfs           201M   25M  176M  13% /run
tmpfs           501M     0  501M   0% /dev/shm
tmpfs           5,0M     0  5,0M   0% /run/lock
tmpfs           501M     0  501M   0% /sys/fs/cgroup
/dev/sda1       461M   33M  405M   8% /boot
tmpfs           101M     0  101M   0% /run/user/0

I have additional partitions with too much space (boot and all tmpfs) I want to use part of its space as /

1 Answer 1

2

All the tmpfs filesystems you see are pseudo filesystems. They do not reside on disk so won't help you get disk space back.

With regard to the disk being split over two partitions, what you are seeing is an LVM partition. One logical partition has been configured to distribute itself over 2 physical partitions. It is 'normal' but why you've done it I'm not sure. Perhaps the disk was already partitioned up this way when you installed and you didn't rewrite the partition table?

So to answer your question:

DISCLAIMER! Manipulating partitions can be a dangerous activity. Make sure you have a backup of your data before doing any of this.

I wouldn't touch the boot partition, 500MB is a good minimum and if you made it any smaller you may have trouble updating your kernel in the future.

If you're absolutely sure you don't need a swap partition, that's very easy to do. First, turn off the swap:

swapoff -a

Open up /etc/fstab and comment out the line for the swap partition. It should be something like /dev/mapper/vg-lv_swap. Note this path as we'll need it for the next command.

Now remove the logical swap partition:

lvremove /dev/mapper/vg-lv-swap

Type:

pvs

and you should see there is some free space on the LVM physical volume. You can now extend the / logical volume to occupy this free space.

lvextend /dev/mapper/vg-lv-root -l 100%PVS

You should see a message that the partition has expanded. Now you need to expand the underlying filesystem. How you do this depends on the filesystem. See http://tldp.org/HOWTO/LVM-HOWTO/extendlv.html for a guide.

To find out what filesystem your / partition is using:

lsblk -f

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .