0

How is a filesystem identified or specified? Some commands such as resize2fs expect a filesystem as an argument. The mount directory of a file system doesn't work.

Does name such as /dev/sda3 identify/specify a partition or a filesystem? I thought that /dev/sda3 specifies/identifies a partition (as seen in the output of fdisk -l), instead of a filesystem, but it works as a filesystem argument to resize2fs.

Generally, are partition and filesystem specified and identified in the same ways?

Thanks.

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            3.9G     0  3.9G   0% /dev
tmpfs           788M  1.5M  786M   1% /run
/dev/sda3       260G   16G  231G   7% /
tmpfs           3.9G  542M  3.4G  14% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/sda4       550G  323G  199G  62% /home
tmpfs           788M   52K  788M   1% /run/user/1000
tmpfs           788M  4.0K  788M   1% /run/user/1001

$ sudo fdisk -l
Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 

Device          Start        End    Sectors   Size Type
/dev/sda1        2048       4095       2048     1M BIOS boot
/dev/sda2        4096   31254527   31250432  14.9G Linux swap
/dev/sda3  1398441984 1953523711  555081728 264.7G Linux filesystem
/dev/sda4   226566144 1398441983 1171875840 558.8G Linux filesystem

Partition table entries are not in disk order.

$ sudo parted -l
Model: ATA ST1000LM014-1EJ1 (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system     Name  Flags
 1      1049kB  2097kB  1049kB                        bios_grub
 2      2097kB  16.0GB  16.0GB  linux-swap(v1)
 4      116GB   716GB   600GB   ext4
 3      716GB   1000GB  284GB   ext4
  • resize2fs expects a device as an argument, not a filesystem; Usage: resize2fs [-d debug_flags] [-f] [-F] [-M] [-P] [-p] device [new_size] – Stephen Harris Feb 20 at 22:56
  • Actually, you can't specify a not-mounted filesystem in any way. They're block devices happens to contain a filesystem. Usually people would like to have a partition contain no filesystem (like swap or bios_grub or whatever) or one filesystem of exactly the same size. But… Linux always provides you the way to screw all the laws, right? – 炸鱼薯条德里克 Feb 21 at 7:34
  • @炸 Is it correct that for an umounted filesystem, the only way to specify it is to specify its underlying partition? For a mounted filesystem, can we specify it by either specifying its underlying partition or its mount point? – Tim Feb 21 at 19:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.