'Partitions in Linux
I've just learnt about backup and restore on Ubuntu. I have some questions below.
- When we've set up Ubuntu successfully, how many partitions have been created? I checked on Terminal by using
parted -land see that there're 3 parts. I typedlsblkand it seems there's a difference in size of/dev/sda2(extended partition) between two commands. Can I have the explanation? - Does
mkfscommand create a logical partition? I know thatmkfsmeans make a file system, but a file system is created when mounting with a partition.
Here some images.
Solution 1:[1]
- The difference is because of
extendedpartition type ofdev/sda2device. More explanation is given here - By definition, mkfs says
mkfs is used to build a Linux file system on a device, usually a hard disk partition. This means, you have to use eitherfdiskorpartedto partition a hard disk intoprimaryorextendedorlogicaltype & then usemkfsto build eitherext4orext3orxfsfilesystem or whatever which depends on your need.
Solution 2:[2]
Software people calculate disk size as multiples of 1024. But some use multiples of 1000. In your case, parted is probably using 1000 while lsblk is using 1024.
You can not use mkfs to partition disk. You can make a filesystem with it once the disk is already partitioned.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | Sakib Hasan |


