I bought a new shiny SSD to give my laptop a boost, and I have to install Arch on it. But since I use my laptop also for work I can't afford a one-two days of downtime to go through all the install phases. So my idea was to connect the SSD to my laptop using an external dock with USB connection, and install Arch via USB so that I have my HDD still working under the hood until the SSD is ready to be installed.
Two ways to do this came to my mind. The first, naive one is to reinstall all my pacman packages into the SSD by mounting it and then giving some commands like these:
# pacman -Sy # cp -r /var/lib/pacman/* /media/SSD/var/lib/pacman/ # pacman --dbpath /media/SSD/var/lib/pacman/ --root /media/SSD/ --cachedir /media/SSD/var/cache/pacman/pkg/ -S $(pacman -Qq) # cp -r /home/myhome /media/SSD/home/
Then I think I would need to install grub on the MBR. But it sounds too simplistic and I fear that this kind of procedure is a no-go.
So I thought about starting my laptop with the Arch install cd, mount the external SSD and go through the installation procedure. This sounds a bit more reasonable, but I don't know if the install scripts support installation on a USB device.
Option number 3, maybe there's a smarter way which I don't know...
Can someone please give me some good advice? By the way, would you use ext4 or btrfs for the new installation on SSD? Thanks.
No need for the installation CD, just install arch-install-scripts from [extra] on your current system - it's a very small package.
Then - following the install guide - connect your ssd, partition, mkfs'es, mount the partitions, then pacstrap /mnt base base-devel, and on from there. I've done this several times to install bootable systems onto flash drives.
If you wanted to install every package you have on the computer to the SSD you could also (at the pacstrap step) do
pacstrap /mnt $(pacman -Qeq)
Edit: also to ensure the future disk change out goes smoothly, make sure you only use UUIDs for everything (fstab and bootloader). Also be sure to have the 'usb' hook in mkinitcpio if you want to be able to boot from the external ssd.
Edit: modified pacman command to match recommendation below so inadequate info wasn't hanging around the forum.
Last edited by Trilby (2012-11-22 11:58:58)
Thanks Trilby, sounds quite a neat procedure; I'll try with this. Just another couple of questions: I'm currently on i686 with sysvinit but I'd like to move to x86_64 and systemd. Will pacstrap create a systemd setup (I guess so)? Can I install an x86_64 system on the SSD starting from my i686 operating system?
Systemd will be installed just fine. But it's not quite so easy to install x86_64 from a i686 system. I suspect it'd still be pretty easy - I think it you might just have to either temporarily edit the current systems pacman.conf or point pacstrap to an alternate conf file that has the 'arch' architecture set appropriately. I have not, however, ever done this myselft.
Thanks again, I'll give it a try when I'll have some spare time. Any suggestion about ext4/btrfs?
You'll want to do
pacstrap /mnt $(pacman -Qeq)
else everything on your current system will be installed explicitly instead of the dependencies being marked as such. It should still work the same.
Well, I don't know your current partition layout, but for the this example:
Let us assume you only have /boot /home and / ROOT partitions.
Leave your current hard drive in the laptop, and connect the new SSD via USD or whatever.
Let us assume that your current hard drive is on /dev/sda
Let us assume that your /boot partition is on /dev/sda1
Let us assume that your / ROOT partition is on /dev/sda2
Let us assume that your /home partition is on /dev/sda3
Let us assume that you want the same partition setup on your new drive
Let us assume that the attached new SSD drive is on /dev/sdb
Let us assume you are going to use MBR and BIOS to boot
I suggest using ext4 so Let us assume you are going to use ext4 on the new SSD (but it dose not make any difference)
Boot into the Arch Linux Live install environment
use fdisk to create your partitions on the new SSD /dev/sdb (make sure to mark the new /boot partition with the Boot flag)
Now format the partitions on the new SSD
mkfs.ext4 -L BOOT -b 4096 -E stride=128,stripe-width=128 /dev/sdb1 mkfs.ext4 -L ROOT -b 4096 -E stride=128,stripe-width=128 /dev/sdb2 mkfs.ext4 -L HOME -b 4096 -E stride=128,stripe-width=128 /dev/sdb3
Now mount all the partitions and copy all the directories and files to the new SSD
mkdir /mnt/sda mkdir /mnt/sdb mount /dev/sda2 /mnt/sda mount /dev/sda1 /mnt/sda/boot mount /dev/sda3 /mnt/sda/home mount /dev/sdb2 /mnt/sdb mkdir /dev/sdb1 /mnt/sdb/boot mkdir /dev/sdb3 /mnt/sdb/home # # This is the fancy part # We will use tar to copy all the files and stuff # The -p flag will make sure that EVERYTHING # Is copied correctly i.e. suid, permissions, Sticky Bit . . . for i in `ls /mnt/sda` do tar -C /mnt/sda -cpf - $i | tar -C /mnt/sdb -xpf - done sync umount /mnt/sda/boot umount /mnt/sda/home umount /mnt/sda umount /mnt/sdb/boot umount /mnt/sdb/home umount /mnt/sdb
NOW, poweroff the laptop
Take out the current Hard Drive, and install the SSD
NOW, Boot back into the Arch Linux Live install environment
Connect to the Internet however...
mount /dev/sda2 /mnt/ mount /dev/sda1 /mnt/boot mount /dev/sda3 /mnt/home arch-chroot /mnt pacman -Syy pacman -S grub-bios grub-install --target=i386-pc --recheck /dev/sda cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo grub-mkconfig -o /boot/grub/grub.cfg # Now edit /etc/fstab # Add the mount options # ,discard,stripe=128 # to every partition on the SSD exit sync umount /mnt/home umount /mnt/boot umount /mnt reboot
Last edited by hunterthomson (2012-11-22 05:35:31)
Thanks hunterthonsono for your suggestion. I don't want to make a 1:1 copy of my actual HDD on the SSD, for two reasons: the first is that I have an i686 system and I want to move to x86_64, the second is taht I'm still with a sysvinit setup and I want to move to systemd (which I think is more easy by doing a brand new installation). I think that I'll go with te pacstrap approach suggested by Trilby and see if I can mange to install an x86_64 system.
Meanwhile, yesterday I partitioned my SSD with gparted using a GPT partition table (making a boot partition). Then I checked with parted for partitions alignment and it says that they are all aligned, so I think that I'll proceeed with the pacstrap stage shortly.
Thanks everybody for the suggestions!
Awe yes, I totally agree. Just starting fresh with systemd is the way to go. That is what I did. I figured I would end up with a cleaner system and most of all it would be the best way to learn the new system.
I think x86_64 is a good idea. Same goes for GPT.
I managed to customize pacman.conf and mirrorlist in order to target x86_64 repositories, but pacstrap (or more probably pacman) complains about incompatible target architecture. It sounds fair, since if some pre or post install operations involve the execution of some binaries from the freshly installed packages, then my 32 bit system will be unable to execute the newly installed 64 bit binaries.
I guess the only way is to go with installation cd...
OK, using the 64 bit installation on my laptpop I have been able to run pacstrap, install core packages and all the stuff described in the installation guide. I installed grub package and then chorooted into the SSd and then installed grub with:
grub-install --target=i386-pc --recheck --debug /dev/sdb
Then I tried to boot from USB but I felt in grub rescue mode, since the loader couldn't find the /boot/grub/i386-pc/normal.mod module (I checked and the module is present in the SSD in the right folder). So I went back to my 64 bit system, chrooted and installed grub again with:
grub-install --target=i386-pc --recheck --debug --modules "usbms usb" /dev/sdb
to include usb modules in the grub core image so that it could read the /boot/grub/i386-pc/ folder. Then I rebooted and, to my surprise, I discovered that grub sees the all the subfolders of / and in particular /boot, but nothing else inside /boot, even if it contains grub/, initramfs and all the usual stuff (I can see these by mounting the SSD via USB after booting from HDD). Oddly enough, grub can see every file inside /usr/include, /usr/lib ans some other folders; some others seems empty as /boot.
I am quite confused, I don't know what may have gone wrong. My idea is that some other modules are needed into grub core image, maybe one module is needed to read ext4 file systems? The ext2 module is builtin and I read that it covers also ext4...