I just replaced my 500GB drive with a 1TB drive. I used a duper to copy the 500GB to the 1TB. Now I am trying to expand the partition (/dev/sda3
) to take advantage of the new space. Here are (the most recent) commands I've tried. I'd like to do with without gparted
because I only have SSH access to the machine.
tiny@ubuntu:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 931.5G 0 disk
├─sda1 8:1 0 512M 0 part /boot/efi
├─sda2 8:2 0 488M 0 part /boot
└─sda3 8:3 0 929.4G 0 part
└─ubuntu--vg-root 252:0 0 464.8G 0 lvm /
tiny@ubuntu:~$ sudo resize2fs /dev/mapper/ubuntu--vg-root
resize2fs 1.42.13 (17-May-2015)
The filesystem is already 121839616 (4k) blocks long. Nothing to do!
tiny@ubuntu:~$ sudo lvextend /dev/mapper/ubuntu--vg-root /dev/sda3
No free extents on physical volume "/dev/sda3".
No specified PVs have space available.
tiny@ubuntu:~$
Here's what did it:
sudo pvresize /dev/sda3
sudo lvresize -l +100%FREE /dev/mapper/ubuntu--vg-root
sudo resize2fs /dev/mapper/ubuntu--vg-root
and here's the output:
tiny@ubuntu:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 931.5G 0 disk
├─sda1 8:1 0 512M 0 part /boot/efi
├─sda2 8:2 0 488M 0 part /boot
└─sda3 8:3 0 929.4G 0 part
└─ubuntu--vg-root 252:0 0 464.8G 0 lvm /
tiny@ubuntu:~$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 95G 0 95G 0% /dev
tmpfs 19G 11M 19G 1% /run
/dev/mapper/ubuntu--vg-root 458G 239G 198G 55% /
tmpfs 95G 0 95G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 95G 0 95G 0% /sys/fs/cgroup
/dev/sda2 473M 120M 329M 27% /boot
/dev/sda1 511M 3.4M 508M 1% /boot/efi
tmpfs 19G 0 19G 0% /run/user/1000
tiny@ubuntu:~$ sudo pvresize /dev/sda3
Physical volume "/dev/sda3" changed
1 physical volume(s) resized / 0 physical volume(s) not resized
tiny@ubuntu:~$ sudo lvresize -l +100%FREE /dev/mapper/ubuntu--vg-root
Size of logical volume ubuntu-vg/root changed from 464.78 GiB (118984 extents) to 929.41 GiB (237929 extents).
Logical volume root successfully resized.
tiny@ubuntu:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 931.5G 0 disk
├─sda1 8:1 0 512M 0 part /boot/efi
├─sda2 8:2 0 488M 0 part /boot
└─sda3 8:3 0 929.4G 0 part
└─ubuntu--vg-root 252:0 0 929.4G 0 lvm /
tiny@ubuntu:~$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 95G 0 95G 0% /dev
tmpfs 19G 11M 19G 1% /run
/dev/mapper/ubuntu--vg-root 458G 239G 198G 55% /
tmpfs 95G 0 95G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 95G 0 95G 0% /sys/fs/cgroup
/dev/sda2 473M 120M 329M 27% /boot
/dev/sda1 511M 3.4M 508M 1% /boot/efi
tmpfs 19G 0 19G 0% /run/user/1000
tiny@ubuntu:~$ sudo resize2fs /dev/mapper/ubuntu--vg-root
resize2fs 1.42.13 (17-May-2015)
Filesystem at /dev/mapper/ubuntu--vg-root is mounted on /; on-line resizing required
old_desc_blocks = 30, new_desc_blocks = 59
The filesystem on /dev/mapper/ubuntu--vg-root is now 243639296 (4k) blocks long.
tiny@ubuntu:~$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 95G 0 95G 0% /dev
tmpfs 19G 11M 19G 1% /run
/dev/mapper/ubuntu--vg-root 915G 239G 637G 28% /
tmpfs 95G 0 95G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 95G 0 95G 0% /sys/fs/cgroup
/dev/sda2 473M 120M 329M 27% /boot
/dev/sda1 511M 3.4M 508M 1% /boot/efi
tmpfs 19G 0 19G 0% /run/user/1000
tiny@ubuntu:~$
No comments:
Post a Comment