0

I enlarged LV swap from 1G to 4G. I also moved / and /home in a single PV to two different LVs, by shrinking LV root and create LV home on the freed space, and then following https://askubuntu.com/a/923943/1471

$ sudo mkdir /mnt/home
$ sudo mount /dev/mapper/lubuntu--vg-home  /mnt/home/
$ sudo cp -r /home/* /mnt/home/
$ sudo mv /home /home-orig
$ sudo mkdir /home

and modified /etc/fstab into the following content, where I renamed /dev/mapper/lubuntu--vg-swap_1 to /dev/mapper/lubuntu--vg-swap (because I have renamed LV from default name swap_1 to swap by lvrename), and add a line for mounting /dev/mapper/lubuntu--vg-home at /home.

$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
/dev/mapper/lubuntu--vg-root /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sda1 during installation
UUID=0C1E-EE69  /boot/efi       vfat    umask=0077      0       1
/dev/mapper/lubuntu--vg-swap none            swap    sw              0       0
# my change:
/dev/mapper/lubuntu--vg-home /home               ext4    defaults 0       2

After I reboot, it seems that LV home is correctly mounted at /home:

$ pwd
/home/t
t@olive:~$ df .
Filesystem                   1K-blocks   Used Available Use% Mounted on
/dev/mapper/lubuntu--vg-home 425480640 180336 403617312   1% /home

but there are two problems

  1. although I can still login in virtual console, I can't log in LXDE of Lubuntu.
  2. free shows that the swap size is still 1GB.

    $ free -h
                  total        used        free      shared  buff/cache   available
    Mem:           3.3G        196M        2.9G        5.3M        239M        2.9G
    Swap:          979M          0B        979M
    $ cat /proc/swaps 
    Filename                Type        Size    Used    Priority
    /dev/dm-1                               partition   1003516 0   -2
    $ ls /dev/mapper/ -la
    total 0
    drwxr-xr-x  2 root root     120 Feb 23 16:47 .
    drwxr-xr-x 22 root root    4260 Feb 23 16:47 ..
    crw-------  1 root root 10, 236 Feb 23 16:47 control
    lrwxrwxrwx  1 root root       7 Feb 23 16:52 lubuntu--vg-home -> ../dm-2
    lrwxrwxrwx  1 root root       7 Feb 23 16:52 lubuntu--vg-root -> ../dm-0
    lrwxrwxrwx  1 root root       7 Feb 23 16:52 lubuntu--vg-swap -> ../dm-1
    

How can I solve the problems? Thanks.

1

For starters your cp hasn't retained permissions or ownerships. Use cp -a instead of cp -r.

To be going on, you haven't resized swap itself, just the LV where swap is stored. You'll need to rerun mkswap.

  • Thanks. cp -a works. Strange. before that, why could I log into virtual console but not desktop environment? – Tim Feb 23 at 23:18
  • The GUI environment probably needs to write/create files in your home directory. A console login definitely doesn't. – roaima Feb 23 at 23:44
  • What files are written to or create if I may ask? – Tim Feb 24 at 0:12
  • A console login usually runs a shell, which usually needs to write command history to your $HOME. – 炸鱼薯条德里克 Feb 24 at 7:07
  • 炸鱼薯条德里克 a console login doesn't need to write command history. The session won't fail if the write fails. – roaima Feb 24 at 8:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.