Re: Resizing partitions on a headless server
Pascal Hambourg <pascal@plouf.fr.eu.org> writes:
> csanyipal@gmail.com a écrit :
>>
>> Finally, I solved the problem by doing the followings:
>> # lvresize --size 455.5G /dev/mapper/bubba-storage
>> # e2fsck -f /dev/mapper/bubba-storage
>
> Glad you were lucky.
>
>> What is my goal?
>>
>> Filesystem Size Used Avail Use% Mounted on
>> /dev/root 9.2G 8.0G 815M 91% /
>> devtmpfs 125M 0 125M 0% /dev
>> tmpfs 125M 4.0K 125M 1% /dev/shm
>> tmpfs 125M 5.6M 120M 5% /run
>> tmpfs 5.0M 0 5.0M 0% /run/lock
>> tmpfs 125M 0 125M 0% /sys/fs/cgroup
>> /dev/mapper/bubba-storage 449G 8.2G 418G 2% /home
>> tmpfs 25M 0 25M 0% /run/user/1001
>> As one can see, my /dev/root partition is almost full.
>> I want to increase /dev/root partition to be maximum available size and
>> decrease /home partition to only 20 GiB.
>>
>> So can be the /var directory large enough to encompass the web and other
>> contents.
>>
>> What are your advises, what do I do to reach my goal?
>
> Do not resize partitions. This is difficult and risky. Use LVM.
> Reduce the filesystem in the LV and the LV to a adequate size (without
> mistake this time).
I did this step successfully:
root@b2:~# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name bubba
PV Size 455.43 GiB / not usable 3.65 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 116588
Free PE 111442
Allocated PE 5146
PV UUID
SMvR2K-6Z3c-xCgd-jSR2-kb1A-15a2-3RiS6V
root@b2:~# lvdisplay
--- Logical volume ---
LV Path /dev/bubba/storage
LV Name storage
VG Name bubba
LV UUID 91yHxQ-RmOW-OeDv-jaIv-1z1B-KBSk-yCsDC6
LV Write Access read/write
LV Creation host, time ,
LV Status available
# open 1
LV Size 20.10 GiB
Current LE 5146
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
> Create a new LV of adequate size. DON'T take all the available space in
> the VG. Leave some space for future needs. Increasing a LV and its
> filesystem is easy and can be done online while it's mounted. Reducing
> is risky, as you experienced.
I want to create one LV for /usr and one LV for /var.
But I can't create a LV with:
# lvcreate --size 10.10G -n usr bubba
Rounding up size to full physical extent 10.10 GiB
/dev/bubba/usr: not found: device not cleared
Aborting. Failed to wipe start of new LV.
semid 1114120: semop failed for cookie 0xd4d6ff6: incorrect
semaphore state
Failed to set a proper state for notification semaphore
identified by cookie value 223178742 (0xd4d6ff6) to initialize
waiting for incoming notifications.
I don't understand why can't create a new LV with this command abowe?
And don't understand why is successful following command?
# lvcreate -vvv --size 10.10G -n usr bubba
I search on Internet and found another solution:
# lvcreate -Zn --size 10.10G -n usr bubba
Rounding up size to full physical extent 10.10 GiB
WARNING: "bubba/usr" not zeroed
Logical volume "usr" created
semid 1146888: semop failed for cookie 0xd4d9b50: incorrect
semaphore state
Failed to set a proper state for notification semaphore
identified by cookie value 223189840 (0xd4d9b50) to initialize
waiting for incoming notifications.
Can I use now this newly created LV to make on it an ext4 filesystem
despite the fact that it is not zeroed?
--
Regards from Pal
Reply to: