mkfs.xfs: cannot open /dev/sda1: Device or resource busy

I’m trying to create an XFS filestem on a used disk, and got into a problem. Here is the error message: # mkfs.xfs /dev/sda1 mkfs.xfs: cannot open /dev/sda1: Device or resource busy So, let’s see if I can fix it. (Spoiler alert: I think I can, even though it’s not yet done at the time of this writing.) Let’s check the partitions of /dev/sda: # parted /dev/sda print 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 512GB 512GB ntfs 1 So, there is a partition (/dev/sda1) with 512GB in size, and its filesystem is ntfs....

March 13, 2022 · 4 min · 703 words · kenno

Resizing a GPT Partition

One of my virtual machines runs out of disk space in the root (/) partition, and I want to remove the /home partition and using this free space to resize the root partition. Nowadays, for any serious systems, I’d use LVM with XFS on top. However, for this test VM, I have a virtual disk with 4 partitions without LVM. Managing partition on LVM is much easier than working the disk partition directly....

September 10, 2020 · 3 min · 556 words · kenno

Create Disk Partition With GNU Parted

My favourite tool to create disk partitions on Linux is c[fg]disk. cfdisk used to create MBR based partition, and cgdisk is for GPT one. Today, I want to learn to use another tool called GNU Parted. After plugging an external disk, we can use udiskctl command to identify the disk device. # udisksctl status MODEL REVISION SERIAL DEVICE -------------------------------------------------------------------------- Samsung SSD 850 EVO 250GB EMT01B6Q S21MNXAG919308T sda ST2000DM001-1ER164 HP51 Z4Z46TMA sdb ST2000DM001-1ER164 HP51 Z4Z46W3E sdc Samsung SSD 850 EVO 250GB EMT01B6Q S21MNXAG919312Y sdd Samsung SSD 840 EVO 250G 0309 533144424E4541443837343335324120 sde The last Samsung SSD 840 (/dev/sde) is the one that I’m going to work with....

May 20, 2020 · 2 min · 419 words · kenno

How to Label an XFS Filesystem

When I plugged in an external drive to my laptop, the drive was displayed as a string consits random letters and numbers. Here is an example: ❯❯❯ df -Th | grep sdb /dev/sdb1 xfs 481M 26M 456M 6% /run/media/kenno/5428b182-c92e-466b-89d2-b5b31b80ba48 Though the drive worked perfectly fine, I think it’s ugly, and I wanted to properly give it a good name. Let’s call it externo. But how to do this? You may not believe it, I forgot how to do this....

October 27, 2019 · 2 min · 304 words · kenno

Labeling an XFS Partition

Let’s say I have a partition as /dev/sdc1 formatted using XFS file system, and I want to give a label to it as externo. Here is one way to do it: # xfs_admin -L externo /dev/sdc1 writing all SBs new label = "externo" To read the label: # xfs_admin -l /dev/sdc1 label = "externo" Reference: HowTo Rename a XFS-Filesystem (label it)

September 29, 2016 · 1 min · 61 words · kenno