Topic: Use rsync to add SSD to Novena
EDIT April 29, 2015: updated step 1 to make the swap partition greater than 4 Gig to allow hibernate to work
I've seen other instructions for setting up Novena on an SSD, but to me they seemed overly complicated. The following is the method I used, it is simply copying the system from the existing SD card onto a new SSD.
note: I ended up using both parted and fdisk, for no particular reason, you could use fdisk for all of the partitioning steps. You can do steps 1 and 5 at the same time. The following is what I did, not necessarily the best way to do it.
High level steps:
1) Partition the SSD
2) Format the SSD
3) Mount the filesystem
4) rsync SD to the SSD
5) Set the SSD disk identifier
6) Tell eeprom tho use SATA for root
7) reboot
Step 1 - Partition the SSD:
NOTE: this step has been updated (April 29,2015) the swap partition must be at least 4 Gig to allow hibernate to work
Xobs' uboot setup expects the root to be parition 3 on the drive. I'll make partition 2 swap, which is how the SD is done, and partition 1 needs to be something, in this case I'll make it as big as parition 1 on the SD in case in some future iteration we somehow skip the SD completely.
parted /dev/sda
(parted) mklabel
New disk label type? msdos
(parted) mkpart
Partition type? primary/extended? primary
File system type? [ext2]? fat16
Start? 1049kb
End? 34.6mb
(parted) mkpart
Partition type? primary/extended? primary
File system type? [ext2]? linux-swap
Start? 34.6mb
End? 5GiB
(parted) mkpart
Partition type? primary/extended? primary
File system type? [ext2]? ext4
Start? 5GiB
End? 100%
(parted) print
Model: ATA Samsung SSD 850 (scsi)
Disk /dev/sda: 256GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 34.6MB 33.6MB primary fat16 lba
2 34.6MB 5369MB 5334MB primary linux-swap(v1) lba
3 5369MB 256GB 251GB primary ext4 lba
(parted) quit
Step 2, Formatting the SSD
Here we could ignore sda1, but I'll make it fat, again following the SD card layout. sda2 will be swap, and sda3 will be ext4 to hold the OS, and will take up all of the space on the drive not occupied by the first 2 partitions.
2a) fat on sda1
root@novena01:/boot# mkfs -t fat /dev/sda1
mkfs.fat 3.0.27 (2014-11-12)
2b) swap on sda2
root@novena01:/boot# mkswap /dev/sda2
Setting up swapspace version 1, size = 32764 KiB
no label, UUID=e0b5f581-7d00-4c57-af4c-56b3d0fe1148
2c) ext4 on sda3
root@novena01:/boot# mkfs -t ext4 /dev/sda3
mke2fs 1.42.12 (29-Aug-2014)
Discarding device blocks: done
Creating filesystem with 62498048 4k blocks and 15630336 inodes
Filesystem UUID: 5f85616d-c118-4f4d-8122-5b34233f1b74
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
Step 3 - Mount the filesystem:
In order to copy the SD contents to the SSD we must mount sda3
mkdir /mnt/sda3
mount /dev/sda3 /mnt/sda3
Step 4 - Rsync SD root to the SSD sda3:
You may have to apt-get rsync, I don't recall if it was present already. There is a lot of output from this command, which I did not bother copying. Basically it copies everything from your current root (SD card partition 3) to the SSD drive.
sudo rsync -avxS / /mnt/sda3
Step 5 - Set the SSD disk identifier:
Xobs has talked about this in a few places, basically uboot is looking for a particular disk id for root to be on. It could be a USB drive, or a SATA drive. In this step we set the correct disk ID onto our SATA SSD. Here we use expert mode in fdisk to change the disk id.
root@novena01:~# fdisk /dev/sda
Welcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): x
Expert command (m for help): i
Enter the new disk identifier: 0x4e6f7653
Disk identifier changed from 0x844bef5a to 0x4e6f7653.
Expert command (m for help): r
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
Step 6 - Tell eeprom to use SATA for root
Now we have to put a setting into the eeprom to let the system know we want the root volume to be on the SATA SSD. If this somehow goes wrong, you need to re-boot into revovery mode by holding the user button (for about 10 seconds) while powering on your board.
6a) Read out the existing features in your eeprom
root@novena01:~# novena-eeprom
Current EEPROM settings:
Signature: Novena
Version: 2
Serial: 262
MAC: 00:1f:11:02:16:05
Features: 0xf3 (es8328,senoko,pcie,gbit,hdmi,eepromoops)
EEPROM size: 65536
EEPROM page size: 128
Oops offset: 4096
Oops length: 61440
LVDS channel 1:
Modeline "lvds1" 0.000 1366 2749 4147 5723 768 1539 2324 3130 +HSync +VSync
Flags: 0x1c (vsync_polarity,hsync_polarity,mapping_jeida)
LVDS channel 2:
Modeline "lvds2" 0.000 65535 131070 196605 262140 65535 131070 196605 262140 +HSync +VSync
Flags: 0x3c (vsync_polarity,hsync_polarity,mapping_jeida,data_width_8bit)
HDMI channel:
Modeline "hdmi" 0.000 65535 131070 196605 262140 65535 131070 196605 262140 -HSync -VSync
Flags: 0x41 (channel_present,ignore_settings)
Here we see I have feature, "es8328,senoko,pcie,gbit,hdmi,eepromoops" and we are going to add sataroot.
6b) Before we make any changes, make a copy of the current eeprom just in case
root@novena01:~# novena-eeprom -e eepromNov30_2015
root@novena01:~# ls -l
total 4
-rw-r--r-- 1 root root 104 Mar 30 10:59 eepromNov30_2015
6c) Now we add the feature sataroot to the list of features we already have, use your feature list from above in this command:
root@novena01:~# novena-eeprom -f es8328,senoko,pcie,gbit,hdmi,eepromoops,sataroot -w
Updated EEPROM. New values:
Signature: Novena
Version: 2
Serial: 262
MAC: 00:1f:11:02:16:05
Features: 0x1f3 (es8328,senoko,pcie,gbit,hdmi,eepromoops,sataroot)
EEPROM size: 65536
EEPROM page size: 128
Oops offset: 4096
Oops length: 61440
LVDS channel 1:
Modeline "lvds1" 0.000 1366 2749 4147 5723 768 1539 2324 3130 +HSync +VSync
Flags: 0x1c (vsync_polarity,hsync_polarity,mapping_jeida)
LVDS channel 2:
Modeline "lvds2" 0.000 65535 131070 196605 262140 65535 131070 196605 262140 +HSync +VSync
Flags: 0x3c (vsync_polarity,hsync_polarity,mapping_jeida,data_width_8bit)
HDMI channel:
Modeline "hdmi" 0.000 65535 131070 196605 262140 65535 131070 196605 262140 -HSync -VSync
Flags: 0x41 (channel_present,ignore_settings)
Step 7 - Reboot:
Now you simply reboot, and the system should come up with your SSD as root. The boot partition is still on the SD, but it is very small so don't worry about startup being slow. You can run mount to see "/dev/sda3" is now your "/"