• No results found

Linux (Debian) Distros Hard Drives & File Systems

N/A
N/A
Protected

Academic year: 2021

Share "Linux (Debian) Distros Hard Drives & File Systems"

Copied!
6
0
0

Loading.... (view fulltext now)

Full text

(1)

Linux (Debian)

Distros

● Debian GNU/Linux

● Debian based: Ubuntu, Knoppix, Linspire, Damn Small Linux, etc. ● Red Hat, Slackware, SUSE, Mandriva, CentOS, Gentoo, etc.

● “Linux” is just the kernel, it's what allows the system to boot up and talk with your

machine's hardware.

● GNU (Recursive acronym: “GNU's Not Unix”) was a project launched in 1984 to

develop a complete Unix-line operating system which is free software. The GNU project was never able to develop a kernel, so that started using the Linux kernel to run all of their software on.

● Free Software? liberty, not necessarily price. Think of it as “free speech”, not as in

“free beer”. Although, most open source software is free in both ways.

● Common items in “Linux”: Shell (text terminal/console), a graphical environment

know has the “X Window System”, sometimes referred to as “X11”. GNOME or KDE desktop environment.

● Bar at the left/right/top/bottom is called the “Panel” (similar to taskbar in Windows

).

● Terminal Windows (console/shell window). Similar to Windows Command Prompt. ● Common partitions/directories: /, /home, /usr, /var, /tmp, swap

● Directory paths use forward slash “/” in Linux. (Backslash “\” in Windows)

Hard Drives & File Systems

● Managing your Hard drives in Linux:

○ Gnome System Menu -> Administration -> Partition Manager: Allows you to see

how your hard drive's partitions and the types of file systems that your partitions are using.

○ Shell tools: fsck for checking hard drive for errors. cfdisk for partitioning drives.

mkfs.ext3, mkfs.vfat, etc. to format the partition with a specific file system.

○ Partitions are usually mounted to directory mount points. “df” command will

show you which partitions are mounted to which directories.

○ Mounting/Unmounted file systems (partitions) in linux:

mount -t ext4 /dev/sda4 /mnt umount /mnt

You can also use mount/umount to connect/disconnect network shares (like nfs shares):

mount -t nfs 192.168.1.123:/share1 /mnt umount /mnt

○ File systems are usually mounted at boot time via the /etc/fstab file. ○ In Linux you need to have at least 2 partitions: / and swap.

● File Systems:

○ ext (extended file system): The first file system ever created for linux.

○ ext3 (third extended file system): 3rd generation of the ext file system that now

supports journaling along with a number of other improvements to the file system. ext2 and ext3 used to be the most common file systems used in linux, but now replaced by ext4. ext3 supports up to 16TB file systems, and 2TB file sizes.

○ ext4 (fourth extended file system): 4th generation of the ext file system which

now upports up to 1EB file systems and 16TB file sizes. ext4 is also faster then all previous ext versions and has support for SSD drives via TRIM.

(2)

● Advanced File System Features:

○ Logical Volumes: Extending file systems (partitions) across multiple disks to

create larger volumes and make it easier to expand in the future.

○ Software & Hardware RAID - Redundant Array of Independent Disks

(Inexpensive Drives).

Bootup/Shutdown

● During the Linux install, some code is written to your hard drive's MBR (Master

Boot Record) which tells your computer what files to load from your hard drive to load Linux. This program is usually either LILO (Linux Loader) or GRUB (GRand Unified Bootloader). With most linux boot loaders, you are presented with a boot screen that allows you to choose which kernel to boot.

● Runtime levels (init levels): ○ 0: shutdown

○ 1: single user mode ○ 2: normal user mode ○ 6: reboot

For instance, this command will cause your system to reboot: /sbin/init 6

And this command will cause your system to shutdown: /sbin/init 0

● Other command to shutdown and reboot your system:

shutdown, halt, reboot

● Single User Mode allows you to troubleshoot your system and perform

hardware/software maintenance. Similar to Windows Safe Mode.

● When was the machine last booted? From a Shell/Terminal run: uptime

● Locking Screen or Logging off: Gnome System Menu -> “Lock Screen” or “Log Out” ● Startup Scripts: /etc/rc#.d/* (# is 0, 1, 2, or 6) These scripts get run when

entering or exiting a specific runtime level. Scripts will either start with an S (start) or K (kill), followed by a number to specify an order in which the scripts should run, for instance: /etc/rc2.d/S10syslog-ng, /etc/rc2.d/S89cron

Account Management

● Creating and managing user accounts via Gnome System Menu -> Administration

-> Users and Groups. Allows you to add, delete and change user accounts.

● Shell/Terminal:

useradd -m -g users -u 1001 -s /bin/tcsh -d /home/joe joe userdel -r joe

● /etc/passwd, /etc/shadow, /etc/group

○ /etc/passwd contains account information:

7 fields: username:x:uid:gid:Account Name:home dir:shell uid = user id number, integer | gid = group id number

○ /etc/shadow contains account password and other password settings:

9 fields: username:password:?:?:?:?:?:?:?

○ /etc/group contains group information:

4 fields: groupname:password:gid:list of users for this group

password is usually not used (usually an “x”), and the list of users is comma separated like: video:x:44:demo,tom,mike

● New Account config files are stored in /etc/skel, they get copied over to the user's

home directory (/home/username) when the account gets created.

● Groups: Users can be in multiple groups so that they can do specific things on the

system. For instance, in order to be access your computer's cdrom drive, you must be part of the “cdrom” group. Or for printing, “lpadmin” group.

(3)

● NIS (Network Information Services) aka YP (Yellow Pages): A client-server directory

service protocol that allows you to share accounts between a server and clients.

Quotas

● Enabling Quotas:

Edit /etc/fstab and add the options “usrquota,grpquota” to any partition you want quotas enabled on. Reboot, then run: quotacheck -F vfsv0 -v -c /home

● Commands to control quotas:

edquota: to setup (edit) a user's quota

quota -v: To view a user's quota (they can only view their own) root can view all users' quota: quota -v username

File Permissions

● Changing ownership and permissions on files and directories: Right-click on file or

directory and choose “Properties”. Under the “Permissions” tab, you have the ability to set the different permissions for owner/group/other.

● 4 different types of permissions: read, write, execute, and none for

owner/group/other. The “chmod” command allows you to set the permissions on files. The “chown” command allows you to change ownership of files (when root). Sample file permissions:

rwxr-x--- root sys file1

read/write/execute for “root”, read/execute for group “sys”, none for other.

Linux Memory Management

● RAM and Swap space. A swap file (virtual memory) is simply a file that linux will

use in place of memory if it runs out of physical memory.

● Under the Gnome Application Menu -> System Tools -> System Monitor,

“Resources” tab, allows you to see your physical and swap memory usage.

● Shell/Terminal: “free” command shows physical and swap memory usage.

Networking

● Gnome System Menu -> Administration -> Network. Highlight the “Wired”

interface and click “Properties...” So long as “Roaming mode” isn't selected, then you'll see that it's very similar to Windows, you can either use DHCP or manual (static info) for your network settings. If you Cancel out of that interface's properties, then you'll see the following tabs: Connections, General, DNS, Hosts.

● Shell/Terminal: ifconfig, hostname, netstat, ping ● Config files: /etc/network/interfaces (for Debian)

Process/Job Management

● Under the Gnome Application Menu -> System Tools -> System Monitor, “Process

Table” tab, allows you to see what processes are running your system system and kill them, “End Process”, if necessary. Allows you to see who is running the

process, how much CPU resources or Memory a particular process is using, along with the process's PID (process ID #).

● Shell/Terminal:

ps -aef | more [list process] kill pid [kill process]

kill -9 pid [forcefully kill process] top [interative process monitor]

(4)

Job Scheduling

● cron configuration files:

/etc/crontab sample entry: 0 1 * * 1-3 root /command/to/run

7 fields: minute, hour, day of month, month, day of week, user, command

Config Files

● Most configuration files in linux are plain text files. Files like /etc/hostname,

/etc/passwd, /etc/shadow, /etc/fstab, /etc/crontab, etc, .etc.

● A lot of user configuration files in a user's home directory (/home/username or

~/username) are “dot” files like “.cshrc”, “.bashrc”, “.profile”.

● A large number of front end applications to edit config files (GUI based, text based,

and web based).

Daemons

● Programs that run in the background to perform some special function (SSH server,

Remote Desktop, DNS server, DHCP server, event logging, etc.)

● Gnome System Menu -> Administration -> Services: Start, stop and disable

services from here.

● 3 ways to startup jobs/daemons:

1. startup at bootup (vi /etc/rc scripts)

2. via cron, schedule job to run/startup at a specific time.

3. via inetd daemon: Startup daemons as needed. inetd daemon will run at all times, and will startup daemons (from /etc/inetd.conf) when needed.

● You can see what processes are running via shell/terminal:

ps -aef | more

Logs

● System logs are logged via syslog-ng (or older syslog) daemon. Logs are normally

stored in /var/log directory under different service name files.

● You can also see what your kernel is doing by running: dmesg

● Common log files: /var/log/syslog, /var/log/mail.log, /var/log/auth.log, etc.

GUI vs TEXT

● Graphical: Point & Click. Large number of possible graphical environments: Xorg,

Xfree86, Xgl are the X Window Systems. GNOME & KDE are the common desktop environments. Then you have the window managers: metacity, Compiz Fusion, etc. etc. Very customizable...

● Shell/Terminal: Easily write scripts to automate tasks. Easy to do remote

administration via SSH.

Shell Commands

● Number of different shells available: sh, csh, tcsh, bash, zsh, etc... ● Get help with “man cmd”

● Some general commands: cd, ls, mkdir, rmdir, rm, mv, cp, cat, more, echo

Updates

● Linux update-manager for Debian takes care of updates (similar to Windows

update manager).

● Shell/Terminal: apt-get update; apt-get upgrade

● Upgrading the system's kernel is usually the only time Linux ever needs to be

rebooted, and even that now-a-days can sometimes be done without rebooting your system. (Compared to Windows, which requires a reboot with most updates).

(5)

Package Management

● Gnome System Menu -> Administration -> Synaptic Package Managerallows you to

install and uninstall programs.

● Debian Linux Packages: DEB packages ● Red Hat Packages: RPM packages ● Debian Package installation:

○ apt-get install package-name ○ dpkg -i package-name.deb

○ aptitude is a text based shell package manager. ● Compiling and installing software from source:

tar xf package-name.tar ./configure

make

make install

Backups & File Compression

● The “tar” command is the easiest to use to archive a number of files into one file

which you can then compress (with gzip or bzip2):

tar cfp /tmp/new_file.tar /etc/hosts /etc/hostname [compress] tar xfp /tmp/new_file.tar [extract]

● Most commonly used file compression formats are gzip and bzip2 in linux:

gzip /tmp/new_file.tar [gives you a new_file.tar.gz file] gunzip /tmp/new_file.tar.gz [gives us new_file.tar]

bzip2 /tmp/new_file.tar [gives us new_file.tar.bz2] bunzip2 /tmp/new_file.tar.bz2 [gives us new_file.tar]

● dump/restore: Common unix/linux command for dumping files or entire partition to

some backup area and restoring them as needed.

● Backup to tape, CD, DVD, or disk-to-disk (external USB drive, or NAS/SAN)

Programming

● A large number of programming languages available for Linux: C, Java, Python,

Perl, Shell scripts, etc.

File Sharing

● Linux uses NFS (Network File System) was back in 1984 as a way for Unix systems

to share their file systems between different machines.

● On the server export a directory via NFS by editing /etc/exports and adding an

entry like so:

/home/share1 192.168.1.101(rw,sync,no_root_squash,subtree_check) /home/share2 *(ro,sync,no_root_squash,subtree_check)

● On the client, you use the mount command to access the share like so:

mount -t nfs 192.168.1.100:/home/share1 /mnt [mount share] umount /mnt [unmount share]

● Access Window shares via Samba, you can mount a Windows share via:

mount -t smbfs username=username,password //server/share_name /mnt (You will be prompted to type in a password)

(6)

Remote Management

● VNC (Virtual Network Computing): Remote Desktop protocol that is cross-platform,

supported on: Windows, FreeBSD, MAC, Unix/Linux, etc.

● SSH (Secure SHell) access to shell/terminal from a remote location. Very secure,

powerful and fast. Uses very little network bandwidth.

Security

● File/Directory ownership/permissions ● Linux software firewall (iptables)

● Hardware Firewall for better protection

● Anti-Virus (Clamav): To protect other Windows system on network. ● Disable unneeded services (telnet, etc.)

Miscellaneous

● Web: Apache Web Server ● Email: Postfix Email Server

References

Related documents

Only users who are members of a special sharing group are allowed access to a common sharing directory, and any user may read, write, and modify the permissions or any file created

 Read : in Seq, Btrfs was Slightly Faster than Ext4, Some Opts were Effective, in Rand, Results were Reversed.  Write : Ext4 was almost Twice Faster than Btrfs →

As the ITIL Master Qualification validates the capability of the candidate to apply a range of selected principles, methods and techniques from ITIL ® , throughout the Work

• Manage Red Hat Enterprise Linux networking • Archive and copy files between systems • Install and update software packages • Access Linux file systems.. • Use

Effect of JPEG2000 compression – with compression ratios of 8, 16, 32 – on the distortion of stable and semistable tags when the image test set undergoes other common modifications

In addition to the virtual host names and IP addresses, the SAP application and database-specific file systems have been mounted to the SUSE Linux operating system using NFS from

.NET Framework The .NET Framework is a component of the Windows operating system that provides the programming model for building, deploying and running Web-based applications,

Vacuum to remove surface sediment and soiled aggregate (typically 13-25 mm), refill joints with clean aggregate, sweep surface clean and test infiltration rate again per C1701