linux-raw-filesystem-management
| rev 5 | rev 6 | ||||
|---|---|---|---|---|---|
| 78 | 78 | ||||
| 79 | 79 | ||||
| n | n | 80 | Remount read-only or read-write | ||
| 81 | =================================== | ||||
| 80 | 82 | ||||
| t | t | 83 | Sometimes live disks and rescue modes mount your partitions for you. I'm my cas | ||
| > | e 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: | ||||
| 84 | |||||
| 85 | .. code-block:: bash | ||||
| 86 | |||||
| 87 | mount -o remount,rw /dev/mapper/VolGroup00-LogVol0 / | ||||
| 88 | |||||
| 89 | 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 t | ||||
| > | o recover it. | ||||
| 90 | |||||
| 91 | |||||
| 92 | |||||
| rev 4 | rev 5 | ||||
|---|---|---|---|---|---|
| t | t | 1 | Linux Raw File system Management | ||
| 2 | ########################################### | ||||
| 3 | |||||
| 1 | Pretend we have added a new disk to our computer. | 4 | Pretend we have added a new disk to our computer. | ||
| 2 | 5 | ||||
| rev 3 | rev 4 | ||||
|---|---|---|---|---|---|
| n | 1 | I have added a new disk /dev/xvdf | n | 1 | Pretend we have added a new disk to our computer. |
| 2 | 2 | ||||
| t | 3 | we need to run the following commands on this device to get it ready for a file | t | 3 | The operating system has detected this new disk as device /dev/xvdf. |
| > | system. | ||||
| 4 | |||||
| 5 | The following documents the steps we need to take to use this new space. | ||||
| 4 | 6 | ||||
| 5 | Partition the device | 7 | Partition the device | ||
| rev 2 | rev 3 | ||||
|---|---|---|---|---|---|
| 61 | sudo mount /dev/xvdf1 /mnt | 61 | sudo mount /dev/xvdf1 /mnt | ||
| 62 | 62 | ||||
| t | t | 63 | |||
| 64 | Automatically mount partition at system boot | ||||
| 65 | ================================================= | ||||
| 66 | |||||
| 67 | Add an entry into /etc/fstab for new partition. | ||||
| 68 | |||||
| 69 | .. code-block:: text | ||||
| 70 | |||||
| 71 | /dev/xvdf1 /mnt ext4 defaults 0 0 | ||||
| 72 | |||||
| 73 | |||||
| 74 | |||||
| 75 | |||||
| rev 1 | rev 2 | ||||
|---|---|---|---|---|---|
| 48 | 48 | ||||
| 49 | 49 | ||||
| n | n | 50 | Mount and test the new filesystem | ||
| 51 | ======================================= | ||||
| 50 | 52 | ||||
| t | t | 53 | |||
| 54 | .. code-block:: bash | ||||
| 55 | |||||
| 56 | sudo mount /dev/xvdf1 /mnt | ||||
| 57 | touch /mnt/testfile | ||||
| 58 | ls /mnt | ||||
| 59 | sudo umount /mnt | ||||
| 60 | ls /mnt | ||||
| 61 | sudo mount /dev/xvdf1 /mnt | ||||
| 62 | |||||
| empty | rev 1 | ||||
|---|---|---|---|---|---|
| t | t | 1 | I have added a new disk /dev/xvdf | ||
| 2 | |||||
| 3 | we need to run the following commands on this device to get it ready for a file | ||||
| > | system. | ||||
| 4 | |||||
| 5 | Partition the device | ||||
| 6 | ======================== | ||||
| 7 | |||||
| 8 | You may cut the device into separate logical disks. | ||||
| 9 | |||||
| 10 | In my case I want to use the whole disk | ||||
| 11 | |||||
| 12 | .. code-block:: bash | ||||
| 13 | |||||
| 14 | sudo fdisk /dev/xvdf | ||||
| 15 | # choose needed settings | ||||
| 16 | |||||
| 17 | Format the partition with a filesystem | ||||
| 18 | ======================================== | ||||
| 19 | |||||
| 20 | We want to use ext4 so we do | ||||
| 21 | |||||
| 22 | .. code-block:: bash | ||||
| 23 | |||||
| 24 | sudo mkfs.ext4 /dev/xvdf | ||||
| 25 | |||||
| 26 | mke2fs 1.42 (29-Nov-2011) | ||||
| 27 | Filesystem label= | ||||
| 28 | OS type: Linux | ||||
| 29 | Block size=4096 (log=2) | ||||
| 30 | Fragment size=4096 (log=2) | ||||
| 31 | Stride=0 blocks, Stripe width=0 blocks | ||||
| 32 | 6553600 inodes, 26214400 blocks | ||||
| 33 | 1310720 blocks (5.00%) reserved for the super user | ||||
| 34 | First data block=0 | ||||
| 35 | Maximum filesystem blocks=4294967296 | ||||
| 36 | 800 block groups | ||||
| 37 | 32768 blocks per group, 32768 fragments per group | ||||
| 38 | 8192 inodes per group | ||||
| 39 | Superblock backups stored on blocks: | ||||
| 40 | 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, | ||||
| > | |||||
| 41 | 4096000, 7962624, 11239424, 20480000, 23887872 | ||||
| 42 | |||||
| 43 | Allocating group tables: done | ||||
| 44 | Writing inode tables: done | ||||
| 45 | Creating journal (32768 blocks): done | ||||
| 46 | Writing superblocks and filesystem accounting information: done | ||||
| 47 | |||||
| 48 | |||||
| 49 | |||||
| 50 | |||||
Remarkbox