Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


CentOS8 - Resize Partition after install
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

CentOS8 - Resize Partition after install

I installed Centoss8 on a vps. Enabled FDE/ Luks during install. I did not do custom partitioning. So, now, I am having /home with full size of the disk.

I would like to:
a. resize /home to around 10GB
b. Create /data and allocate it remaining space (around 450GB)

I am not familiar on how to achieve the same. Id prefer not to re-install (if possible)

Any suggestions? TIA

Comments

  • @plumberg said:
    I installed Centoss8 on a vps. Enabled FDE/ Luks during install. I did not do custom partitioning. So, now, I am having /home with full size of the disk.

    I would like to:
    a. resize /home to around 10GB
    b. Create /data and allocate it remaining space (around 450GB)

    I am not familiar on how to achieve the same. Id prefer not to re-install (if possible)

    Any suggestions? TIA

    Another easy option would be using mounting gparted :)

  • @seriesn said:

    @plumberg said:
    I installed Centoss8 on a vps. Enabled FDE/ Luks during install. I did not do custom partitioning. So, now, I am having /home with full size of the disk.

    I would like to:
    a. resize /home to around 10GB
    b. Create /data and allocate it remaining space (around 450GB)

    I am not familiar on how to achieve the same. Id prefer not to re-install (if possible)

    Any suggestions? TIA

    Another easy option would be using mounting gparted :)

    Umm... can you share some more details pls? Thank you :)

  • This is for our system :
    https://my.nexusbytes.com/knowledgebase/29/RepartitionorResizing-your-VM-Disk-Space.html

    If your current provider allows you to mount your own iso, https://gparted.org/livecd.php , you can do the same!

    Thanked by 1kkrajk
  • @seriesn said:
    This is for our system :
    https://my.nexusbytes.com/knowledgebase/29/RepartitionorResizing-your-VM-Disk-Space.html

    If your current provider allows you to mount your own iso, https://gparted.org/livecd.php , you can do the same!

    Awesome. currently, i do not have ability to mount an ISO... so, let me see what I can do. Thank you

  • For some reason, this is just showing me the boot and the whole partition.. I cannot seem to locate /, /home etc from parted... what could I be missing here? TIA

  • @plumberg said: Id prefer not to re-install

    A suggestion (esp. for the long run):

    1. Rather than have a huge partition, try to use LVM instead. It will allow you to dynamically size/resize use your resources better without having to go through the pain of repartitioning (again).

    2. Do it now since you only have at most 10GB of data from your home. Boot into rescue mode, copy over the 10GB of data into a temp location, create a single huge partition with the space and give it to LVM and then chunk it into whatever pieces you need whenever you need it.

    3. If you're upto it (I don't know about ZFS support in CentOS), use ZFS instead as it'll give you all the benefits without much pain. (relatively steepest learning curve here but well worth it in the long run). Needs good memory to work nicely (so not suggested unless you have at least 1GB+ surplus RAM for various ZFS overhead).

    So there you go:

    1. (simplest) repartition as you want (repent later when you need changes again)
    2. LVM (good degree of dynamic sizing/resizing/shrinking etc. all mostly online!)
    3. ZFS (relatively steep learning curve but useful in many ways. YMMV).

    P.S: Separately, in your case, you can also do this live without rescue mode. Unmount home, shrink fs to minimal size, repartition (keeping starting sector the same for the home mount and size > your used space and taking the rest for data mount), extend home fs, format data fs, remount home, enjoy.

  • @nullnothere said:

    @plumberg said: Id prefer not to re-install

    A suggestion (esp. for the long run):

    1. Rather than have a huge partition, try to use LVM instead. It will allow you to dynamically size/resize use your resources better without having to go through the pain of repartitioning (again).

    2. Do it now since you only have at most 10GB of data from your home. Boot into rescue mode, copy over the 10GB of data into a temp location, create a single huge partition with the space and give it to LVM and then chunk it into whatever pieces you need whenever you need it.

    3. If you're upto it (I don't know about ZFS support in CentOS), use ZFS instead as it'll give you all the benefits without much pain. (relatively steepest learning curve here but well worth it in the long run). Needs good memory to work nicely (so not suggested unless you have at least 1GB+ surplus RAM for various ZFS overhead).

    So there you go:

    1. (simplest) repartition as you want (repent later when you need changes again)
    2. LVM (good degree of dynamic sizing/resizing/shrinking etc. all mostly online!)
    3. ZFS (relatively steep learning curve but useful in many ways. YMMV).

    P.S: Separately, in your case, you can also do this live without rescue mode. Unmount home, shrink fs to minimal size, repartition (keeping starting sector the same for the home mount and size > your used space and taking the rest for data mount), extend home fs, format data fs, remount home, enjoy.

    Looks like its already LVM... having 3 partitions.. root/ swap/ home... so, I want to shrink /home and make a new one called /data with remaining space...

    Any suggestions on how to achieve this?

  • @plumberg said: Looks like its already LVM... having 3 partitions.. root/ swap/ home... so, I want to shrink /home and make a new one called /data with remaining space...

    Oh that makes your life easy.

    1. unmount /home
    2. fsck /dev/whatever/home
    3. resize2fs -M /dev/whatever/home (shrinks home FS to minimal size possible)
    4. lvresize ... home (RTFM for specifics to shrink home)
    5. resize2fs /dev/whatever/home (to resize FS to LVM size)
    6. lvcreate ... (your new data partition)
    7. mkfs.ext4 ... (your new data partition)
    8. mount /data

    (rough steps, RTFM for the fine print it should be pretty painless to get the numbers you want). It is loss less - so you can experiment safely.

    Hope this helps.

    Thanked by 1kkrajk
  • @nullnothere said:

    @plumberg said: Looks like its already LVM... having 3 partitions.. root/ swap/ home... so, I want to shrink /home and make a new one called /data with remaining space...

    Oh that makes your life easy.

    1. unmount /home
    2. fsck /dev/whatever/home
    3. resize2fs -M /dev/whatever/home (shrinks home FS to minimal size possible)
    4. lvresize ... home (RTFM for specifics to shrink home)
    5. resize2fs /dev/whatever/home (to resize FS to LVM size)
    6. lvcreate ... (your new data partition)
    7. mkfs.ext4 ... (your new data partition)
    8. mount /data

    (rough steps, RTFM for the fine print it should be pretty painless to get the numbers you want). It is loss less - so you can experiment safely.

    Hope this helps.

    Awesome. will try this.. Just wondering.. do I do this on the live system? or should I mount this somewhere? curreently, its a fresh install server, so theres no data.

  • @plumberg said: do I do this on the live system

    You can do this on the live system (as long as you are root and you can unmount /home, i.e no user mount/files active like via sudo). It is only because you are shrinking that you need the unmount. A typical LVM expand is online and disruption free.

  • @nullnothere said:

    @plumberg said: do I do this on the live system

    You can do this on the live system (as long as you are root and you can unmount /home, i.e no user mount/files active like via sudo). It is only because you are shrinking that you need the unmount. A typical LVM expand is online and disruption free.

    Awesome. Ill post my findings in sometime. Thank you

  • AlwaysSkintAlwaysSkint Member
    edited August 2020

    I stick to ext4 for my main partitions, instead of the default xfs, in order to shrink as well as expand. I presume that you can shrink zfs. (?) I've never had enough 'surplus' RAM to try using it.
    [tmp=ext2 as well as /backup]

  • @AlwaysSkint said:
    I stick to ext4 for my main partitions, instead of the default xfs, in order to shrink as well as expand. I presume that you can shrink zfs. (?) I've never had enough 'surplus' RAM to try using it.
    [tmp=ext2 as well as /backup]

    Well I didnt realize it was xfa. Decided to do anfresh install with ext4..

    Any reason to select xfs vs ext4?

  • @AlwaysSkint said: I presume that you can shrink zfs.

    This is a loaded question. ZFS the fs on top of a (Z)Pool (think LVM here) is autosized (dynamic sizing possible along with quota/reservations).

    At the lowest level, the Zpool itself cannot shrink - it can only grow.

    Roughly, equating PV/VG <-> Zpool, the Zpool cannot shrink (unlike a PV or a VG which can).

    At the LV <-> ZFS level (think ZFS instead of EXT2/3/4/XFS here) absolutely the norm and dynamic even. So you can have a huge PV/VG equivalent (that is fixed) Zpool and within it, your FSs which can grow/shrink etc. as required with all the benefits of ZFS (snapshots, quotas, etc.)

    @plumberg said: enough 'surplus' RAM to try using it

    This is the hard part. The larger the underlying device (i.e. space), the more RAM ZFS needs (or is advisable) for decent performance. But were talking ~2-5GB of RAM for <10TB of storage (for decent performance) so it's not gargantuan.

    Thanked by 1AlwaysSkint
  • What's wrong with not partitioned disk ? it's not like /home will take all of it. AFAIK it will share the space with /, I don't see any advantages of partitioning disk unless you plan to reinstall the server, and don't want /home get deleted.

  • @yokowasis said:
    What's wrong with not partitioned disk ? it's not like /home will take all of it. AFAIK it will share the space with /, I don't see any advantages of partitioning disk unless you plan to reinstall the server, and don't want /home get deleted.

    Huh? How does/home or any particular partition share space with /?

    I'd love to learn more... please.. this is new for me.

  • @plumberg said:

    @yokowasis said:
    What's wrong with not partitioned disk ? it's not like /home will take all of it. AFAIK it will share the space with /, I don't see any advantages of partitioning disk unless you plan to reinstall the server, and don't want /home get deleted.

    Huh? How does/home or any particular partition share space with /?

    I'd love to learn more... please.. this is new for me.

    When installed linux, if you opted to use single partition, / will use all the space, including /home, /data2 or any folder in /

    I failed to see, why would you want to allocate partition the disk to 10GB, and mount the partition to /home.

  • @yokowasis said:

    @plumberg said:

    @yokowasis said:
    What's wrong with not partitioned disk ? it's not like /home will take all of it. AFAIK it will share the space with /, I don't see any advantages of partitioning disk unless you plan to reinstall the server, and don't want /home get deleted.

    Huh? How does/home or any particular partition share space with /?

    I'd love to learn more... please.. this is new for me.

    When installed linux, if you opted to use single partition, / will use all the space, including /home, /data2 or any folder in /

    I failed to see, why would you want to allocate partition the disk to 10GB, and mount the partition to /home.

    Well I wanted to keep data in a separate partition... so when I saw the default partition system, it had just / root with like 20gb, some swap and remaining allotted to /home.. so I wasn't aware that space will be shared with / root

  • @plumberg said:

    @yokowasis said:

    @plumberg said:

    @yokowasis said:
    What's wrong with not partitioned disk ? it's not like /home will take all of it. AFAIK it will share the space with /, I don't see any advantages of partitioning disk unless you plan to reinstall the server, and don't want /home get deleted.

    Huh? How does/home or any particular partition share space with /?

    I'd love to learn more... please.. this is new for me.

    When installed linux, if you opted to use single partition, / will use all the space, including /home, /data2 or any folder in /

    I failed to see, why would you want to allocate partition the disk to 10GB, and mount the partition to /home.

    Well I wanted to keep data in a separate partition... so when I saw the default partition system, it had just / root with like 20gb, some swap and remaining allotted to /home.. so I wasn't aware that space will be shared with / root

    Keeping data on another partition doesn't really make sense, unless of course when you are on home pc using windows where you have to reinstalling OS from scratch every once in a while.

    Well, since you are already on freh server. I suggest you to just use 1 big partition. I don't see any downside to that. it's equivalent on Windows using only 1 drive (c:) without any other drive. All of your data will shared the same amount of free space with the main system.

  • AlwaysSkintAlwaysSkint Member
    edited August 2020

    There are a number of advantages to splitting into partitions.

    • Inode allocation
    • block sizes (can't think of a single time when I've changed this)
    • filesystem types eg. why bother journaling /tmp? eg2. database-specific filesystem (which I've never used)
    • file system indexing/performance
    • disc space monitoring
    • quotas
    • security eg.nosuid/noexec

    ... and no doubt a few more of that don't spring immediately to mind.

    Of course, those of us old enough to remember prolific use of Windoze on rust, will likely know how shitty its' filesystems are/were at fragmentation and its effect on performance, in particular. It's that OS that has made too many lazy sysadmins, IMHO. When I first encountered *nix, you had to get a calculator out and manually work out how to chop up a disc into partitions, using CHS.
    Once, I'd seen the light, however, I began to partition up 'doze boxes too, splitting the OS from user data.

    Thanked by 2yokowasis skorous
  • @yokowasis said:

    @plumberg said:

    @yokowasis said:

    @plumberg said:

    @yokowasis said:
    What's wrong with not partitioned disk ? it's not like /home will take all of it. AFAIK it will share the space with /, I don't see any advantages of partitioning disk unless you plan to reinstall the server, and don't want /home get deleted.

    Huh? How does/home or any particular partition share space with /?

    I'd love to learn more... please.. this is new for me.

    When installed linux, if you opted to use single partition, / will use all the space, including /home, /data2 or any folder in /

    I failed to see, why would you want to allocate partition the disk to 10GB, and mount the partition to /home.

    Well I wanted to keep data in a separate partition... so when I saw the default partition system, it had just / root with like 20gb, some swap and remaining allotted to /home.. so I wasn't aware that space will be shared with / root

    Keeping data on another partition doesn't really make sense, unless of course when you are on home pc using windows where you have to reinstalling OS from scratch every once in a while.

    Well, since you are already on freh server. I suggest you to just use 1 big partition. I don't see any downside to that. it's equivalent on Windows using only 1 drive (c:) without any other drive. All of your data will shared the same amount of free space with the main system.

    I prefer to have my data stashed in a separate folder.. windows or linux. Just makes it easy to remember the same path across all my idling servers... yes, I dont install os every day...

  • rcxbrcxb Member

    @AlwaysSkint said:
    There are a number of advantages to splitting into partitions.

    The biggest reason (from the old days) is:
    If your root partition is nice and small and rarely written to, then when your system crashes your root partition (containing fsck and similar) is likely to be intact. That will ensure you can recover the crashed system without having to boot to external media. Similar situation in the event that something (like syslog) freaks out and fills up your disk... you'll still have a good root fs that is unaffected and will let you recover from the problem.

  • ^ I did say there were other good reasons. ;)
    The eejits that post on the CWP forum saying their (root) disc is full, is one example.

Sign In or Register to comment.