You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: advice.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
do a shell tutorial, and learn as many of the details as you can
5
5
6
6
7
-
2.Reading reference-level material is a skill that you can get or improve through practice... in linux and unix, the reference stuff is in the man pages... so,
7
+
2.Reading reference-level material is a skill that you can get or improve through practice... in linux and unix, the reference stuff is in the man pages... so,
8
8
I'd suggest to read at least one man page every day, to at least discover the common structures of them
Copy file name to clipboardExpand all lines: devicesManagement.md
+10-7
Original file line number
Diff line number
Diff line change
@@ -1,17 +1,20 @@
1
-
UDEV
2
-
udev(user space /dev): is a device manager for the Linux kernel. Udev primarily manages device nodes in the /dev directory. At the same time, udev also handles all user space events
1
+
## UDEV
2
+
##### udev(user space /dev):
3
+
> is a device manager for the Linux kernel. Udev primarily manages device nodes in the /dev directory. At the same time, udev also handles all user space events
3
4
raised when hardware devices added into the system or moved from it.
4
5
5
-
Rationale:
6
-
It's an operating system's kernel that is responsible for providing an abstract interface of the hardware to the rest of the software. Being a monolithic kernel , the Linux kernel does
6
+
####Rationale:
7
+
>It's an operating system's kernel that is responsible for providing an abstract interface of the hardware to the rest of the software. Being a monolithic kernel , the Linux kernel does
7
8
exactly that, and device drivers are part of the Linux kernel , which make up more than 50% of its source code.
8
9
To be able to deal with peripheral devices that are hotplug-capable in a user-friendly way, a part of handling all of these hotplug-capable hardware devices was handled over from kernel
9
10
to a daemon running in user-space. Running in user space serves security and stability purposes.
10
11
11
12
12
-
The udev, as a whole, is dividing into three parts:
13
-
1.Library libudev that allows access to device information.
14
-
2.User space daemon udevd that manages the virtual /dev.
13
+
The udev, as a whole, is dividing into three parts:
14
+
> 1.Library libudev that allows access to device information.
15
+
>
16
+
2.User space daemon udevd that manages the virtual /dev.
17
+
>
15
18
3.Administrative command-line utility udevadm for diagnostics.
# set the IP address and netmask for a kernel network interface
7
-
infconfig interface address netmask mask
8
-
# add routes
9
-
route add default gw gw-address
10
-
telnet
11
-
curl
12
-
13
-
14
-
15
-
16
-
Disk Partition
17
-
1. We need to format the drive before write something to it. Formatting (usually known as "making a file system") writes information to the drive,
1
+
## Disk Partition
2
+
We need to format the drive before write something to it. Formatting (usually known as "making a file system") writes information to the drive,
18
3
create order out of the empty space in an unformatted drive.
19
4
20
5
A small percentage of the drive's available space is used to store file system-related data and can be considerable as overhead.
@@ -24,80 +9,96 @@ A file system splits the remaining space into small, consistently-sized segments
24
9
Disk drives can be divided into partitions. Each partition can be accessed as if it was a separate disk. This is done through the addition of
25
10
a partition table.
26
11
There are several reasons for allocating disk space into separate disk partitions.
27
-
1.Logical separation of the operating system data from user data
28
-
2.Ability to use the different file systems
12
+
> 1.Logical separation of the operating system data from user data
13
+
>
14
+
2.Ability to use the different file systems
15
+
>
29
16
3.Ability to run multiple operating systems on one machine
17
+
>
30
18
4.Once a disk is divided into several partitions, directories and files of different categories may be stored in different partitions.
19
+
>
31
20
5.Preventing overflow of temporary files.
32
21
33
-
Notes: There is a critical difference between partitioning and file manipulation. The partition table defines simple boundaries on
34
-
the disk, whereas a filesystem is a much more involved data system.
22
+
**Notes: There is a critical difference between partitioning and file manipulation. The partition table defines simple boundaries on
23
+
the disk, whereas a filesystem is a much more involved data system.**
35
24
36
25
LBA(logical block addressing): address a location on the disk by a block number
37
26
38
27
39
28
40
-
Filesystem
29
+
### Filesystem
41
30
The filesystem is a form of database; It supplies the structure to transform a simple block device into the sophisticated hierarchy of files
42
31
and subdirectories that user can understand.
43
32
44
-
Virtual File System
33
+
### Virtual File System
45
34
VFS ensures that all user-space applications access files and directories in the same manner.
46
35
47
-
Creating a Filesystem
48
-
# mkfs -t ext4 /dev/sdb1
36
+
*Creating a Filesystem*
37
+
38
+
`mkfs -t ext4 /dev/sdb1`
49
39
50
-
Mounting a Filesystem
51
-
On Unix , the process of attaching a filesystem is called mounting. When the system boots, the kernel reads some configuration data and mounts
40
+
### Mounting a Filesystem
41
+
On Unix , the process of attaching a filesystem is called mounting. When the system boots, the kernel reads some configuration data and mounts
52
42
root(/) based on the configuration data.
53
43
In order to mount a filesystem, you must know the following:
54
-
1.) The filesystem's device(such as a disk partition; where the actual filesystem data resides)
55
-
2.) The filesystem type
56
-
3.) The mount point. The place in the current system's directory hierarchy where the filesystem will be attached.The mount point is always a normal
44
+
> 1.The filesystem's device(such as a disk partition; where the actual filesystem data resides)
45
+
>
46
+
2.The filesystem type
47
+
>
48
+
3.The mount point. The place in the current system's directory hierarchy where the filesystem will be attached.The mount point is always a normal
57
49
directory.
58
50
59
51
To mount a filesystem, use the mount command as follows with the filesystem type, device, and desired mount point:
60
-
# mount -t type device mountpoint
61
-
62
-
Filesystem UUID
63
-
#blkid
64
-
#mount UUID= mountpoint
65
-
66
-
/etc/fstab
67
-
first column: The device or UUID
68
-
second column: The mount point
69
-
third column: The filesystem type
70
-
fourth column: options
71
-
fifth column: Backup information for use by the dump command
72
-
sixth column: The filesystem integrity test order(To ensure that fsck always runs on the root first, always set this to 1 for the root filesystem and 2 for
52
+
53
+
` mount -t type device mountpoint`
54
+
55
+
or
56
+
57
+
` mount UUID='' mountpoint`
58
+
you can use `blkid` command to find uuid of the device.
59
+
60
+
61
+
### /etc/fstab
62
+
> 1.first column: The device or UUID
63
+
>
64
+
2.second column: The mount point
65
+
>
66
+
3.third column: The filesystem type
67
+
>
68
+
4.fourth column: options
69
+
>
70
+
5.fifth column: Backup information for use by the dump command
71
+
>
72
+
6.sixth column: The filesystem integrity test order(To ensure that fsck always runs on the root first, always set this to 1 for the root filesystem and 2 for
73
73
any other filesystems on a hard disk. Use 0 to disable the bootup check for everything else.Including CD-ROOM drives, swap, and the /proc filesystem.)
74
74
75
75
76
-
Filesystem Capacity
77
-
To view the size and utilization of your currently mounted filesystems, use the df command.
78
-
# df -h
79
-
# du
76
+
### Filesystem Capacity
77
+
To view the size and utilization of your currently mounted filesystems, use the df command.
78
+
` df -h`
79
+
`du`
80
80
81
-
Checking and Repairing Filesystems
82
-
#fsck
81
+
### Checking and Repairing Filesystems
82
+
`fsck`
83
83
You should never use fsck on a mounted filesystem because the kernel may alter the disk data as you run the check.
84
84
85
85
86
-
Special-purpose filesystems
86
+
### Special-purpose filesystems
87
87
Not all filesystems represent storage on physical media. Specifically, most versions of Unix have filesystems that serve as system interfaces.
88
-
a filesystem can represent system information such as process IDs and kernel diagnostics.
89
-
proc: Mounted on /proc. The name proc is actually an abbreviation for process. Each numbered directory inside /proc is actually the process ID of
90
-
current process on the system.
88
+
a filesystem can represent system information such as process IDs and kernel diagnostics.
89
+
> proc: Mounted on /proc. The name proc is actually an abbreviation for process. Each numbered directory inside /proc is actually the process ID of current process on the system.
90
+
>
91
91
sysfs: Mounted on /sys
92
+
>
92
93
tmpfs: Mounted on /run and other locations.With tmpfs, you can use your physical memory and swap space as temporary storage.
93
94
94
95
95
-
Swap space
96
-
# free
96
+
### Swap space
97
+
`free`
97
98
98
99
Using a disk partition as swap space
99
-
1. Make sure the partition is empty.
100
-
2. Run mkswap dev , where dev is the partition's device. This commands puts a swap signature on the partition.
100
+
> 1. Make sure the partition is empty.
101
+
2. Run `mkswap dev` , where dev is the partition's device. This commands puts a swap signature on the partition.
101
102
3. Execute swapon dev to register the space with the kernel.
102
103
After creating a swap partition, you can put a new swap entry in your /etc/fstab file to make the system use the swap space as soon as the machine
0 commit comments