Page 1 of 3 123 LastLast
Results 1 to 10 of 25

Thread: Snapshot / Clone a Directory/Disk for Backup purposes

  1. #1
    Join Date
    Feb 2010
    Location
    South Dakota, USA
    Posts
    171

    Default Snapshot / Clone a Directory/Disk for Backup purposes

    I would like to know the trick, or tricks, to mount a "cloned" (assuming that is the right word) directory/partition as "read-only" so I can back it up and maintain the atimes and ctimes of the files & directories. I'm aware that TAR and STAR has options to preserve the access times, but they change the ctimes, and of course, ARJ has the -j#3 feature option, but it may change the ctimes too, when restoring times too. I have done this "cloning or snapshot" before from some information I got somewhere before in the past, but I could not umount the 'read-only' clone place once I was done.

    So, what I want to do is clone /home/username to /media/spare/mnt as read-only and do the backups on the /media/spare/mnt directory as the cloned copy of my home directory, then be able to umount the /media/spare/mnt directory after I'm done.

    The /home directory itself is on a separate partition (/dev/sda7) and I am using openSUSE 13.1 KDE.

    Cliff

  2. #2
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,157

    Default Re: Snapshot / Clone a Directory/Disk for Backup purposes

    As a side remark. I see that you use /media for your own purposes. You better do not. /media is often a tmpfs (and thus you will loose that mountpoint over a shutdown) and strictly ment for use by the automatic desktop mounting features. You better use /mnt when there comes no better place to your mind.
    Henk van Velden

  3. #3
    Join Date
    Jun 2008
    Location
    Groningen, Netherlands
    Posts
    19,853
    Blog Entries
    14

    Default Re: Snapshot / Clone a Directory/Disk for Backup purposes

    @Cliff: step away from the Windows world. ARJ f.e. is old, and will not serve your purposes. Use RAID, or use a good backup/sync program (add it as a cron job f.e.)
    ° Appreciate my reply? Click the star and let me know why.

    ° Perfection is not gonna happen. No way.

    https://en.opensuse.org/openSUSE:Board#Members
    http://en.opensuse.org/User:Knurpht
    http://nl.opensuse.org/Gebruiker:Knurpht

  4. #4
    Join Date
    Feb 2010
    Location
    South Dakota, USA
    Posts
    171

    Default Re: Snapshot / Clone a Directory/Disk for Backup purposes

    Quote Originally Posted by hcvv View Post
    As a side remark. I see that you use /media for your own purposes. You better do not. /media is often a tmpfs (and thus you will loose that mountpoint over a shutdown) and strictly ment for use by the automatic desktop mounting features. You better use /mnt when there comes no better place to your mind.
    Thanks for the info Henk. The /media/ directory is used for Linux-supported file systems, DVD/CD Drives, USB Stuff like Flash Drives and the Digital Camera (in the past, the Floppy Disk Drive which I have disabled in the BIOS). And for vfat, I use the /windows/ directory. None of the sub directories to those directories get lost when I reboot/shutdown, because I just checked the spare openSUSE system on another partition and the primary sub-directories are still there.

    Years ago, I noticed that this was the directory that, say, a File Manager, would mount to, when clicked on, adding the LABEL of the disk as a sub-directory, i.e. /media/LABEL, and have been doing it that way for over 4 years, but as of recently I noticed they are now doing them in the /var/run/home/username/LABEL and /run/home/username/LABEL directories when I click on them (i.e. Dolphin). Seems to me that if a partition can be locatable in two places like this, I should be able to do a clone copy of the /home directories (as read-only) elsewhere, or even the user directory alone (/home/username)[?.]

    But I've often been curious as to why the /mnt/ is even there ... I thought it might have been an older usage, but I do see it used in some manuals. Do you really think I should change some, or all of those from /media/ to /mnt/? Seems like I remember using that dir when using the Clonezilla live CD. Just Curious -- you say /mnt/ would be best; and it would be an easy task to make the changes in the files.

    Cliff

  5. #5

    Default Re: Snapshot / Clone a Directory/Disk for Backup purposes

    Quote Originally Posted by Star_Gazer View Post
    Years ago, I noticed that this was the directory that, say, a File Manager, would mount to, when clicked on, adding the LABEL of the disk as a sub-directory, i.e. /media/LABEL, and have been doing it that way for over 4 years, but as of recently I noticed they are now doing them in the /var/run/home/username/LABEL and /run/home/username/LABEL directories when I click on them (i.e. Dolphin). Seems to me that if a partition can be locatable in two places like this, I should be able to do a clone copy of the /home directories (as read-only) elsewhere, or even the user directory alone (/home/username)[?.]
    The Desktop Environment (i.e. dolphin) uses udisks to mount the disks when you click on them.
    udisks1 mounted disks/partitions to /media/LABEL, it's successor udisks2 uses (/var)/run/media/username/label instead.
    Btw. the two "filesystems" /run and /var/run are not really two distinctive filesystems, they both point to the same filesystem.
    You could do the same by a so-called "bind mount", see "man mount".

    IMHO you can just continue to use /media, it is no tmpfs anymore (it was on openSUSE 12.1 and 12.2) since udisks2 doesn't use it by default.
    And udisks is actually clever enough to not get disturbed by your directories in there. If it wanted to create a mountpoint that already existed, it appends "-1", "-2", and so on...

    But I've often been curious as to why the /mnt/ is even there ...
    I think /mnt was originally there to be able to mount your root file system in the rescue system or something like that.

  6. #6
    Join Date
    Feb 2010
    Location
    South Dakota, USA
    Posts
    171

    Default Re: Snapshot / Clone a Directory/Disk for Backup purposes

    Quote Originally Posted by Knurpht View Post
    @Cliff: step away from the Windows world. ARJ f.e. is old, and will not serve your purposes. Use RAID, or use a good backup/sync program (add it as a cron job f.e.)
    Thank you for your input. I understand that ARJ (and ZIP) originated for DOS/WINDOWS, and so did 7z, but all 3 of them have been made available for UNIX/LINUX years ago (though p7zip not so long ago). In fact, ARJ (ARJ Russia, not the one from JUNG) is available for some distros in their repositories, but not so for openSUSE, which I find strange because ARJ Stores the user/group names/numbers, file attrs, symlinks, and other special files, and 7z, which seems to be installed when openSUSE is installed and is on the LIVE CD, and yet, 7z does not store the user names, and I know it does not extract the same file permissions as they were when 7z archives the files. Nonetheless, I still use 7z, as well as STAR, TAR, ARJ and ZIP ... I just want to maintain the "access timestamps", and if possible, the "changed filestamps", respectfully, and I don't see 'rsync' doing that. I'm not familiar with RAID, but have seen it mentioned often, and did read about it some time in the past.

    Thus, the idea is to have a read-only "snapshot" (or cloned) copied of my home user directory, even if I have to go into the root account to do so

  7. #7
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: Snapshot / Clone a Directory/Disk for Backup purposes

    On 2013-12-21 22:56, wolfi323 wrote:

    > IMHO you can just continue to use /media, it is no tmpfs anymore (it was
    > until openSUSE 12.2) since udisks2 doesn't use it by default.


    But it does with a simple change. IMO, it is best to stay away of "/media".

    >> But I've often been curious as to why the /mnt/ is even there ...

    > I think /mnt was originally there to be able to mount your root file
    > system in the rescue system or something like that.


    I understand it is the standard place for manual, non default, mounts.

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 13.1 x86_64 "Bottle" (Elessar))

  8. #8

    Default Re: Snapshot / Clone a Directory/Disk for Backup purposes

    Quote Originally Posted by robin_listas View Post
    On 2013-12-21 22:56, wolfi323 wrote:

    > IMHO you can just continue to use /media, it is no tmpfs anymore (it was
    > until openSUSE 12.2) since udisks2 doesn't use it by default.


    But it does with a simple change. IMO, it is best to stay away of "/media".
    Yes, but you would have to make that change manually first...

    And I repeat: udisks1 and udisks2 are clever enough to not get confused by already existing directories in there.

  9. #9
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    11,296
    Blog Entries
    2

    Default Re: Snapshot / Clone a Directory/Disk for Backup purposes

    Seems this thread got off on a little bit of a tangent (although still useful info).

    1. I'm not entirely clear about your "read only" requirement, if it's related to your source directory/disk, that's not an issue in UNIX (but is in Windows which puts a lock on the file system when it's being accessed with more than read-only permissions).

    2. You may need to specify your requirement and need if you're considering a snapshot or cloning, IMO they describe slightly different operations. But, you can consider
    dd -- The universal disk block copier
    Various apps can help automate and manage the cloning process, including compressing or sending across a network.
    My personal "enterprise" tool is G4U (g4u - Harddisk Image Cloning for PCs) I haven't seen anything to compare with its versatility.
    Personal cloning can be done with apps like the popular Clonezilla.

    When you use the above apps, you don't have to deal with the miscellaneous gruntwork mounting/unmounting if they're even necessary (likely not). Just specify source and destination and execute (after optionally specifying some other configs).

    HTH,
    TSU

  10. #10
    Join Date
    Feb 2010
    Location
    South Dakota, USA
    Posts
    171

    Default Re: Snapshot / Clone a Directory/Disk for Backup purposes

    Quote Originally Posted by wolfi323 View Post
    The Desktop Environment (i.e. dolphin) uses udisks to mount the disks when you click on them.
    udisks1 mounted disks/partitions to /media/LABEL, it's successor udisks2 uses (/var)/run/media/username/label instead.
    Btw. the two "filesystems" /run and /var/run are not really two distinctive filesystems, they both point to the same filesystem.
    You could do the same by a so-called "bind mount", see "man mount".

    IMHO you can just continue to use /media, it is no tmpfs anymore (it was on openSUSE 12.1 and 12.2) since udisks2 doesn't use it by default.
    And udisks is actually clever enough to not get disturbed by your directories in there. If it wanted to create a mountpoint that already existed, it appends "-1", "-2", and so on...


    I think /mnt was originally there to be able to mount your root file system in the rescue system or something like that.
    Thanks for the educational information wolfi323.

    I was familiar that filesystems mounted (twice) as (/var)/run/media/username/label are for the same filesystem/partition, though I don't know the point of that. But it gives me the impression that I can do a second one of /home (or maybe even the /home/username itself), but have it mounted as read-only and backup from that, while I'm logged into my personal user account. I could whiz on over to the root user and remount the /home directory as read-only, (I have a separate partition for /root), but files are changing on my system all throughout the days (i.e. Documents, email messages, etc.), so I venture for something less time-consuming, and I would like to maintain the "access times" for when an application for those files access the files, instead of a backup program resetting those timestamps, so I can see which files are not being used (some will be obvious, like old bitmap images), like for particular directories (do I even need it anymore?); one example, would be I noticed LibreOffice Suite using user-defined directories, yet, there was a ".ooo3" directory and sub-directories, so I was wondering if LibreOffice was using that or not -- I'll find out soon enough -- I removed the directory and contents yesterday (I have more than one backup of that directory and its contents).

    OTOH, I'm just realizing that a "Search In Files" feature/plug-in of a program, or 'grep', most likely changes the access times anyway ... something I need to think about.

Page 1 of 3 123 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •