Re: About to format the whole laptop, need some partitioning advice.
On Mon, Feb 10, 2014 at 10:46:59PM +0530, Anubhav Yadav wrote:
> >From the three possible choice you have enlisted me, I think lvm seems
> to be the best option for me, '
> so that I can give very little allocation to /var or /temp, and I can
> later expand these logical volumes whenever
> required?
>
> A couple of questions:
>
> 1) Suppose I give more allocation to /var and later find out that I
> require more space for /home partition,
> can I shrink my /temp partition and increase my /home partition?
This depends upon whether the filesystem supports shrinking and if
shrinking is possible. I've never tried it.
Normally you would just not allocate the space until you really
need it. Example:
ravenclaw# pvs
PV VG Fmt Attr PSize PFree
/dev/sdb4 ravenclaw lvm2 a-- 256.00g 207.51g
ravenclaw# vgs
VG #PV #LV #SN Attr VSize VFree
ravenclaw 1 4 0 wz--n- 256.00g 207.51g
ravenclaw# lvs
LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert
btrsnap ravenclaw -wi-a----- 6.00g
chroots ravenclaw -wi-ao---- 12.00g
swap ravenclaw -wi-ao---- 14.90g
var ravenclaw -wi-ao---- 15.59g
% mount | grep ravenclaw
/dev/mapper/ravenclaw-var on /var type ext4 (rw,nodev,relatime,data=ordered)
/dev/mapper/ravenclaw-chroots on /srv/chroots type ext4 (rw,relatime,data=ordered)
So here I have 50GiB allocated to four logical volumes, and
over 200GiB unallocated. I can create new LVs, make snapshots
and new LVs with this free space. In terms of disc partitions,
there's just one (/dev/sdb4).
Basically, I'm recommending that you allocate space for just
what you need, plus a little spare, and then you won't need
to shrink anything to free up space--it will just be available.
If you need space for anything special-purpose, just create
an LV for it, and when you're done you can delete it and free
up the space for something else.
> 2) I need to find how to increase the partitions in LVM, can they be
> easily done using gparted?
No. The partitions, as in real disc partitions, don't change size
once it's set up. Use lvextend to increase the size of a logical
volume. Here's an example extending one of the above LVs from 12
to 13GiB:
ravenclaw# df /srv/chroots
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/ravenclaw-chroots 12254384 4632220 6976636 40% /srv/chroots
ravenclaw# lvextend --size +1G --resizefs /dev/ravenclaw/chroots
Extending logical volume chroots to 13.00 GiB
Logical volume chroots successfully resized
resize2fs 1.42.9 (4-Feb-2014)
Filesystem at /dev/mapper/ravenclaw-chroots is mounted on /srv/chroots; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
The filesystem on /dev/mapper/ravenclaw-chroots is now 3407872 blocks long.
ravenclaw# df /srv/chroots
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/ravenclaw-chroots 13286512 4632220 7966824 37% /srv/chroots
So you can see the size increased by 1GiB and we didn't even have
to unmount the filesystem--it all happened online with no
interruption in service.
Regards,
Roger
--
.''`. Roger Leigh
: :' : Debian GNU/Linux http://people.debian.org/~rleigh/
`. `' schroot and sbuild http://alioth.debian.org/projects/buildd-tools
`- GPG Public Key F33D 281D 470A B443 6756 147C 07B3 C8BC 4083 E800
Reply to: