% Options for packages loaded elsewhere
\PassOptionsToPackage{unicode}{hyperref}
\PassOptionsToPackage{hyphens}{url}
%
\documentclass[
]{article}
\usepackage{amsmath,amssymb}
\usepackage{iftex}
\ifPDFTeX
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
  \usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex
  \usepackage{unicode-math} % this also loads fontspec
  \defaultfontfeatures{Scale=MatchLowercase}
  \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
\fi
\usepackage{lmodern}
\ifPDFTeX\else
  % xetex/luatex font selection
\fi
% Use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\IfFileExists{microtype.sty}{% use microtype if available
  \usepackage[]{microtype}
  \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\makeatletter
\@ifundefined{KOMAClassName}{% if non-KOMA class
  \IfFileExists{parskip.sty}{%
    \usepackage{parskip}
  }{% else
    \setlength{\parindent}{0pt}
    \setlength{\parskip}{6pt plus 2pt minus 1pt}}
}{% if KOMA class
  \KOMAoptions{parskip=half}}
\makeatother
\usepackage{xcolor}
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering
\ifLuaTeX
  \usepackage{selnolig}  % disable illegal ligatures
\fi
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\urlstyle{same}
\hypersetup{
  pdftitle={linux-raw-filesystem-management},
  hidelinks,
  pdfcreator={LaTeX via pandoc}}

\title{linux-raw-filesystem-management}
\author{}
\date{}

\begin{document}
\maketitle

\hypertarget{linux-raw-filesystem-management}{%
\section{linux-raw-filesystem-management}\label{linux-raw-filesystem-management}}

Linux Raw File system Management
\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#

Pretend we have added a new disk to our computer.

The operating system has detected this new disk as device /dev/xvdf.

The following documents the steps we need to take to use this new space.

\hypertarget{partition-the-device}{%
\section{Partition the device}\label{partition-the-device}}

You may cut the device into separate logical disks.

In my case I want to use the whole disk

.. code-block:: bash

sudo fdisk /dev/xvdf \# choose needed settings

\hypertarget{format-the-partition-with-a-filesystem}{%
\section{Format the partition with a
filesystem}\label{format-the-partition-with-a-filesystem}}

We want to use ext4 so we do

.. code-block:: bash

sudo mkfs.ext4 /dev/xvdf

mke2fs 1.42 (29-Nov-2011) Filesystem label= OS type: Linux Block
size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe
width=0 blocks 6553600 inodes, 26214400 blocks 1310720 blocks (5.00\%)
reserved for the super user First data block=0 Maximum filesystem
blocks=4294967296 800 block groups 32768 blocks per group, 32768
fragments per group 8192 inodes per group Superblock backups stored on
blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632,
2654208, 4096000, 7962624, 11239424, 20480000, 23887872

Allocating group tables: done\\
Writing inode tables: done\\
Creating journal (32768 blocks): done Writing superblocks and filesystem
accounting information: done

\hypertarget{mount-and-test-the-new-filesystem}{%
\section{Mount and test the new
filesystem}\label{mount-and-test-the-new-filesystem}}

.. code-block:: bash

sudo mount /dev/xvdf1 /mnt touch /mnt/testfile ls /mnt sudo umount /mnt
ls /mnt sudo mount /dev/xvdf1 /mnt

\hypertarget{automatically-mount-partition-at-system-boot}{%
\section{Automatically mount partition at system
boot}\label{automatically-mount-partition-at-system-boot}}

Add an entry into /etc/fstab for new partition.

.. code-block:: text

/dev/xvdf1 /mnt ext4 defaults 0 0

\hypertarget{remount-read-only-or-read-write}{%
\section{Remount read-only or
read-write}\label{remount-read-only-or-read-write}}

Sometimes live disks and rescue modes mount your partitions for you. In
my case the rescue was mounting root partition as read-only, and I
needed to remove an entry in /etc/fstab. This command will remount a
partition with rw:

.. code-block:: bash

mount -o remount,rw /dev/mapper/VolGroup00-LogVol0 /

This allowed me to edit /etc/fstab, remove the bad entry and reboot. The
server came back online. We still need to figure out what happened to
the disk, try to recover it.

\end{document}
