Partitioning hard disks under Debian/Ubuntu and resizing partitions

29/12/2020
Chưa phân loại
A proper server installation requires a proper partitioning, in contrast with a workstation in which we usually install everything under the root partition (/). When we plan a server installation we estimate the size for different aspects of the server, dividing it for backup, security or technical purposes, we can determine a partition as ext4 or reiserfs according to the filesystem we need or limit the size. In this tutorial we will divide our hard disk both in graphical and command modes and we’ll resize different partitions.

Partitioning under Debian/Ubuntu (GUI)

To start we’ll install Gparted by running the following command:

apt install gparted -y

Run Gparted

gparted

Gparted GUI is very intuitive and easy to use. First select the device you want to work on, on the right side you’ll see a dropdown menu saying “/dev/sda (238.47 GiB)”, there you can select a different device. If you plug the device after Gparted was launched, on the top menu click deploy GParted and click on “Refresh Devices”.

We can not manipulate partitions of a hard disk being used so I connected an external hard drive.

Right click on the partition you want to resize and select Resize.

In my case I have not too free space, so I will only reduce the partition 2 GB.

Now we have 1,95 GB unused, to expand the partition instead of reducing the process is the same if we have free space, right click on the partition you want to expand, select Resize and determine the space you want to add.

Optionally we can format the unused space and create a new partition with a different filesystem like NTFS.

Right click on the unused space and select New

Select the size and type of filesystem, in this case also determine if you want your partition to be primary.

Once we finished setting our changes click on the green V icon below the main menu to write or save all changes.

Partitioning with fdisk

Lets run fdisk to see the options it has.

Lets see the partitions of the disk sdb by running

fdisk /dev/sdb

And then press p, if you need help during the process you can always press m to get help.

Press d to remove the existing partition

Press n to create a new partition and select the table.

Select if the partition must be primary, number of partitions, starting and end point,

To write changes press w.

 

Brief comment on cfdisk

cfdisk  is a tool coming by default with Debian and Ubuntu to manage partitions with the terminal. It is a lot more friendly than fdisk. It is not useful to resize partitions keeping their content, we can remove and create new partitions assigning the size we want.

To launch cfdisk run the command and the device you want to work on.

cfdisk /dev/sdb

cfdisk is managed with the keyboard. If you have more than one partition use down-up keys to select different partitions and keys right-left to select between the different actions.

Conclusion

The best way seems to be gparted with if you have X installed and internet connection. Cfdisk and Fdisk are available tools in default installations, that’s why it is important to know how to use them for an emergency without internet.

I hope you found this article useful. Keep following LinuxHint for new tips on Linux.

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

Install Linux Mint 19 in VirtualBox

Linux Mint is the first operating system that people from Windows or Mac ethos are pointed towards when they have to switch...
29/12/2020

Wireshark Tutorial

Did you ever imagine or have some curiosities about how network traffic look likes ? If you did, you are not alone, I did...
28/12/2020

Kubernetes Operator Tutorial

Kubernetes Operators are a concept introduced by CoreOS project to extend the capabilities of Kubernetes, particularly...
29/12/2020
Bài Viết

Bài Viết Mới Cập Nhật

Reliable IPv4 and IPv6 Subnet Rental Services: The Perfect Solution for Global Businesses
23/12/2024

Tìm Hiểu Về Thuê Proxy US – Lợi Ích và Cách Sử Dụng Hiệu Quả
11/12/2024

Mua Proxy V6 Nuôi Facebook Spam Hiệu Quả Tại Onetcomvn
03/06/2024

Hướng dẫn cách sử dụng ProxyDroid để duyệt web ẩn danh
03/06/2024

Mua proxy Onet uy tín tại Onet.com.vn
03/06/2024