• Aucun résultat trouvé

12.4 . Resizing a Part it ion

⁠Chapt er 1 2 . Part it ions

Warning

Do not attempt to resize a partition on a device that is in use.

Pro ced u re 12.4 . Resiz e a p art it io n

1. Before resizing a partition, boot into rescue mode (or unmount any partitions on the device and turn off any swap space on the device).

2. Start parted, where /d ev/sda is the device on which to resize the partition:

# parted /d ev/sda

3. View the current partition table to determine the minor number of the partition to resize as well as the start and end points for the partition:

# pri nt

4. To resize the partition, use the resi ze command followed by the minor number for the partition, the starting place in megabytes, and the end place in megabytes.

Examp le 12.2. Resiz e a p art it io n For example:

resi ze 3 1024 2048

Warning

A partition cannot be made larger than the space available on the device

5. After resizing the partition, use the pri nt command to confirm that the partition has been resized correctly, is the correct partition type, and is the correct file system type.

6. After rebooting the system into normal mode, use the command d f to make sure the partition was mounted and is recognized with the new size.

Chapter 13. Snapper

Red Hat Enterprise Linux 7 introduces the snapper utility. Snapper comes with the following features:

Creating read-only snapshots from mounted and configured snapper volumes is easier than using raw LVM2 commands or btrfs-progs commands.

Ability to delete snapshots.

Ability to list all snapshots in the snapper configuration.

Snapper provides the same features for btrfs volumes and LVM2 thin provisioned volumes as the specific file system tools.

The status command provides a well arranged overview of all the modifications in a snapper volume between various snapshots. See Section 13.3, “ Snapper status Command” for an explaination of the status command's output.

The und o chang e command provides a limited but powerful means for reverting changes in the system. This is useful for reverting changes in configuration and works best for setting up spearated snapper volumes (for example, /ho me, /usr, /usr/var/l o g).

The d i ff command prints out diff outputs for files with modified content according to the status report.

The xad i ff command provides a list of modified extened attributes in a similar form to the d i ff command. It is also applied on the output of a status report.

13.1. Init ial Snapper Set up

The following example shows how to set up the /ho me for snapper:

Examp le 13.1. In it ial Sn ap p er Set u p Examp le

The /ho me directory needs to be included in a snapper configuration. In order to achieve this, the following must be true:

1. /ho me needs to either be on:

a separate thinly provisioned logical volume with a supported file system on top of it, or a BTRFS subvolume.

2. The file system must be mounted.

3. LVM:

# snapper -c home_volume create-config -f "lvm(xfs)" /home BTRFS:

# snapper -c home_volume create-config -f btrfs /home

⁠Chapt er 1 3. Snapper

Creating a snapshot works the same for both LVM and BTRFS. If the --type or -t option is ommited then a single type of snapper snapshot is created.

Examp le 13.2. Creat in g a sn ap p er sn ap sh o t examp le

To create a new pre-snapper snapshot on an LVM snapper volume called lvm_with_xfs use the following command:

# snapper -c lvm_with_xfs create -t pre -p This could, for example, give the output: 6.

To create a post snapshot tied to its parent pre snapshot, use the following command:

# snapper -c lvm_with_xfs create -t post --pre-num 6 -p This, coupled with the pre snapshot command above, would give the output: 7.

Now 6 and 7 snapshots are a pre/post pair and if the snapper volume is configured correctly, the background comparison is being created by the snapper daemon.

13.3. Snapper

status

Command

The following section explains the output of the snapper status command.

Examp le 13.3. Sn ap p er status co mman d examp le

The following example runs the status command on a single snapper volume called home_vol and compares snapshots 1 and 2.

snapper -c home_vol status 1..2 tp.... /home/user/dir1

-... /home/user/dir1/file_a c.ug.. /home/user/file2

+... /home/user/file3 ....x. /home/user/file4 cp..xa /home/user/file5

The letters and dots in the first part of the output can be read as columns.

+... /home/user/example_file

||||||

123456 Co lu mn 1

This indicates any modification in the file's (directory entry) type. The possible values are:

.

Nothing has changed.

+

File created.

-File deleted.

c

Content changed.

t

Type of directory entry has changed (for example, a former symbolic link has changed to a regular file with the same file name).

Co lu mn 2

This indicates any changes in the file's permissions. The possible values are:

.

No permissions changed.

p

Permissions changed Co lu mn 3

This indicates any changes in the user ownership. The possible values are:

.

No user ownership changed.

u

User ownership has changed Co lu mn 4

This indicates any changes in the group ownership. The possible values are:

.

No group ownership changed.

g

Group ownership has changed.

Co lu mn 5

This indicates any changes in the extended attributes. The possible values are:

.

No extended attributes changed.

⁠Chapt er 1 3. Snapper

Extended attributes changed.

Co lu mn 6

This indicates any changes in the access control lists (ACLs). The possible values are:

.

No ACLs changed.

a

ACLs modified