0

On virtual box, I have my root file system mounted on the LVM:

# df -h | head -n 2 | tail -n 1
/dev/mapper/cl-root  1.5G  951M  404M  71% /

The LVM is mounted on /dev/sda2, and /dev/sda has the following table:

# parted /dev/sda print | grep MB
Disk /dev/sda: 8590MB
1    1049kB   1075MB   1074MB    primary   ext4    boot
2    1075MB   3511MB   2436MB    primary           lvm

I want to add swap space and a new logical volume 700MB in size - what's best practice for doing this given the above?

I've tried adding a new LVM partition, /dev/sda3, but after a reboot I just got a black screen.

category
  • 103
  • 4

1 Answers1

3

You have many mistakes in your question:

  1. You can't mount LVM because it isn't filesystem. Filesystems may be placed on whole disk or its partitions, on LVM or ZFS volumes or on network storages. Filesystems may be VFAT(FAT32), NTFS, ext3, ext4, xfs, raizerfs, btrfs and etc.

  2. The partition /dev/sda2 is used by LVM PV (physical volume). LVM VG (volume group) is based on PV. You can create LV (logical volume) in LVM volume group and then you can create filesystem on LVM.

  3. To show LVM logical volumes you should use command lvdisplay. To show LVM volume groups you should use command vgdisplay. To show LVM physical volumes you should use command `pvdisplay.

If you want add new LVM logical volume with size 700Mb use command:

lvcreate -n some_name -L 700M vg0

Where vg0 is name of LVM volume group.

If you want add 1G swap to your system then do:

# lvcreate -n lvswap -L 1G vg0
# mkswap /dev/vg0/lvswap
# blkid | grep swap
/dev/mapper/lvswap: UUID="vvvvvvvv-wwww-xxxx-yyyy-zzzzzzzzzzzz" TYPE="swap"
# echo "UUID=vvvvvvvv-wwww-xxxx-yyyy-zzzzzzzzzzzz none swap sw 0 0" >> /etc/fstab
# swapon -a
Mikhail Khirgiy
  • 2,003
  • 9
  • 7