Linux Storage.Pdf
Total Page:16
File Type:pdf, Size:1020Kb
Linux Storage Paul Cobbaut Linux Storage Paul Cobbaut Paul Cobbaut Publication date 2015-05-24 CEST Abstract This book is meant to be used in an instructor-led training. For self-study, the intent is to read this book next to a working Linux computer so you can immediately do every subject, practicing each command. This book is aimed at novice Linux system administrators (and might be interesting and useful for home users that want to know a bit more about their Linux system). However, this book is not meant as an introduction to Linux desktop applications like text editors, browsers, mail clients, multimedia or office applications. More information and free .pdf available at http://linux-training.be . Feel free to contact the author: • Paul Cobbaut: [email protected], http://www.linkedin.com/in/cobbaut Contributors to the Linux Training project are: • Serge van Ginderachter: [email protected], build scripts; infrastructure setup; minor stuff • Hendrik De Vloed: [email protected], buildheader.pl script We'd also like to thank our reviewers: • Wouter Verhelst: [email protected], http://grep.be • Geert Goossens: [email protected], http://www.linkedin.com/in/ geertgoossens • Elie De Brauwer: [email protected], http://www.de-brauwer.be • Christophe Vandeplas: [email protected], http://christophe.vandeplas.com • Bert Desmet: [email protected], http://bdesmet.be • Rich Yonts: [email protected], Copyright 2007-2015 Paul Cobbaut Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled 'GNU Free Documentation License'. Table of Contents I. file security ................................................................................................................................................... 1 1. standard file permissions ................................................................................................................ 3 1.1. file ownership ........................................................................................................................ 4 1.2. list of special files ................................................................................................................. 6 1.3. permissions ............................................................................................................................ 7 1.4. practice: standard file permissions ...................................................................................... 12 1.5. solution: standard file permissions ...................................................................................... 13 2. advanced file permissions .............................................................................................................. 15 2.1. sticky bit on directory ......................................................................................................... 16 2.2. setgid bit on directory ......................................................................................................... 16 2.3. setgid and setuid on regular files ........................................................................................ 17 2.4. setuid on sudo ..................................................................................................................... 17 2.5. practice: sticky, setuid and setgid bits ................................................................................ 18 2.6. solution: sticky, setuid and setgid bits ................................................................................ 19 3. access control lists .......................................................................................................................... 21 3.1. acl in /etc/fstab ..................................................................................................................... 22 3.2. getfacl .................................................................................................................................. 22 3.3. setfacl ................................................................................................................................... 22 3.4. remove an acl entry ............................................................................................................. 23 3.5. remove the complete acl ..................................................................................................... 23 3.6. the acl mask ......................................................................................................................... 23 3.7. eiciel ..................................................................................................................................... 24 4. file links ........................................................................................................................................... 25 4.1. inodes ................................................................................................................................... 26 4.2. about directories .................................................................................................................. 27 4.3. hard links ............................................................................................................................. 28 4.4. symbolic links ...................................................................................................................... 29 4.5. removing links ..................................................................................................................... 29 4.6. practice : links ..................................................................................................................... 30 4.7. solution : links ..................................................................................................................... 31 II. disk management ...................................................................................................................................... 32 5. disk devices ..................................................................................................................................... 35 5.1. terminology .......................................................................................................................... 36 5.2. device naming ...................................................................................................................... 38 5.3. discovering disk devices ..................................................................................................... 39 5.4. erasing a hard disk .............................................................................................................. 44 5.5. advanced hard disk settings ................................................................................................ 45 5.6. practice: hard disk devices .................................................................................................. 46 5.7. solution: hard disk devices .................................................................................................. 47 6. disk partitions ................................................................................................................................. 49 6.1. about partitions .................................................................................................................... 50 6.2. discovering partitions .......................................................................................................... 51 6.3. partitioning new disks ......................................................................................................... 53 6.4. about the partition table ...................................................................................................... 55 6.5. GUID partition table ........................................................................................................... 56 6.6. labeling with parted ............................................................................................................. 56 6.7. practice: partitions ............................................................................................................... 58 6.8. solution: partitions ............................................................................................................... 59 7. file systems ...................................................................................................................................... 60 7.1. about file systems ................................................................................................................ 61 7.2. common file systems ........................................................................................................... 62 7.3. putting a file system on a partition ..................................................................................... 65 7.4. tuning a file system ............................................................................................................. 66 7.5. checking a file system ......................................................................................................... 67 7.6. practice: file systems ..........................................................................................................