Tyler Chris - Fedora Linux стр 73.

Шрифт
Фон

You can now mount the filesystem and use it. Here I'll use /usr/lib/survey as the mount point:

# mkdir /usr/lib/survey

# mount /dev/main/survey /usr/lib/survey

To configure the Fedora system to mount this filesystem every time it is booted, add an entry to the file /etc/fstab :

/dev/main/root / ext3 defaults 1 1

LABEL=/boot /boot ext3 defaults 1 2

devpts /dev/pts devpts gid=5,mode=620 0 0

tmpfs /dev/shm tmpfs defaults 0 0

proc /proc proc defaults 0 0

sysfs /sys sysfs defaults 0 0

/dev/main/swap swap swap defaults 0 0

/dev/main/home /home ext3 defaults 1 2

/dev/main/multimedia /tmp/media ext3 defaults 1 2

/dev/main/survey /usr/lib/survey ext3 defaults 1 2

The new line (highlighted in bold) contains the filesystem block device, the mount point, the filesystem type, any mount options ( defaults specifies the default options, which include mounting the filesystem at boot time), whether the filesystem should be backed up ( 1 meaning yes ), and the fsck sequence number ( 2 is for filesystems that should be checked but that are not the root filesystem).

6.1.1.3.6. Creating a snapshot logical volume

lvcreate

# lvcreate -s /dev/main/survey--name survey-snap--size 500M

Logical volume "survey-snap" created

The -s option indicates that this is a snapshot LV. Specify the origin LV as the first positional argument, and use the --name and --size options as you would for a regular lvcreate command. However, the value given for the --size option must be the amount of space allocated for tracking the differences between the origin LV and the snapshot LV.

Once the snapshot has been created, it can be mounted and used:

# mkdir /usr/lib/survey-snap

# mount /dev/main/survey-snap /usr/lib/survey-snap

To have the snapshot automatically mounted when the system is booted, edit the file /etc/fstab in the

same way that you would for a regular filesystem.

To see how much of a snapshot's storage is in use, use lvs or lvdisplay :

# lvs

LV VG Attr LSize Origin Snap% Move Log Copy%

home main -wi-ao 1.00G

multimedia main -wi-a- 752.00M

root main -wi-ao 9.77G

survey main owi-ao 5.00G

survey-snap main swi-ao 500.00M survey 8.27

swap main -wi-ao 1.00G

# lvdisplay/dev/main/survey-snap --- Logical volume ---

LV Name /dev/main/survey-snap

VG Name main

LV UUID IbG5RS-Tcle-kzrV-Ga9b-Jsgx-3MY6-iEXBGG

LV Write Access read/write

LV snapshot status active destination for /dev/main/survey

LV Status available

# open 1

LV Size 5.00 GB

Current LE 1280

COW-table size 500.00 MB

COW-table LE 125

Allocated to snapshot 8.27%

Snapshot chunk size 8.00 KB

Segments 1

Allocation inherit

Read ahead sectors 0

Block device 253:7

In this case, 8.27% of the snapshot storage has been used, or about 41 MB. If this approaches 100%, you can grow the snapshot LV using lvextend in the same way that a regular LV is grown.

6.1.1.3.7. Removing a logical volume

lvremove

# umount /usr/lib/survey-snap

# lvremove /dev/main/survey-snap

Do you really want to remove active logical volume "survey-snap"? [y/n]: y

Logical volume "survey-snap" successfully removed

Removing an LV is irreversible, so be sure that you're not deleting any important data.

6.1.1.3.8. Adding a partition

pvcreate

# pvcreate /dev/sde1

Physical volume "/dev/sde1" successfully created

If the disk is not partitioned, you can use fdisk or (more easily) parted to create a partition before running pvcreate .

These commands create a single partition that fills the entire disk /dev/sde :

# parted /dev/sde mklabel msdos# parted -- /dev/sde mkpart primary ext2 1 -1

In this case, the partition will be /dev/sde1 .

# vgextend main /dev/sde1

Volume group "main" successfully extended

6.1.1.3.9. Removing a partition

vgreduce

# vgreducemain /dev/sdb1

Physical volume "/dev/sdb1" still in use

In this case, an attempt to remove /dev/sdb1 from the volume group main failed. To move the data off a PV (assuming that there is sufficient space available on other PVs in the volume group), use the pvmove command:

# pvmove/dev/sde1 /dev/sde1:

Moved: 100.0%

Depending on the amount of date to be moved, this operation can take quite a while to run. When it is complete, you can remove the physical volume:

# vgreducemain /dev/sdb1

Removed "/dev/sdb1" from volume group "test"

You can then use that partition for other uses. If you want to erase the LVM disk label, use the pvremove command:

# pvremove/dev/sde1

Labels on physical volume "/dev/sde1" successfully wiped

6.1.1.4. Managing LVM in single-user mode

/var /etc resize2fs

To use resize2fs on these filesystems, you must use runlevel s , which is single-user mode. Boot your system, and press the spacebar when the GRUB boot screen appears. Press the A key to append text to the boot line; then type s and press Enter. After a few seconds, a root shell prompt will appear ( sh-3.1# ).

At this shell prompt you can unmount the filesystem, then use fsck , resize2fs , and lvreduce (or lvextend ). For example, to reduce the size of /home to 925 MB:

Ваша оценка очень важна

0
Шрифт
Фон

Помогите Вашим друзьям узнать о библиотеке