Operating System/O.S(Arif Butt)

User Management ,Disk Geometry, Partition ,Formatting,mounting(Lec15,16,17,18,19)

Tony Lim 2021. 2. 4. 18:58
728x90

$ su == substitute user // $su -  unset Enviornment variable and working directory 

 

to use sudo 

1. to use sudo your username should be inside /etc/sudoers  to chage this file you should always use $visudo command

2. # usermod -G sudo k <username> == make username member of this group 

3. can check with $ less /etc/group command

 

/etc/passwd (store user account information)

7 columns 

1. username 2. password exist in some other file 3. uid 4. group id 5. personal information 6. absolute path of home directory 7. login shell form 

 can check how many user do i have with this command

 

/etc/shadow == 9 columns 1.username 2. encrypted password 3. the date password last changed 4. after this number of days need to pass to change password 5. maxmium password age (prompt user to change password)  and more to find this information $ man 5 shadow .

 

$ ls -a /etc/skel/  == contains very basic skelton. 

.bash_logout == script which execute on logout 

.bashrc == environment variable , alias ... permanently 

.profile == get executed if .bashrc or .bash_profile doesn't exist

 

sudo usermod -G <there has to be group name> arif == if group name is missing this command will delete arif(username) from every group which arif is member , so it is always good to use -a option (append)

 

Disk Geometry

Hard disk interface

1. ATA/PATAP/IDE == data transfer rate 8-100MB/s , 

2. SATA == data tansfer rate 150-3gb/s, 7 pins 

3. SCSI == 4-320mb/s

4. SAS == 3gb/s

5. USB,Fiber channel, Thunderbolt

 

Reading ,Writing to a CHS disk

1. OS sends block address( linear address) to disk controller

2. Disk controller converts this linear address called LBA to appropriate CHS(cylinder, head,sector) address 

3. read specific cyliner/track/sectors in a disk buffer , later on it will be read by the OS kernel

it is very rare to change Cyliner because most of data is sticked together. 

  

Disk Partition

a partition structure defines hwo information is structured on the partition and also the code that is used during startup if a partition is bootable. 

MBR (Master Boot Record) 

this is primary partion 0 on the above picture i drew but we are interested in the later 66(16*4 +2) bytes

status 00 

address of 1st CHS == 202100

partition type == 82 (swap partition)

address of last CHS == f07ff1

LBA of 1st sector == 00080000

count of secotrs in a partition == 00087a00

83 for linux data partition , 82 for swap partition

 

whenever you want to change your file system type you should always backup your data because we need to unmount than change the file system type

you can mount any directory when file system is done.

you won't be able to see the original files if you mount it here it will be kind of overwriting but when you unmount you can see the origin files again

/etc/fstab === static information about the filesystems. you write your configruation about mounting file systems it will be automatically mounted when system is booted

fsck == perform file system check and repair , other *fsck* are available each with diffterent file systems. whenever using these tools you need to unmount

728x90