Search This Blog

Wednesday, 20 July 2016

LINUX PARTITIONING AND FORMATING IN LINUX SHELL

Linux Partitioning and Formatting in filesystems for Disk Use the following Commands


pi@rasberrypia ~$ fdisk
pi@rasberrypia ~$ man fidsk
pi@rasberrypia ~$ sudo fdisk -l
pi@rasberrypia ~$ sudo fdisk /dev/sda
Command (m for help):m

Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty dos partition table
p print the partition table
q quit without saving changes
s create a new empty sunlabel
t change a partitions systems id
u change display / entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)

User the above options to create new partition in /dev/sda
After creating partitions to the drive use w to write changes made to disk

To Format Use the following commands

pi@rasberrypia ~$ sudo mkfs -t ext4 /dev/sda1

 ext 4 linux file system

User the following commands to mount the partition

pi@rasberrypia ~$ cd to /mnt

pi@rasberrypia  /mnt$

pi@rasberrypia  /mnt$ sudo mkdir part1 part2

now mount drives to these created directories

pi@rasberrypia /mnt$ sudo mount /dev/sda1 /mnt/part1

now it by going to the part1 directory and creating a file

pi@rasberrypia  /mnt$ cd part1

pi@rasberrypia  /mnt/part1$ sudo touch test1

pi@rasberrypia  /mnt/part1$ ls -la

to unmount use the following commands

pi@rasberrypia /mnt/part1$ sudo umount /dev/sda1

to Format a Fat32 created Disk Partition Use the following commands

pi@rasberrypia ~$ sudo mkfs apt-get install dostools

Format disk partition sda1 in Fat32 file system Use the following command

pi@rasberrypia ~$ sudo mkfs -t vfat /dev/sda1

we can also make partitions to disk using graphical user interface

sudo apt-get update

sudo apt-get install gparted

run

sudo gparted























No comments:

Post a Comment

Linux Partitioning Disk & Formatting commands

Linux Partitioning Disk & Formatting commands fdisk man fdisk pi@rasberrypi ~$ sudo fdisk -l