And when Oshunluver says he “re-snapshots the snapshot” he’s taking a rw snapshot of a ro snapshot so that when he makes it a new @ or @home or whatever, it can be read and written to.
Sent from my iPhone using Tapatalk
Announcement
Collapse
No announcement yet.
BTRFS for new users. Why you should consider it.
Collapse
This topic is closed.
X
X
-
Originally posted by Snowhog View PostThis confuses me; can't quite wrap my head around it. As I'm "visually oriented"; I need to 'see' things (actual, ideas, concepts, etc). So let me ask this: I take a snapshot. As you say, it is "initially empty". I immediately delete EVERYTHING except the created snapshot (this is a mental exercise, so go with me here). What good is the snapshot now? I can't recover from my self-inflicted gun shot with it, can I? I'm expecting the answer is "No, you cannot."
Snapshots are not copies of files. The files are already there. It copies the metadata. So a "pointer" to a file now exists in two places. If you "delete" a file from subvolume A, the metadata in that subvolume is deleted, but subvolume B remains untouched so the file is still there in B.
So to your example Snowhog:Subvolume A contains 1000 files using 10GB.
A snapshot of A is made and it's named subvolume B.
All 1000 files that are in A are also in B.
The used space on your drive does not change - still 10GB in use.
You delete subvolume A.
All 1000 files that formerly were in A are still in B.
The used space on your drive does not change - still 10GB in use.
The changes occur when you change a file that is part of a snapshot. So given that A and B still exist:You delete a file from subvolume A of 500MB.
Subvolume A now contains 999 files totaling 9.5GB.
All 1000 files that formerly were in A are still in B.
The used space on your drive does not change - still 10GB in use.
You add 10 files totaling 2GB to subvolume B.
Subvolume A still contains 999 files totaling 9.5GB.
Subvolume B now contains all the original 1000 files plus the 10 new ones and totals 12GB.
The used space on your drive grows to 12GB.
As you add and subtract files from each subvolume, they expand and contract accordingly, but the total space occupied on the file system (remember a snapshot must be co-located on the same file system as it's source) is the total amount of SHARED files (not two times the amount, just once) plus the total amount of DIFFERENT files.
In the EXT4 world, if you copied an entire partition, they have no relationship to each other. Therefore, the amount of used space doubles. Snapshots share filesystem space until a difference is introduced into one or both of the subvolumes.
A real world example:Prior to a new kernel install, take a snapshot.
Zero bytes added to the file system.
Install the new kernel and delete an old kernel.
New kernel adds 100MB and old kernel removes 90MB.
The file system grows by 100MB. It does not reduce by 90MB because the old kernel is still alive and well in the snapshot.
All is well? - Delete the snapshot. file system shrinks by 90MB.
All is not well? - Reboot to the snapshot and delete the source subvolume, file system shrinks by 100MB.
Deleting the snapshot removes the old kernel from the file system. Deleting the source subvolume removes the new kernel. ALL the other files remain in place and unchanged.
Does this help at all?
- Top
- Bottom
Leave a comment:
-
If you do a technical test of file system speeds, BTRFS is equivalent in some areas and slightly slower in some others when compared to EXT4. If performance is your only goal, then you would likely be using several different file systems as they all have their strengths and weaknesses. The point of BTRFS isn't speed, but ease of use and expanded functionality.
The hours I save not making or restoring backups or doing re-installs when I do something stupid (read the first post in this thread) more than make up for any milliseconds lost to transfer rates. Honestly, with a high-end machine and an SSD, I doubt there's any noticeable difference at all in real-world use.
Let me make my position clear:
There simply is no other file system that is as easy to use as BTRFS, period.
There is no other file system with the features that BTRFS has, period.
If simple and easy-to-use isn't what you're looking for, by all means use something else. There are plenty to choose from and Linux is all about choice.
As far as snapshots go, as GG said - they take zero space and grow as they age. If you have a small SSD, you have to monitor your usage more closely. @Here, just this week, I did some housekeeping and deleted 14 snapshots of varying ages of my install and home subvolumes. The oldest was 3 months or so old. I recovered 10GB of space from 14 snapshots, so really not a lot of space was used. By way of comparison, my @ subvol is 17.3GB and my home is 197.6GB. My habit is to keep 3 once-daily snapshots and weekly send 2 backups onto other devices. This is done in the background via a cronjob.
My roll-back procedure is to boot to another install (or liveUSB), mount the location that contains my install subvolume and it's snapshots, rename the failed install subvolume, re-snapshot the snapshot I want to roll-back to to the correct bootable subvolume name, and reboot. Takes a minute or less. To explain the naming thing just a bit further: My install subvolume is @KDEneon. My snapshots are @KDEneon_YYMMDD_HHMMSS. That way I know when they were taken. So if @KDEneon fails to boot, I rename it @KDEneon_bad, take a snapshot of @KDEneon_YYMMDDHHMMSS as @KDEneon, and reboot. Couldn't be easier or faster. Also, to roll-back from a non-failed install, you don't have to boot into another install first - just rename the subvolumes and reboot.
An EXT4 user wanting the same functionality would have to backup to another partition or device and then restore from that partition or device. Anyone do that every day? I doubt it. I snapshot anytime I think I might be doing something dangerous and daily just because. Obviously, a snapshot isn't going to save you from a failed drive. That's why I also do a weekly backup to two other drives. That too, happens automatically (via a cron activated script) while I'm working with no noticeable loss in usability of the system. I challenge anyone to find an easier way to do this.
- Top
- Bottom
Leave a comment:
-
Originally posted by GreyGeek View PostA snapshot is initially empty but...
- Top
- Bottom
Leave a comment:
-
A snapshot is initially empty but as a file is added, changed or deleted the original is copied to the snapshot.
So, it gets larger over time. A read only snapshot is like a save-point. Those are the ones you want to use as a roll back.
My HD’s are 5400 RPM and I can’t see any performance degradation over EXT4.
- Top
- Bottom
Leave a comment:
-
When distros pick it as the default, maybe with user-friendly aids to utlize the features, then I probably will use it. Then again, I may just be lucky as I have not had to do a reinstall of an OS other than replacing old, dead spinning drives in a loooong long time (other than for fun or out of boredom)
As a side note:
https://help.ubuntu.com/community/UbuntuReinstallation
I have used this method in the past, iirc probably back in the 8.10-12.04 era when I was running pre-releases as my daily driver. It did work. Dunno why I forgot this.
How much space do snapshots take, for those who have tiny SSDs?
What about performance on spinning 5400 rpm drives?
- Top
- Bottom
Leave a comment:
-
Originally posted by chimak111 View Post...
My Kubuntu 16.04 is the host and it is ext4 because that's the default. I wanted to learn about BTRFS by having a guest OS in a VM and using BTRFS for that guest. So my question was about whether learning about BTRFS that way is practical.
...
btrfs filesystem resize [<devid>:][+/-]<size>[kKmMgGtTpPeE]|[<devid>:]max <path>
The resize command does not manipulate the size of underlying partition. If you wish to enlarge/reduce a filesystem, you must make sure you can expand the partition before enlarging the filesystem and shrink the partition after reducing the size of the filesystem. This can done using fdisk(8) or parted(8) to delete the existing partition and recreate it with the new desired size. When recreating the partition make sure to use the same starting partition offset as before.
Growing is usually instant as it only updates the size. However, shrinking could take a long time if there are data in the device area that’s beyond the new end. Relocation of the data takes time.
- Top
- Bottom
Leave a comment:
-
Originally posted by chimak111 View PostI'm sorry for not being clear.
My Kubuntu 16.04 is the host and it is ext4 because that's the default. I wanted to learn about BTRFS by having a guest OS in a VM and using BTRFS for that guest. So my question was about whether learning about BTRFS that way is practical.
Meanwhile, I came across something related (?) to your caveat:from It’s 2016: and BTRFS could really be your next filesystem
Once you get your new SSD, I suggest making it bootable, creating a swap partition, then use the remainder as a single BTRFS file system. You could do a fresh Kubuntu 18.04 install there and leave your current one in place as a backup to boot to if necessary. I have six distros and their homes installed to my single BTRFS file system (480GB total - 2x250GB SSDs in RAID0). I use two BTRFS file systems on two hard drives for backups. BTRFS allows you to "send" (copy) an entire subvolume to another BTRFS file system. The copies can even be made bootable so I can boot to two other drives if needed. My system automatically makes two backups weekly (one of my primary distro, one of my home) and send them to each of the two backup drives. I also take daily snapshots of my subvolumes and extras when I'm doing something I may want to back out of later. It's all pretty slick and almost totally hands-off at this point.
- Top
- Bottom
Leave a comment:
-
Originally posted by oshunluvr View PostAre you asking about a Virtual Machine? If so, yes the guest file system on it's virtual drive is independent of the hosts.
This brings up one caveat about BTRFS: If you use virtual drives on a BTRFS file system (the host), you must use FIXED size drives, not dynamic. The way BTRFS works can cause corruption of dynamically allocated virtual devices, which includes swap files. If you use BTRFS as your host file system, you must use a swap partition not a swap file.
My Kubuntu 16.04 is the host and it is ext4 because that's the default. I wanted to learn about BTRFS by having a guest OS in a VM and using BTRFS for that guest. So my question was about whether learning about BTRFS that way is practical.
Meanwhile, I came across something related (?) to your caveat:As in any technology, BTRFS is not perfect. For example, it suffers when there are heavy write activities in the middle of an existing files, so probably it’s not the best candidate for virtualization (the virtual disks are updated in-place at each write).
- Top
- Bottom
Leave a comment:
-
Originally posted by GreyGeek View PostWords can't do snapshots and send & receive justice. IF you have the storage space I'd recommend using Oshunluver's setup where several distros are installed on one partition.
- Top
- Bottom
Leave a comment:
-
Originally posted by chimak111 View PostSilly question but ... can a guest Linux OS be BTRFS if the host OS (Kubuntu 16.04) is ext4?
This brings up one caveat about BTRFS: If you use virtual drives on a BTRFS file system (the host), you must use FIXED size drives, not dynamic. The way BTRFS works can cause corruption of dynamically allocated virtual devices, which includes swap files. If you use BTRFS as your host file system, you must use a swap partition not a swap file.
- Top
- Bottom
Leave a comment:
-
Silly question but ... can a guest Linux OS be BTRFS if the host OS (Kubuntu 16.04) is ext4?
- Top
- Bottom
Leave a comment:
-
Originally posted by Bings View PostI plan to use BTRFS for any future installs, Which will most likely be going up to 18.04 in a couple of months. I like the sound of the snapshot stuff.
- Top
- Bottom
Leave a comment:
-
I plan to use BTRFS for any future installs, Which will most likely be going up to 18.04 in a couple of months. I like the sound of the snapshot stuff.
- Top
- Bottom
Leave a comment:
-
+1 ,,,,,my 1TB storage drive uses it ,,,,and about 300GB of my 500GB system drive dose currently.
VINNY
- Top
- Bottom
Leave a comment:
Leave a comment: