Use the following (mutatis mutandis for the filesystem type):
sudo fsck.ext4 -y /dev/sda[NUMBER]source
To understand what can cause a filesystem to become broken see here.
sudo umount -l /media/usbsource
sudo blkid /dev/sdc1source
In April 2018 to label a FAT32 file system on a USB flash drive I did:
sudo fatlabel /dev/sdb1 LEXR16GWHIT… and it worked like a charm.
Note however, that there should be no filesystem mounted on that device otherwise you get:
$ sudo fatlabel /dev/sdb1 LEXR16GWHIT 0x41: Dirty bit is set. Fs was not properly unmounted and some data may be corrupt. Automatically removing dirty bit.
sudo lsblk -o name,mountpoint,label,size,uuidI also think that
sudo lsblk alone suffices.
sudo apt-get install smartmontools sudo sudo smartctl -a /dev/sda1
The Start_Stop_Count and Power_Cycle_Count seem relevant. In my T60 ThinkPad (6 years old) they have a value around 2300.
Alternatively, you can grep for all pertinent Old_age metrics:
sudo sudo smartctl -a /dev/sda1 | grep -i old_age
This only shows mounted filesystems:
df -ThT for the filesystem information, h for human-readable.
The below provides way more / complementary information on the filesystem (and also works on unmounted devices):
sudo file -sL /dev/sda1In particular, in my system
file -sL properly reports FAT (32 bit)
whereas df -Th simply reports vfat which is not technically correct
as FAT32 is an extension of both FAT and VFAT (and enhances both)
df -P -T /some/pathIf you just want the type of the filesystem:
df -P -T /some/path | tail -n +2 | awk '{print $2}'
lsblk program
MOUNTPOINT value. E.g. in the example above that's the device sdb.
sudo fdisk -l
$ sudo fdisk -l
Disk /dev/sda: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders, total 488397168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0007fe8d
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 482142207 241070080 83 Linux
/dev/sda2 482144254 488396799 3126273 5 Extended
/dev/sda5 482144256 488396799 3126272 82 Linux swap / Solaris
WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.
Disk /dev/sdb: 2000.4 GB, 2000365289472 bytes
255 heads, 63 sectors/track, 243197 cylinders, total 3906963456 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xa29ef612
Device Boot Start End Blocks Id System
/dev/sdb1 1 3906963455 1953481727+ ee GPT
$ ls /dev/disk/by-label/
total 0
drwxr-xr-x 2 root root 60 Nov 16 10:34 ./
drwxr-xr-x 6 root root 120 Nov 16 10:34 ../
lrwxrwxrwx 1 root root 9 Nov 16 10:34 transc-usb-disk -> ../../sdb
$mount | grep sdb
$
sudo lshw | grep -A20 -B30 sdb
(... output ommited)
… if the above produces output that's not very helpful try using sudo blkid (see here for more)
/media/usb-disk
sudo mount -t ext3 /dev/sdb2 /media/usb-disk
sudo blkid
UUID=e6daad35-1f57-4281-8683-a03c20cfc5a3 /media/Elements ext4 defaults,uid=1000,gid=1000,umask=007
update 2025, January I know think that the above procedure is fraught with danger and instead have opted to use (and successfully used) sudo gnome-disks as advised here.
rsync -avx --delete --in-place /whatever /mnt/zfs
zfs snapshot backups@20120925
sudo fdisk -land then you do a:
sudo blkid /dev/sdb1where, in the above example, /dev/sdb1 is the device we're interested in.
diff -qr a b | sort
757 fdisk -l
758 sudo fdisk -l
759 clear
760 sudo fdisk -l
761 df -l
762 sudo mount /dev/sdb1 /media/Elements/
763 df
764 df -h