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?
- 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.
- 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.