To format a new drive as Btrfs (B-tree file system) and mount it in Linux, you can follow these steps:
Identify all attached drives
lsblk --output NAME,FSTYPE,LABEL,MODEL,UUID,FSAVAIL,FSUSE%,MOUNTPOINT
df -Th
Wipe drive
Unmount an already mounted drive, to able to modify its filesystem
sudo umount /dev/sdX1
Wipe the filesystem from a partition
sudo wipefs -a /dev/sdX1
If necessary, merge multiple partitions on the disk
sudo fdisk /dev/sdX
- delete second partition:
d
2
- delete first partition:
d
1
- create new partition over entire disk:
n
1
default default - write changes to disk:
w
Format partition with filesystem
sudo mkfs.btrfs /dev/sdX1
Mount drive automatically at boot
sudo nano /etc/fstab
- Add text line and save
UUID=38ffd02c-c135-4aa6-8a41-494b8112a011 /media/redCloudDrive btrfs defaults,nofail 0 0
UUID=e7ec61d1-e369-4d81-b10f-dfa53f1f86c3 /media/blackBackupDrive btrfs defaults,nofail 0 0
Reboot to apply changes
sudo reboot now
Temporary mount drive
sudo mkdir /media/redCloudDrive
sudo mount /dev/sdX1 /media/redCloudDrive
List BTRFS subvolumes
sudo btrfs subvolume list /media/redCloudDrive
Sources:
Related:
- AI response - Format and mount new disks
[[List related notes]]
Tags: Setup my PlutosCloud