
On 23/2/19 5:16 pm, Craig Sanders via luv-main wrote:
On Sat, Feb 23, 2019 at 03:42:57PM +1100, Andrew Greig wrote:
Now I need to plug in my old SATA drive and copy my data to one of my data drives.
Small thing, when I was setting the partitions the system did not like /data on two separate drives so for the moment one is /data0 and the othe is /data1. If I load one of the drives with my data, as soon as RAID is setup will that data copy across to the other drive?
And the next step is RAID
Well, kind of. Not if you're talking about using mdadm for RAID-1. btrfs does its own raid. and volume management. There's no need for mdadm or lvm or anything else. If you've used btrfs for those drives then what you need to do is:
1. unmount both of them $sudo umount /dev/sdb1 && umount /dev/sdc1 ?
2. remount ONE of them (say, data0) as /data (and edit /etc/fstab so that it gets mounted as /data on every reboot. also delete the line in fstab that mounts data1).
Here is my current fstab (please note, partition manager took me an hour and a half to negotiate and I was unable to install swap on my SSD so I put a swap partition on each of the two SATA drives so that they would be exactly the same size. ) andrew@andrew:~$ cat /etc/fstab # /etc/fstab: static file system information. # # Use 'blkid' to print the universally unique identifier for a # device; this may be used with UUID= as a more robust way to name devices # that works even if disks are added and removed. See fstab(5). # # <file system> <mount point> <type> <options> <dump> <pass> # / was on /dev/sda2 during installation UUID=d8e97417-7029-4f22-87ed-df529ac19614 / btrfs defaults,subvol=@ 0 1 # /data0 was on /dev/sdb2 during installation UUID=0e8718c8-03bf-4f1a-915f-df03fe117dc0 /data0 btrfs defaults 0 2 # /data1 was on /dev/sdc2 during installation UUID=5969127b-f5e0-40dc-98ba-ea7252c9ee41 /data1 btrfs defaults 0 2 # /efi was on /dev/sda1 during installation UUID=b588608e-8cf7-43be-8a53-03dfde6f8f15 /efi btrfs defaults 0 2 # /home was on /dev/sda2 during installation UUID=d8e97417-7029-4f22-87ed-df529ac19614 /home btrfs defaults,subvol=@home 0 2 # swap was on /dev/sdb1 during installation UUID=ad17f0bf-978c-4905-b421-2113b7eb5ba9 none swap sw 0 0 # swap was on /dev/sdc1 during installation UUID=dba5db92-eee2-4633-ba6c-86b68bc2d957 none swap sw 0 0 andrew@andrew:~$
3. destroy the partition table on the data1 drive, and recreate it (again, one big partition for the entire disk[1]) So by deleting the partition we eliminate the FS (btrfs) and in the addition step the FS is rebuilt?? but specifically to control both disks?
Can /dev/sdc2 can be deleted with gparted?
4. add that drive to the existing btrfs array on /data
e.g. *IF* /data1 was sdc1, you'd do something like:
sudo btrfs device add -f /dev/sdc1 /data sudo btrfs balance start -dconvert=raid1 -mconvert=raid1 /data
The earlier you do this (i.e. the less data is already on it), the faster this conversion to raid1 will be. Nearly instant if there's little or no data. Much longer if there's a lot of data that needs to be synced to the other drive.
i.e. best to do it before copying the data from your old drive.
I have about 4Gb only of data from this morning's photo shoot, I can move that back to /home/andrew easily enough. I just tried the Data drive to see how my CHOWN went. ( I cheat, I use mc)
[1] technically, you don't need a partition, btrfs can use the entire disk. but IMO a partition table is useful for clearly identifying that a disk is in use and what it is being used for. It doesn't hurt in any way to have one and the space used by the partition table is trivial - at most, a sector for the partition table itself and another 2047 sectors[2] to ensure that the first sector of the first (and only) partition is aligned at a 4K sector boundary. i.e. 1MB out of your 2TB drive.
[2] it's not uncommon on disks with GPT partition tables (instead of the old style ms-dos partition tables) to create a tiny partition in that area with type EF02 for grub, especially if they're ever going to be used to boot grub.
craig
-- craig sanders <cas@taz.net.au> _______________________________________________ luv-main mailing list luv-main@luv.asn.au https://lists.luv.asn.au/cgi-bin/mailman/listinfo/luv-main