To Partition a drive in linux use the following commands,
1. fdisk
use ' man fdisk ' to find about the format of this command
2. sudo fdisk -l
This will give you information about the disc.
3. To change partitions on the drive to make it a native linux type partition from FAT to linux type
goto
sudo fdisk /dev/sda
we are going to work with sda main device
command line will come type m to check options
to print partition tables on this drive type p
to change first delete the windows partition
press d to delete it
to verify type p
now create the new linux type partition type n
now type p to make it primary
now type the size of the partition
type +4G
type p to verifty the partition
now enter n
type also primary this will be primary partition
type partition no.
and default size of the partition if you dont want to or dont have anymore size left
now type p to verify
now type w to alter the partition
sudo fdisk -l
now we will see two partition
now to make file system ext4
use mkfs command
now type
sudo mkfs -t ext4 /dev/sda1
this will format the file system
now do the same for sda2 partition
sudo mkfs -t ext4 /dev/sda2
now we need to mount them
change to /mnt directory
cd /mnt
make two directories name them part01 and part02
sudo mkdir part01 part02
mount sda1 and sda2
for super use root use
sudo mount /dev/sda1 /mnt/part1
for specific user pi
sudo mount -o gid=pi, uid=pi /dev/sda1 /mnt/part1
for second one
sudo mount /dev/sda2 /mnt/part2
to create a file in part 1
cd part1
sudo touch test1
to check
ls -la
this show a file is created in part1 partition
to unmount a partition use
sudo unmount /dev/sda1
sudo unmount /dev/sda2
this will unmount the partition for super user root
1. fdisk
use ' man fdisk ' to find about the format of this command
2. sudo fdisk -l
This will give you information about the disc.
3. To change partitions on the drive to make it a native linux type partition from FAT to linux type
goto
sudo fdisk /dev/sda
we are going to work with sda main device
command line will come type m to check options
to print partition tables on this drive type p
to change first delete the windows partition
press d to delete it
to verify type p
now create the new linux type partition type n
now type p to make it primary
now type the size of the partition
type +4G
type p to verifty the partition
now enter n
type also primary this will be primary partition
type partition no.
and default size of the partition if you dont want to or dont have anymore size left
now type p to verify
now type w to alter the partition
sudo fdisk -l
now we will see two partition
now to make file system ext4
use mkfs command
now type
sudo mkfs -t ext4 /dev/sda1
this will format the file system
now do the same for sda2 partition
sudo mkfs -t ext4 /dev/sda2
now we need to mount them
change to /mnt directory
cd /mnt
make two directories name them part01 and part02
sudo mkdir part01 part02
mount sda1 and sda2
for super use root use
sudo mount /dev/sda1 /mnt/part1
for specific user pi
sudo mount -o gid=pi, uid=pi /dev/sda1 /mnt/part1
for second one
sudo mount /dev/sda2 /mnt/part2
to create a file in part 1
cd part1
sudo touch test1
to check
ls -la
this show a file is created in part1 partition
to unmount a partition use
sudo unmount /dev/sda1
sudo unmount /dev/sda2
this will unmount the partition for super user root
No comments:
Post a Comment