Skip to main content
added 63 characters in body
Source Link
slm
  • 379.7k
  • 127
  • 793
  • 897

For this example you have the following typical situation. On the beginning is a single partition, and on the end a swap partition is located. it isn't good because swap can be havelyheavily loaded, and end of rotated disk is the slowest part of it. what I suggest?

  1. Create boot partition at the begin. Why at the beginbeginning? because many tools have got problems with end of large disk above 2TB barierbarrier. After boot partition should be swap partition. This is for performance. Rest of disk should be used for other partitions.

But what with this situation? I don't recommend expanding sda1. I suggest creating other partitions after sda1 & sda2, mounted as /home/home and /usr /usr. onOn that directories are stored the most user and system data, and it is possible to securely move data from that directories to new partitions.

  1. But. (second "but") if you still want keep your current structure, you should first remove swap partition. You should do swapoff, remark this in /etc/fstab. if swapon tells you (see man) no swap is used, you can remove it by partition tool (fdisk or similar).

But. (second "but") if you still want keep your current structure, you shuld: first remove swap partition. you should do swapoff, remark this in /etc fstab. if swapon tells you (see man) no swap is used, you can remove it by partition tool (fdisk or similar). whenWhen you don't have got this partition, you can enlarge your sda1. using fdiskUsing fdisk you should firstly print partition. itIt is for remembering where it starts. secondlySecondly remove partition using 'd' key. don'tDon't panic, nothing is written to hard drive :) after. After print you see, no partition exist on the disk. next

Next create new partition., but be careful. seeSee on what sector original partition started. writeWrite the same number. afterAfter that look at the end. fdisk promptfdisk prompts you for last available sector. useUse calculator and assign in your mind how much swap do you need in kilobytes. multipleMultiple it by 2, and substractsubtract this number from last sector number prompted by fdisk. createCreate partition. printPrint this (it is still in fdisk temporary memory), and look all is ok. after

After this press 'w' key, this will tru write new partitioning to the drive. youYou will see information all is synced, or sync is failed. ifIf failed, you can call command partx /dev/sda for doing sync. ifIf it still fails, you should reboot your system. afterAfter reboot you have prepared larger partition, but filesystem on it is still smaller. youYou should grow it. ext4EXT4 is growable on the fly :), use resize2fs /dev/sda1resize2fs /dev/sda1 for do it. you

You don't need remounting rebooting etc. lastLast, you should restore swap partition. simplySimply use fdisk again, create new partition as swap. afterAfter writing 'w', device sda2 will be restored. preparePrepare swap structure on it using mkswap /dev/sda2 mkswap /dev/sda2, remove remarks for swap on /etc/fstab/etc/fstab and finally do swapon -a swapon -a. lookLook using swapon or top command, swap is activated.

iI know, it's very long explanation. I hope it will be usable for any. noticeNotice, in my opinion xfs filesystem is much better, unfortunately this fs doesn't support shrinking without temporary copying to alternate place., but shrink is used rarely. itIt is nice, xfs takes extremalyextremely little place for his own metadata, and is faster in many ways in comparationcomparison to ext4.

another hinitAnother hint, better use some LVM as middle layer for partitioning. after that any resizing is much easier. performancePerformance is comparable., of course, you can use mix of hdd managamentHDD management. you can use in common raw partitions and lvmLVM.

For this example you have typical situation. On the beginning is single partition, and on the end swap partition is located. it isn't good because swap can be havely loaded, and end of rotated disk is the slowest part of it. what I suggest?

  1. Create boot partition at the begin. Why at the begin? because many tools have got problems with end of large disk above 2TB barier. After boot partition should be swap partition. This is for performance. Rest of disk should be used for other partitions.

But what with this situation? I don't recommend expanding sda1. I suggest creating other partitions after sda1 & sda2, mounted as /home and /usr . on that directories are stored the most user and system data, and it is possible to securely move data from that directories to new partitions.

But. (second "but") if you still want keep your current structure, you shuld: first remove swap partition. you should do swapoff, remark this in /etc fstab. if swapon tells you (see man) no swap is used, you can remove it by partition tool (fdisk or similar). when you don't have got this partition, you can enlarge your sda1. using fdisk you should firstly print partition. it is for remembering where it starts. secondly remove partition using 'd' key. don't panic, nothing is written to hard drive :) after print you see, no partition exist on the disk. next create new partition. be careful. see on what sector original partition started. write the same number. after that look at the end. fdisk prompt you for last available sector. use calculator and assign in your mind how much swap do you need in kilobytes. multiple it by 2, and substract this number from last sector number prompted by fdisk. create partition. print this (it is still in fdisk temporary memory), and look all is ok. after this press 'w' key, this will tru write new partitioning to the drive. you will see information all is synced, or sync is failed. if failed, you can call command partx /dev/sda for doing sync. if it still fails, you should reboot your system. after reboot you have prepared larger partition, but filesystem on it is still smaller. you should grow it. ext4 is growable on the fly :) use resize2fs /dev/sda1 for do it. you don't need remounting rebooting etc. last, you should restore swap partition. simply use fdisk again, create new partition as swap. after writing 'w', device sda2 will be restored. prepare swap structure on it using mkswap /dev/sda2 , remove remarks for swap on /etc/fstab and finally do swapon -a . look using swapon or top command, swap is activated.

i know, it's very long explanation. I hope it will be usable for any. notice, in my opinion xfs filesystem is much better, unfortunately this fs doesn't support shrinking without temporary copying to alternate place. but shrink is used rarely. it is nice, xfs takes extremaly little place for his own metadata, and is faster in many ways in comparation to ext4.

another hinit, better use some LVM as middle layer for partitioning. after that any resizing is much easier. performance is comparable. of course, you can use mix of hdd managament. you can use in common raw partitions and lvm.

For this example you have the following typical situation. On the beginning is a single partition, and on the end a swap partition is located. it isn't good because swap can be heavily loaded, and end of rotated disk is the slowest part of it. what I suggest?

  1. Create boot partition at the begin. Why at the beginning? because many tools have got problems with end of large disk above 2TB barrier. After boot partition should be swap partition. This is for performance. Rest of disk should be used for other partitions.

But what with this situation? I don't recommend expanding sda1. I suggest creating other partitions after sda1 & sda2, mounted as /home and /usr. On that directories are stored the most user and system data, and it is possible to securely move data from that directories to new partitions.

  1. But. (second "but") if you still want keep your current structure, you should first remove swap partition. You should do swapoff, remark this in /etc/fstab. if swapon tells you (see man) no swap is used, you can remove it by partition tool (fdisk or similar).

When you don't have this partition, you can enlarge your sda1. Using fdisk you should firstly print partition. It is for remembering where it starts. Secondly remove partition using 'd' key. Don't panic, nothing is written to hard drive :). After print you see, no partition exist on the disk.

Next create new partition, but be careful. See on what sector original partition started. Write the same number. After that look at the end. fdisk prompts you for last available sector. Use calculator and assign in your mind how much swap do you need in kilobytes. Multiple it by 2, and subtract this number from last sector number prompted by fdisk. Create partition. Print this (it is still in fdisk temporary memory), and look all is ok.

After this press 'w' key, this will tru write new partitioning to the drive. You will see information all is synced, or sync is failed. If failed, you can call command partx /dev/sda for doing sync. If it still fails, you should reboot your system. After reboot you have prepared larger partition, but filesystem on it is still smaller. You should grow it. EXT4 is growable on the fly :), use resize2fs /dev/sda1 for do it.

You don't need remounting rebooting etc. Last, you should restore swap partition. Simply use fdisk again, create new partition as swap. After writing 'w', device sda2 will be restored. Prepare swap structure on it using mkswap /dev/sda2, remove remarks for swap on /etc/fstab and finally do swapon -a. Look using swapon or top command, swap is activated.

I know, it's very long explanation. I hope it will be usable for any. Notice, in my opinion xfs filesystem is much better, unfortunately this fs doesn't support shrinking without temporary copying to alternate place, but shrink is used rarely. It is nice, xfs takes extremely little place for his own metadata, and is faster in many ways in comparison to ext4.

Another hint, better use some LVM as middle layer for partitioning. after that any resizing is much easier. Performance is comparable, of course, you can use mix of HDD management. you can use in common raw partitions and LVM.

Source Link
Znik
  • 659
  • 1
  • 9
  • 15

I know this is very old issue, but many people are looking for that resolve.

For this example you have typical situation. On the beginning is single partition, and on the end swap partition is located. it isn't good because swap can be havely loaded, and end of rotated disk is the slowest part of it. what I suggest?

  1. Create boot partition at the begin. Why at the begin? because many tools have got problems with end of large disk above 2TB barier. After boot partition should be swap partition. This is for performance. Rest of disk should be used for other partitions.

But what with this situation? I don't recommend expanding sda1. I suggest creating other partitions after sda1 & sda2, mounted as /home and /usr . on that directories are stored the most user and system data, and it is possible to securely move data from that directories to new partitions.

But. (second "but") if you still want keep your current structure, you shuld: first remove swap partition. you should do swapoff, remark this in /etc fstab. if swapon tells you (see man) no swap is used, you can remove it by partition tool (fdisk or similar). when you don't have got this partition, you can enlarge your sda1. using fdisk you should firstly print partition. it is for remembering where it starts. secondly remove partition using 'd' key. don't panic, nothing is written to hard drive :) after print you see, no partition exist on the disk. next create new partition. be careful. see on what sector original partition started. write the same number. after that look at the end. fdisk prompt you for last available sector. use calculator and assign in your mind how much swap do you need in kilobytes. multiple it by 2, and substract this number from last sector number prompted by fdisk. create partition. print this (it is still in fdisk temporary memory), and look all is ok. after this press 'w' key, this will tru write new partitioning to the drive. you will see information all is synced, or sync is failed. if failed, you can call command partx /dev/sda for doing sync. if it still fails, you should reboot your system. after reboot you have prepared larger partition, but filesystem on it is still smaller. you should grow it. ext4 is growable on the fly :) use resize2fs /dev/sda1 for do it. you don't need remounting rebooting etc. last, you should restore swap partition. simply use fdisk again, create new partition as swap. after writing 'w', device sda2 will be restored. prepare swap structure on it using mkswap /dev/sda2 , remove remarks for swap on /etc/fstab and finally do swapon -a . look using swapon or top command, swap is activated.

i know, it's very long explanation. I hope it will be usable for any. notice, in my opinion xfs filesystem is much better, unfortunately this fs doesn't support shrinking without temporary copying to alternate place. but shrink is used rarely. it is nice, xfs takes extremaly little place for his own metadata, and is faster in many ways in comparation to ext4.

another hinit, better use some LVM as middle layer for partitioning. after that any resizing is much easier. performance is comparable. of course, you can use mix of hdd managament. you can use in common raw partitions and lvm.