2.1 Design Hard Disk Layout

22Jan - by qkim0x01 - 0 - In Private Notes
102. Linux Install Package Manage
Design a Hard Disk Layout

This is a note I made while I was reading a book about Linux

@: Command, +: File, #: Example

 

 

  • System Considerations
    • – amount of disk space
    • – size of the system
    • – use of system
    • – how and where to backup

 

  • Limited disk space
    • – Depends on system requirement and available filesystem resource

 

  • Larger system
    • – example in book

 

  • Mount point
    • – before go into filesystem, I need to list them in a filesystem table
      • – Mounting
        • – the process of listing filesystem
      • – The directory I’m mouting on
    • + /etc/fstab
      • – mount point is managed by this on system start up

 

  • Superblock
    • – a block on each filesystem contains metadata
      • – about filesystem layout
      • – type, size, status of filesystem
    • – equivalaent to File Allocation Table (FAT)
    • – keep redundant copies of superblock

 

  • MBR
    • – Master Boot Record (MBR)
    • – contains information about hard disk partitions
    • – loads OS
    • – located in first sector of hard disk
      • – 512 bytes
    • @ dd
      • – to back up MBR
      • # dd if=/dev/hda of=/~/mbr.txt count=1 bs=512
        • – assuming hard drive is /dev/hda
        • – one copy (count=1)
      • # dd if=~/mbr.txt of=/dev/hda count=1 bs=512
        • – to restore

 

  • Booting from a USb device
    • – Live usb or Live CD
      • – can write back to USB, but not CD
    • – need to make the USB bootable
      • – set at least one partiions of USB with the bootable flag to primary partition
      • – MBR mush write to the primary partition
    • – need BIOS setting to boot USB

 

  • System role
    • – dectate the optimal disk layout

 

  •  Backup
    • – some schemes use disk partitions as the basic unit
      • – filesystems in /etc/fstab is backed up separately
      • – they are arranged so each filesystem fits within the size of backup media
    • @ dd
      • – back up each partition
      • # dd if=/dev/hdx of=/dev/hdy
    • @ sfdisk
      • – create a copy of partition table
      • – back up of the partition layout
      • # sfdisk -d /dev/hda > parition_backup.txt
      • # sfdisk /dev/hda < partition_backup.txt
    • @ df
      • – report file system disk space usage

 

  • Swap space
    • – or virtual memory
    • – to temporarily store portions of main memory that are not needed now
    • – old rule
      • – double of RAM

 

  • General Guidlines
    • – keep (/) simple
    • – seperate a small /boot partition below cylinder 1024
      • – for installed kernels used by boot loader
      • – not for newer BIOS and kernels (eg., 2.6.20)
    • – Separate /var
      • – big enough for logs, spools, mail
    • – separate /tmp
      • – depends on demands of applications
    • – separate /usr
      • – make it stand alone
    • – separate /home
      • – for multiple users
      • – put /home on a disk array and use Logical Volume manager (LVM)
    • – set swap as at least of RAM

Leave a Reply

Your email address will not be published. Required fields are marked *