Yes, this can be done.
Yes, you can use it for a dual-boot windows system, provided you make Windows the first partition, and it's a primary partition (not an extended inside a logical). My instructions here do not cover this situation, which requires you have some experience dealing with dual booting. If you're after a dual-boot windows/linux setup, don't follow any advice below this point.
I'll go one better: with only a few exceptions, you should be able to migrate your entire laptop live, provided you use an external drive with enough capacity.
Warning! This proceedure is EXTREMELY DANGEROUS! It assumes you have intimate knowledge of the partitioning process, you have a separate /boot partition, and you know a botched attempt can leave you with a brain-damaged installation THAT WON'T BOOT! YOU HAVE BEEN WARNED!
You'll need:
- /boot located on a separate partition. If you have a combined root filesystem (everyting is stuffed into / ) then this won't work.
- The ability to boot from a USB hard drive.
- an external drive large enough to hold all of the data and programs on your existing system. Be sure to run a "du /" and wait for the end result, to get a real feel for the kind of space you'll need.
General Procedure (forgive me for lack of a few commands, I'm writing this very quickly):
- Attach the external drive and locate its device name. Let's pretend that you see it as /dev/sdb.
Create a two partitions on your external drive. In our example, this will show up as /dev/sdb1 and /dev/sdb2.
parted /dev/sdb
Format the first partition as ext2 or ext3, and labeled "boot". Format the second partition on the external drive as type "Linux LVM".
Get the newly minted LVM volume recognized by the system using
pvscan ; vgscan
Carve off a large-enough chunk of the external LVM volume to hold the entire laptop's hard drive. If in doubt, just use all of the space available.
Format your LVM-based volume as ext3 or whatever filesystem tickles your fancy.
mke3fs /dev/ExternalUSBVolume/ExternalRoot
For each non-special file system mount, create a directory on your external disk and copy (with attributes) all of your files in each mount to that disk. Ignore copies of mountpoints like /proc, etc. as these are "special".
- create the special mountpoints by hand, so that they exist on your external drive. Do not populate them, just make sure the names and permissions match.
- (Very carefully) use your bootloader to install a boot image on your external drive, into the /boot partition. This process is a bit complex so I'll leave it to you to find the info elsewhere. It's also dangerous if you botch it - you could end up trying to overwrite your bootloader on your laptop drive. Be careful.
- Reboot your laptop. When it is going through the POST, be sure to specify the external drive as your boot drive. At this point in time, you should have a (more-or-less) near-replica of your laptop's drive. (to the other admins out there: yes, I know, the log files and others are not in a 100% copied state, but that's not the emphasis here...it's on getting the data and tools moved over...)
- Once you can boot from the external drive, you can then use it to wipe your laptop drive. At this point, you're "living out of" your external drive. Keep this in mind.
- Then use a partition editor - gparted or whatever - to delete the original laptop partitions (bye-bye data...), then mark your newly-minted area as "LVM". Go through the process of getting your LVM volume recognized, partitioned, formatted, etc.
- Using LVM's mirroring process, mirror your live system (which is currently on the external drive) back to the laptop drive. Take a lunch break (or two) for this as it will take time.
- Remount the live filesystem, moving the / filesystem from the external drive to your laptop LVM volume.
- Re-run your bootloader installation process. This is critical as the current ramdisk will not have the right settings and will not know you've moved things around. Failing to do this will result in an unbootable system and a visit to a rescue disk. If all else fails, you can boot from your external drive again (nothing lost...)
- Reboot the laptop without the external drive attached, and specifying the laptop's internal drive instead. It should boot fine. Note anything that feels or looks hurt or broken (there shouldn't be anything), and fix it.
- Sit back and enjoy a beverage for a job well done.
Your dmesg
output should give you an indication as to why it's signalling failure to the PV; that shouldn't be happening. As far as getting the system writable again, kicking the VG and LV to read-only and then back to read-write works from memory, but the real resolution is getting md to stop worrying LVM unnecessarily.
Best Answer
It looks like the system splits up each drive into as many partitions as needed to create a series of RAID5 and/or RAID1 arrays that minimize the amount of unused space on the drives. Those RAID arrays then become physical volumes under LVM, which, in turn, presents all that storage as a single logical volume.
Current versions of
mdadm
do allow you to add devices to RAID5 arrays and to reshape RAID1's into RAID5's, so it is possible to add disks to this thing to grow the available storage "on the fly". Adding a new disk would be a matter of creating the appropriate partitions on the disk, and then adding its partitions to existing RAID5's and/or RAID1's, or creating new RAID1's with unused space from other disks. You can also increase your storage space by replacing a smaller disk with a larger one. I haven't thought too deeply about all the possible corner cases, but I imagine there will be a number of them.Presumably, Synology has automated all this with their own custom programming, but I don't see why it couldn't be set up manually. Perhaps someone out there has already come up with the equivalent scripts? (I don't know.)
Keep in mind that this thing's failure mode is going to be just like RAID5: If a single drive fails, and then another one fails during the resync, bye-bye data. So I wouldn't use this configuration with more than, say, 5 or 6 drives, at the very most.