1

I'm looking for a Linux distribution that will run (uncompressed) on a FAT16/32/NTFS partition, preferably on an external USB drive. I've come across Slax and Porteus as well as a few others but they all use a modular system to contain their system files. If such a distribution does not exist, how can I modify a Linux distribution to work on such partitions? Things like security, permissions and speed are not important here.

The reason for this is I am looking at how the internals of xorg and a Linux desktop actually works, downloading the files and looking at the documentation isn't giving me what I'm looking for. I'm using QEMU as a means to be able to boot the USB drive and see the filesystem at the same time.

  • Hello, please try to clarify what you mean by "modular system to contain their system files" and what your problem is, exactly. Almost all distributions can run off USB drives. – Sebastian Aug 28 '15 at 9:51
  • Sorry, I should have made that part a bit clearer. I want to use an extracted filesystem. For example, /etc, /usr /*whatever on the root of the drive as it would normally appear under Linux. – MrMe01 Aug 28 '15 at 10:02
  • A single block device cannot be mounted, read or written by 2 or more systems simultaneously. You might want to set up an NFS based diskless system. – yaegashi Aug 28 '15 at 12:26
  • To the contrary, I've got access to the drive in Windows explorer whilst it is booted (in stock form) on QEMU. I doubt that will change once it's running outside of it's archived form. – MrMe01 Aug 28 '15 at 13:18
  • After posting my answer I hit upon the idea just using SSH to log into a running Linux desktop on QEMU or VirtualBox and doing what you want, which is much simpler. You can access the file system using Windows Explorer by setting up Samba share. – yaegashi Aug 28 '15 at 13:57
0

A single block device cannot be mounted, read or written by 2 or more systems simultaneously, so using a USB drive as shared storage is not appropriate for your purpose. You might want to set up a diskless system based on NFS which allows to share the file system on a per-file basis among multiple hosts.

Here's mini howto using prebuilt image of full (but a bit old) Debian desktop found in this site. I'm assuming working on a Debian host, but I believe you can easily adapt it with other distro.

Download the QCOW2 image debian_wheezy_amd64_desktop.qcow2 from the site above. To extract the image you'll need qemu-nbd (apt-get install qemu-img):

# modprobe nbd
# qemu-nbd -c /dev/nbd0 /path/to/debian_wheezy_amd64_desktop.qcow2
# mount /dev/nbd0p1 /mnt -o ro
# mkdir -p /srv/nfsroot/wheezy
# rsync -avP /mnt/ /srv/nfsroot/wheezy/
# umount /mnt
# qemu-nbd -d /dev/nbd0

You need to fix some files in /etc for the diskless system. First, comment out lines starting with UUID= in /srv/nfsroot/wheezy/etc/fstab, which refer harddisk partitions:

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda1 during installation
#UUID=613f176b-eca4-47e6-93a6-32653ca1982e /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda5 during installation
#UUID=24674a13-481b-4ff8-913f-9099661397bd none            swap    sw              0       0

Second, add the following in /srv/nfsroot/wheezy/etc/network/interfaces to keep NetworkManager away from eth0:

auto eth0
iface eth0 inet dhcp

Set up NFS server on your host:

# apt-get install nfs-kernel-server
# vi /etc/exports
# exportfs -ra

Put the following line in /etc/exports:

/srv/nfsroot/wheezy *(rw,sync,no_subtree_check,no_root_squash,insecure)

Now launch QEMU using kernel and initrd images with nfsroot cmdline:

# qemu-system-x86_64 -enable-kvm -m 512 -kernel /srv/nfsroot/wheezy/boot/vmlinuz-3.2.0-4-amd64 -initrd /srv/nfsroot/wheezy/boot/initrd.img-3.2.0-4-amd64 -append "root=/dev/nfs nfsroot=192.168.1.2:/srv/nfsroot/wheezy ip=dhcp rw"

where you need to specify your host's IPv4 address in nfsroot=. It's accessed from QEMU's internal network via built-in NAT.

Now you got a GUI login screen in the QEMU window, while you can see/modify any files of the system in /srv/nfsroot/wheezy at the same time. Default system settings like users/passwords are described in README.txt.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.