Presentation is loading. Please wait.

Presentation is loading. Please wait.

Partitioning.

Similar presentations


Presentation on theme: "Partitioning."— Presentation transcript:

1 Partitioning

2 Introduction A well-thought-out partitioning scheme is vital to optimizing the use of system resources. While it is technically possible to make post-installation changes to partitions, this may be challenging and require system down time. Therefore, it is important to consider how the system will be used before you begin creating partitions. Partitioning is necessary in order to optimally use the space that hard drives (hard disks) provide. A hard drive is like a completely empty building, with no internal walls or floors. As it is, such a building wouldn't be useful, but populating the building with walls and floors would provide the structure needed to make use of the building.

3 Introduction There are three steps in the process of making and using partitions: 1. Divide the hard drive into partitions 2. Format the hard drive with a filesystem 3. Mount the filesystem onto the directory tree

4 Introduction A typical hard disk drive (HDD) consists of multiple platters, which store data in magnetic form. Heads are able to read and write on both sides of each platter. The platters are connected to the spindle and spin at the same speed. The boom moves back and forth, allowing each head to read from or write to the same location on each platter simultaneously.

5 Introduction One complete rotation around one side of a platter is called a track. The same track on both sides of all of the platters forms a cylinder. A typical hard drive may have thousands of cylinders. Multiple consecutive cylinders can be assigned to a partition. The first partition would be from cylinder 1 to cylinder 544. The second partition would be from cylinder 545 to cylinder The last partition would be from cylinder 1041 to 1600.

6 Partition Naming In order to distinguish one partition from another, each partition is given a unique name. Recall that everything in Linux is treated as a file, so names of devices such as drives and partitions are stored in the /dev directory. There are two different types of drive interfaces: /dev/sd* - Drives that start with sd are either SATA (Serial ATA), SCSI (Small Computer System Interface) or USB drives. The first sd drive is called /dev/sda, the second is called /dev/sdb, etc. /dev/hd* - Drives that start with hd are PATA (Parallel ATA), also known as IDE (Integrated Drive Electronics) drives. The first hd drive is called /dev/hda, the second is called /dev/hdb, etc.

7 Partition Naming Partitions are then given names based on the drive they reside on. A number is added to the end of the drive name to distinguish one partition from another. For example, the partitions located on sda would be named sda1, sda2, etc. Partitions located on drive sdb would be sdb1, sdb2, etc. Test the following commands: cd /dev ls sd*

8 Partition Limitations
Historically, most PCs are limited by their compatibility with a Master Boot Record (MBR) as to the number of partitions that they can use. Recall that the MBR is usually contained within the first sector or 512 bytes of the disk and contains a boot loader program as well as the partition table. The partition table contains the definition of each partition on the hard drive, including which cylinder it starts and ends on and how big it is. Traditional disks using MBR partitioning can have a maximum of four primary partitions . In the next slide, for example, on a traditional SATA drive, four partitions can be created with device names of /dev/sda1, /dev/sda2, /dev/sda3, and /dev/sda4:

9 Partition Limitations

10 Partition Limitations
Modern hardware allows the administrator to make one of the four partitions an extended partition. An extended partition acts like a container for additional partitions called logical partitions. The /dev/sda4 partition is an extended partition. The only thing that is placed in this extended partition are additional partitions, logical partitions. Depending upon the type of hard disk and kernel configuration, Linux can access a maximum of either 15 or 63 total partitions when extended partitions are used.

11 Partition Limitations
! Recently, administrators have begun to use a different type of partitioning technology known as Globally Unique Identifier (GUID) designed to replace traditional MBR partitioning. This new partitioning is available if the system supports the Unified Extensible Firmware (UEFI). The GUID Partition Table (GPT) supports much larger disks with up to 9 ZB in size. Extended and logical partitions are not used with GPT; instead all partitions are the same and GPT supports a maximum of 128 partitions per disk. In addition to MBR and GPT partition tables, there are other methods for dividing up the disk, including Berkeley Software Distribution (BSD) Unix Labels, Apple Partition Maps, and others.

12 The filesystem In order to place files and directories on a partition, a filesystem needs to be created. This is accomplished by formatting the partition. A filesystem provides the operating system with a way to organize the files and directories, as well as store information about files, such as the permissions of the files, the owner of the files and the file type. Each file will have an entry in the filesystem database, similar to a library catalog, although the database is often referred to as a table. Metadata about the file will be contained in this entry, which is everything about the file except for its contents. The entry also includes a unique identification number for the file, called an inode number and pointers (or links) that inform the operating system where in the filesystem (where on the hard drive) the file's data is stored.

13 Common filesystem types
• ext2: Second Extended Filesystem Advantages: Works well with small and solid-state disk filesystems. Disadvantages: No journaling capability, making it susceptible to data loss in the event of power loss. • ext3: Third Extended Filesystem Advantages: Can be upgraded from existing ext2 filesystem without data loss. This filesystem performs journaling, which allows for data recovery after a crash. Disadvantages: Writes more to disk than ext2 because of journaling, making it slower. Does not support very large filesystems. • ext4: Fourth Extended Filesystem Advantages: Support for very large disk volumes and file sizes. Can operate with or without a journal. Backwards compatible with ext3 and ext2. Disadvantages: Not a huge improvement over ext3. No dynamic inode creation. • reiserfs: The Reiser Filesystem Advantages: The first journaling filesystem for Linux. Works efficiently with small files. Disadvantages: Development of this version has ceased with its successor Reiser4 proceeding slowly without help from the founder.

14 Common filesystem types
• xfs: Extents Filesystem Advantages: Works very efficiently with large files. Compatible with the IRIX operating system from SGI. Announced to be the default filesystem for RHEL 7. Disadvantages: The filesystem cannot be shrunk. • vfat: File Allocation Table Advantages: Supported by almost all operating systems. Commonly used for removable media. Disadvantages: Unable to support very large disks or files. Microsoft's intellectual property claims. • iso: ISO 9660 Advantages: The International Organization for Standardization standard for optical disc media that is supported by almost all operating systems. Disadvantages: Multiple levels and extensions complicate compatibility. Not designed for rewritable media. • udf: Universal Disc Format Advantages: Designed to replace ISO 9660 and adopted as the standard format for DVDs by the DVD Consortium. Disadvantages: Write support is limited to support revision 2.01 of the standard.

15 Summary of key terms Filesystem: A database system used to organize files. Table: The database where the filesystem stores its information. Metadata: File attributes like ownership, timestamps, data block locations, etc. Inode: A unique number given to each file on the filesystem. About filesystem journaling: As files are changed, metadata is not initially stored on the hard drive, but rather in memory. This speeds up the filesystem as writing these changes to the hard drive for every single file change would result in a lot of hard drive writes. At specific intervals, this metadata is written to the hard drive in large chunks; this process is called syncing. Normally this poses no problems, but if the system were to crash or lose power before a sync occurred, all of that metadata would be lost. A filesystem recovery program, like the fsck command, can often resolve these problems, but this can take quite a bit of time for large filesystems. A journal limits filesystem recovery. For every change made to a file, a journal entry is stored on the hard drive. While this does increase filesystem writes, a journal entry has much less impact on hard drive performance that writing the metadata directly to the hard drive for each file change. In a nutshell, a journal filesystem aids in recovering corrupted filesystems while allowing for reduced hard drive writes.

16 Linux Filesystem Components
The term "Linux filesystem" often refers to the ext2/ext3/ext4 family of filesystems. While there are differences between these filesystems, they are similar enough when it comes to core filesystem components: • Superblock: At the beginning of the filesystem is an area called the superblock. This area is used to store important information about the filesystem, including the size of the filesystem, the type of filesystem and which data blocks (where file data is stored) are available. The superblock is a key component of the filesystem; a corrupted superblock would make the filesystem inaccessible. • Group Block: The filesystem is divided into smaller sections called groups. The group block serves to hold data about the group. Each group block also contains a backup copy of the superblock. • Inode Table: Each file is assigned a unique inode number for the filesystem. This inode number is associated with a table that stores the file's metadata.

17 Physical vs. Virtual Filesystems
In case of Windows we use drive letters. (see disk management as an example) In Linux there are no drive letters. Instead, each partition is assigned a device file name, like: • /dev/sda1, /dev/sda2, etc for partitions on SATA, SCSI and USB devices • /dev/hda1, /dev/hda2, etc for partitions on PATA/IDE devices Users do not access the files that are stored on these partitions by directly using these device file names. After all, it's not convenient to remember what files are located on /dev/sda1 versus what files are stored on /dev/sda2. Instead, these device files are merged into the directory structure by mounting the partition's filesystem under a directory tree.

18 Virtual Filesystems

19 Conclusions (2) All of the files under the /home directory are really stored in the filesystem that is on the /dev/sda3 partition. All of the files under the /var directory are stored in the filesystem that is on the /dev/sda2 partition. This makes /home and /var mount point directories. The / directory is also a mount point directory, likely for the filesystem on the /dev/sda1 partition. The process of placing a filesystem under a mount point is called mounting. This is accomplished either automatically at boot or manually with the mount command.

20 Virtual filesystems If the administrator were to unmount the /dev/sda3 filesystem from the previous example, then the virtual filesystem would look like the following:

21 Virtual filesystems Notice that now there is nothing under the /home directory. This is common because a mount point directory should be empty, as anything contained in a mount point directory will be inaccessible after the unmount. The /dev/sda3 filesystem is mounted under the /home directory, then the bob and sue directories would again be available.

22 Why Create Partitions? As a rule, at least one partition needs to be created. Regardless of the operating system, whether Linux, Microsoft Windows or Mac OSX, at least one single partition needs to be created because filesystems are stored within partitions, not entire hard disks. Offering support for multiple operating systems Some systems may contain Linux as well as Microsoft Windows operating systems; these are called dual boot systems. Because the filesystems that are used with Microsoft Windows are different than Linux, this requires multiple partitions. Home Directories A separate partition for the user home directories is common and typically provides many advantages, including: • It is easier to backup or restore an entire filesystem than it is to manage each user's home directory. Recall that each partition has a separate filesystem. • When home directories are separated from the root filesystem, upgrades of the operating system can be performed much more safely and efficiently. • Filesystems can have features enabled on them, such as disk quotas. A disk quota allows the administrator to limit how much space a user uses in a filesystem. Being able to create a disk quota for the home directories that doesn't affect the rest of the operating system can be an advantage.

23 Why Create Partitions? Common Writable Directories
Some directories, such as the /tmp and /var/tmp directories, are world writable. This means that any user can store files in these directories without any limitations by default. Unfortunately, that can cause problems if these directories are not placed on separate filesystems. If the /tmp and /var/tmp directories are not mount points, then files placed in these directories will go on the same partition as the / filesystem. If a user creates a very large file, then he could end up filling up the entire / filesystem. This would make the operating system unusable by all other users (except the root user for whom some space is reserved). Separating the /tmp and /var/tmp directories allows the administrator to enable disk quotas to limit how much space can be used by each user in those directories. Even if no quotas are put into effect, having directories on a separate partition means if a regular user fills up the partition(s) /tmp or /var/tmp are located on, the root filesystem or other critical filesystems are not affected.

24 Why Create Partitions? Security
Using separate partitions may be done for security. Having files in a separate partition is safer than if they were a part of a larger root filesystem because there is less risk of corruption. When using a separate filesystem, there will be separate inodes and data blocks, so there is less chance that they might be overwritten. Sometimes a collection of files, perhaps old databases, need to be stored but shouldn't be modified. By placing them on a separate filesystem, that partition can be mounted as read-only to prevent any alteration. Heavily Active If running out of space is a concern due to heavy activity within a directory, it may be desirable to have it mounted on a separate partition. This is often the case for directories like the /var/log directory where the system adds log file data on a regular basis. When system processes (as opposed to regular users) write to the disk, quotas are not usually used to limit the space. Instead, these types of directories are mounted on separate filesystems so that if they fill up then it won't fill up the / filesystem. While this may be bad because log files aren't generated, it is better than filling up the / filesystem and making the operating system unusable for regular users.

25 Key terms summary / (root) filesystem
The filesystem that is contained on the same partition on which the root directory is located, and it is the filesystem on which all the other filesystems are mounted as the system is booted up. /boot filesystem The directory containing everything required for the boot process except for configuration files not needed at boot time. /home filesystem Typically the parent directory for individual user home directories. Each users personal files may be stored within the user subdirectories along with user specific configuration files. /var filesystem The directory containing variable data like system logging files, mail and printer spool directories, and transient and temporary files. MBR The Master Boot Record (MBR) is the first 512 bytes of a storage device. It contains an operating system bootloader and the storage device's partition table.

26 Key terms summary fsck Command used to check and optionally repair one or more Linux file systems. If no filesystem is specified with the command, fsck will check all filesystems in the /etc/fstab file by default. mount points A connection between a partition’s file system and a folder allowing you to access the files on the partition. parted A disk partitioning and partition resizing utility. It allows an administrator to destroy, create, resize, move, and copy ext2, linux-swap, FAT, FAT32, and reiserfs partitions. partitions The logical division of the available space on a hard drive into one or more sections that can be accessed independently of one another. swap space Used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space.


Download ppt "Partitioning."

Similar presentations


Ads by Google

聚圣源小组起名云南卫视2019年猪婴儿起乳名公司起名官财艺哪个重要洛莉塔巢蓝郡姓孙起名男孩名字大全义齿公司起名鼠年男孩男孩起名科学发展观第一要义是济宁安全教育平台生化之丧尸突击新世界珠宝2021女孩起名秦 起名起名网徐姓高的名字怎么起凌霄之上什么是心机法网冠军用睿字起名的正能量的话励志的语句姓王的起名缺木起名大全带木的字有爱乐影院企业英文起名革命者演员表南丹瑶鸡走进初中农资公司免费起名淀粉肠小王子日销售额涨超10倍罗斯否认插足凯特王妃婚姻让美丽中国“从细节出发”清明节放假3天调休1天男孩疑遭霸凌 家长讨说法被踢出群国产伟哥去年销售近13亿网友建议重庆地铁不准乘客携带菜筐雅江山火三名扑火人员牺牲系谣言代拍被何赛飞拿着魔杖追着打月嫂回应掌掴婴儿是在赶虫子山西高速一大巴发生事故 已致13死高中生被打伤下体休学 邯郸通报李梦为奥运任务婉拒WNBA邀请19岁小伙救下5人后溺亡 多方发声王树国3次鞠躬告别西交大师生单亲妈妈陷入热恋 14岁儿子报警315晚会后胖东来又人满为患了倪萍分享减重40斤方法王楚钦登顶三项第一今日春分两大学生合买彩票中奖一人不认账张家界的山上“长”满了韩国人?周杰伦一审败诉网易房客欠租失踪 房东直发愁男子持台球杆殴打2名女店员被抓男子被猫抓伤后确诊“猫抓病”“重生之我在北大当嫡校长”槽头肉企业被曝光前生意红火男孩8年未见母亲被告知被遗忘恒大被罚41.75亿到底怎么缴网友洛杉矶偶遇贾玲杨倩无缘巴黎奥运张立群任西安交通大学校长黑马情侣提车了西双版纳热带植物园回应蜉蝣大爆发妈妈回应孩子在校撞护栏坠楼考生莫言也上北大硕士复试名单了韩国首次吊销离岗医生执照奥巴马现身唐宁街 黑色着装引猜测沈阳一轿车冲入人行道致3死2伤阿根廷将发行1万与2万面值的纸币外国人感慨凌晨的中国很安全男子被流浪猫绊倒 投喂者赔24万手机成瘾是影响睡眠质量重要因素春分“立蛋”成功率更高?胖东来员工每周单休无小长假“开封王婆”爆火:促成四五十对专家建议不必谈骨泥色变浙江一高校内汽车冲撞行人 多人受伤许家印被限制高消费

聚圣源 XML地图 TXT地图 虚拟主机 SEO 网站制作 网站优化