Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have got a book "RHEL 5 Administration Unleashed By Tammy Fox".
The author describes "Taking a Snapshot of a Logical Volume". I was once asked in an interview: "How do we do mirroring of an Logical Volume?", and I was not sure of it.
Is Mirroring of an LV is the same thing as Taking a Snapshot of it? If not, then, how to?
Normally "mirroring" would refer to setting up a RAID 1 either through software or hardware, normally with interview questions I'd ask for a clarification as to whether they mean raid mirror or some kind of time based snapshot. If it's a time-based snapshot to a different/remote volume you could look at DIRVISH as an option.
Normally "mirroring" would refer to setting up a RAID 1 either through software or hardware, normally with interview questions I'd ask for a clarification as to whether they mean raid mirror or some kind of time based snapshot.
That's exactly what I asked him! But he said: "RAID Controller is not there on the system. We are not concerned about implementing RAID. We want mirroring out of LVM only. Is it possible or not?" I said: "Mirroring is RAID 1. That's it. Not sure how to achieve it using LVM". He was disappointed.
That's exactly what I asked him! But he said: "RAID Controller is not there on the system. We are not concerned about implementing RAID. We want mirroring out of LVM only. Is it possible or not?" I said: "Mirroring is RAID 1. That's it. Not sure how to achieve it using LVM". He was disappointed.
pretty much would have been my answer too, although you could have said that it may have been possible to implement a linux software RAID for mirroring but that hardware raid is much more reliable.
I created a Logical Volume "/dev/myVolGrp00/scripts" and wrote some files in the mount point "/scripts" and created another snapshot LV "/dev/myVolGrp00/scripts-snapshot" for it and added some more files but I see nothing in the snapshot "":
Code:
[root@localhost ~]# lvdisplay
--- Logical volume ---
LV Name /dev/myVolGrp00/scripts
VG Name myVolGrp00
LV UUID NPRoIf-QEx1-aSv1-PF4V-Lyc1-ibIY-9PRsS3
LV Write Access read/write
LV snapshot status source of
/dev/myVolGrp00/scripts-snapshot [active]
LV Status available
# open 1
LV Size 8.00 MiB
Current LE 2
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
--- Logical volume ---
LV Name /dev/myVolGrp00/scripts-snapshot
VG Name myVolGrp00
LV UUID yv1h3Y-0mjm-uM2P-vu3b-qZWZ-W4ta-DsmYKX
LV Write Access read/write
LV snapshot status active destination for /dev/myVolGrp00/scripts
LV Status available
# open 0
LV Size 8.00 MiB
Current LE 2
COW-table size 4.00 MiB
COW-table LE 1
Allocated to snapshot 0.29%
Snapshot chunk size 4.00 KiB
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
[root@localhost ~]# ls -ltr /snap-scripts/
total 12
drwx------. 2 root root 12288 Mar 13 03:38 lost+found
Of course, before mounting them I had formatted them, for example:
I simply followed the System Admin book. It does not say anything about how snapshot is going show the files/directories as well as how to reduce the Logical Volume's size. I have successfully extended its size but reducing did not work with the "lvextend -r" command.
Mirroring and snapshots are two different features.
With LVM, one can set up mirrors:
Code:
-m, --mirrors Mirrors
Creates a mirrored logical volume with Mirrors copies. For
example, specifying "-m 1" would result in a mirror with two-
sides; that is, a linear volume plus one copy.
-- excerpt from man 8 lvcreate
I have usually used LVM on top of RAID1, but using LVM mirrors might be one less piece of complexity.
For the snapshot:
Quote:
A full backup of a large data set may take a long time to complete. On multi-tasking or multi-user systems, there may be writes to that data while it is being backed up. This prevents the backup from being atomic and introduces a version skew that may result in data corruption. For example, if a user moves a file into a directory that has already been backed up, then that file would be completely missing on the backup media, since the backup operation had already taken place before the addition of the file. Version skew may also cause corruption with files which change their size or contents underfoot while being read.
To avoid downtime, high-availability systems may instead perform the backup on a snapshot—a read-only copy of the data set frozen at a point in time—and allow applications to continue writing to their data. Most snapshot implementations are efficient and can create snapshots in O(1). In other words, the time and I/O needed to create the snapshot does not increase with the size of the data set, whereas the same for a direct backup is proportional to the size of the data set. In some systems once the initial snapshot is taken of a data set, subsequent snapshots copy the changed data only, and use a system of pointers to reference the initial snapshot. This method of pointer-based snapshots consumes less disk capacity than if the data set was repeatedly cloned.
I use snapshots indirectly by telling rsnapshot to use snapshots for data on LVM volumes. It creates the snapshot for the duration of the backup, then removes it.
Mirroring and snapshots are two different features.
With LVM, one can set up mirrors:
Code:
-m, --mirrors Mirrors
Creates a mirrored logical volume with Mirrors copies. For
example, specifying "-m 1" would result in a mirror with two-
sides; that is, a linear volume plus one copy.
-- excerpt from man 8 lvcreate
Makyo:
Thanks for the command option!
Rated you for your contribution to the post and for adding interesting stuffs as well.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.