Friday 5 June 2015

Determining whether a mounted disk has a file system on it

Firstly identify which disk we are after with fdisk:
fdisk -l
we can also check for disk and partitions with lsblk
And finally check whether there is a file system on the disk / partition:
file -s /dev/sda1
To create a file system we can use the mkfs utility:
mkfs -t ext4 /dev/sda1
and to mount it temporarily:
mkdir -t /mount/partition1
mount -t auto /dev/sda1 /mount/partition1
or to mount it permenently:
sudo vi /etc/fstab
and add the following line:
/dev/sda1    /mount/partition1    auto    auto,nouser,exec,rw,async,atime    0 0


Post a Comment